@langgenius/syncless-darwin-x64 0.0.15-beta.0 → 0.0.15-beta.2
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/package.json +1 -1
- package/payload/.env +1 -1
- package/payload/dist/cli.js +7 -6
- package/payload/package.json +2 -2
package/payload/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9a28fe3b-16c0-5dba-8b31-6c738c6b2685")}catch(e){}}();
|
|
4
4
|
import{a as __toCommonJS,i as __require,n as __esmMin,o as __toESM,r as __exportAll,t as __commonJSMin$1}from"./chunk-Bdh3yLIe.js";import{$ as WS_RPC_PREFERENCES_CHANNELS,A as createObservedFetch,B as redactHeaders,C as nativeEnum,D as string$2,E as record$1,F as parseObservabilitySinkNames,G as CLI_BRAND,H as redactUrlString,I as resolveAppVersionFromRelease,J as NetworkRpcObservabilityTag,K as NetworkRpcObservabilityErrorMessage,L as trimAndLowercase,M as applyClientScopeSnapshot,N as createCompositeSink,O as union$4,P as createNoopNetworkObservabilityPort,Q as WS_RPC_CHANNELS$1$1,R as trimAndUppercase,S as literal$1,T as object$1,U as sanitizeObservabilityAttributes,V as redactString,W as createNoopSink,X as PRODUCT_DISPLAY_NAME,Y as NetworkRpcObservabilityTransportPhase,Z as WS_RPC_CHANNELS$1,_ as _enum$1,_t as string$1,a as GetSessionResultStatus,at as taskMessageMetadataSchema$1,b as discriminatedUnion$1,ct as _null,dt as boolean,et as WS_RPC_REVIEW_CHANNELS,ft as discriminatedUnion,g as nullAsUndefined,gt as record,h as jsonValueSchema$1,ht as object,i as ReleaseProduct,it as projectTemplateConversationOpenerSchema$1,j as ObservabilitySinkName,k as unknown,l as getSsoAuthorizationCompletion,lt as array$2,m as startSsoAuthorization,mt as number$2,n as CliReleasePlatform,nt as WS_RPC_USER_PIPELINE_SETTING_CHANNELS,o as exchangeCliSessionBootstrap,ot as jsonValueSchema,p as startOAuthAuthorization,pt as literal,q as NetworkRpcObservabilityRpcResult,r as ReleaseChannel,rt as WS_RPC_WORKSPACE_CHANNELS,s as getOAuthAuthorizationCompletion,st as _enum,t as checkForUpdates,tt as WS_RPC_TASK_CHANNELS,u as revokeCliSession,ut as bigint,v as array$3,vt as union$3,w as number$3,x as lazy,y as boolean$1,z as createFrontendObservabilityRuntime}from"./dist-Bu1YPPQW.js";import{i as LoginCycleStatus,n as AuthProvider,r as ConnectionUIStatus,t as EXTERNAL_AUTH_COMPLETION_STATUSES}from"./status-jFJKIUBU-BCgr1MV_.js";import{_ as createContextKey,a as metrics,c as SpanStatusCode,d as INVALID_SPAN_CONTEXT,f as INVALID_TRACEID,g as ROOT_CONTEXT,h as DiagConsoleLogger,i as propagation,l as SpanKind,m as ValueType,n as init_esm$2,o as diag,p as TraceFlags,r as trace,s as context$1,t as esm_exports$2,u as isSpanContextValid,v as DiagLogLevel}from"./esm-DcZNWkvb.js";import{createRequire}from"node:module";import*as fs$1 from"node:fs";import fs,{accessSync,chmodSync,constants,createReadStream,createWriteStream,existsSync,readFile,readFileSync,readdir,statSync}from"node:fs";import path,{basename,delimiter,dirname,isAbsolute,join,posix,resolve,sep}from"node:path";import{fileURLToPath}from"node:url";import{EventEmitter,setMaxListeners}from"events";import*as r from"fs";import{constants as constants$1,realpathSync}from"fs";import*as path$3 from"path";import{basename as basename$1,dirname as dirname$1,isAbsolute as isAbsolute$1,join as join$1,relative,resolve as resolve$1,sep as sep$1}from"path";import{homedir,tmpdir,userInfo}from"os";import{createHash,randomUUID}from"crypto";import*as fs$2 from"node:fs/promises";import{appendFile,cp,mkdir,readFile as readFile$1,readdir as readdir$1,rm,stat,writeFile}from"node:fs/promises";import*as os$5 from"node:os";import os,{homedir as homedir$1,hostname}from"node:os";import{createHash as createHash$1,randomUUID as randomUUID$1}from"node:crypto";import{execFile,spawn}from"child_process";import{promisify}from"util";import*as moduleModule from"module";import{createRequire as createRequire$1}from"module";import{URL as URL$1,fileURLToPath as fileURLToPath$1}from"url";import{isMainThread,threadId}from"worker_threads";import*as diagnosticsChannel from"node:diagnostics_channel";import{subscribe,tracingChannel}from"node:diagnostics_channel";import{EventEmitter as EventEmitter$1,errorMonitor}from"node:events";import*as http from"node:http";import*as https from"node:https";import*as diagch from"diagnostics_channel";import{cwd}from"process";import{AsyncLocalStorage}from"node:async_hooks";import{execFile as execFile$1,execFileSync,spawn as spawn$1}from"node:child_process";import*as util from"node:util";import{promisify as promisify$1}from"node:util";import readline,{createInterface}from"node:readline";import{Worker}from"node:worker_threads";import{PassThrough,Readable,Stream}from"node:stream";import{createGzip}from"node:zlib";import*as net from"node:net";import*as tls from"node:tls";import{Buffer as Buffer$1}from"node:buffer";import process$1,{cwd as cwd$1,env,stderr,stdout}from"node:process";import{appendFile as appendFile$1,copyFile,mkdir as mkdir$1,open,readFile as readFile$2,readdir as readdir$2,realpath,rename,rm as rm$1,rmdir,stat as stat$1,symlink,unlink,writeFile as writeFile$1}from"fs/promises";import{createInterface as createInterface$1}from"readline";import{pipeline}from"node:stream/promises";import tty from"node:tty";import*as zlib from"zlib";import{Readable as Readable$1}from"stream";var __commonJSMin=(n,c)=>()=>(c||(n((c={exports:{}}).exports,c),n=null),c.exports),require_utf8$1=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.utf8Count=c,n.utf8EncodeJs=u,n.utf8EncodeTE=x,n.utf8Encode=w,n.utf8DecodeJs=O,n.utf8DecodeTD=N,n.utf8Decode=I;function c(n){let c=n.length,u=0,p=0;for(;p<c;){let h=n.charCodeAt(p++);if(!(h&4294967168)){u++;continue}else if(!(h&4294965248))u+=2;else{if(h>=55296&&h<=56319&&p<c){let c=n.charCodeAt(p);(c&64512)==56320&&(++p,h=((h&1023)<<10)+(c&1023)+65536)}h&4294901760?u+=4:u+=3}}return u}function u(n,c,u){let p=n.length,h=u,x=0;for(;x<p;){let u=n.charCodeAt(x++);if(!(u&4294967168)){c[h++]=u;continue}else if(!(u&4294965248))c[h++]=u>>6&31|192;else{if(u>=55296&&u<=56319&&x<p){let c=n.charCodeAt(x);(c&64512)==56320&&(++x,u=((u&1023)<<10)+(c&1023)+65536)}u&4294901760?(c[h++]=u>>18&7|240,c[h++]=u>>12&63|128,c[h++]=u>>6&63|128):(c[h++]=u>>12&15|224,c[h++]=u>>6&63|128)}c[h++]=u&63|128}}let p=new TextEncoder,h=50;function x(n,c,u){p.encodeInto(n,c.subarray(u))}function w(n,c,p){n.length>50?x(n,c,p):u(n,c,p)}let T=4096;function O(n,c,u){let p=c,h=p+u,x=[],w=``;for(;p<h;){let c=n[p++];if(!(c&128))x.push(c);else if((c&224)==192){let u=n[p++]&63;x.push((c&31)<<6|u)}else if((c&240)==224){let u=n[p++]&63,h=n[p++]&63;x.push((c&31)<<12|u<<6|h)}else if((c&248)==240){let u=n[p++]&63,h=n[p++]&63,w=n[p++]&63,T=(c&7)<<18|u<<12|h<<6|w;T>65535&&(T-=65536,x.push(T>>>10&1023|55296),T=56320|T&1023),x.push(T)}else x.push(c);x.length>=4096&&(w+=String.fromCharCode(...x),x.length=0)}return x.length>0&&(w+=String.fromCharCode(...x)),w}let A=new TextDecoder,j=200;function N(n,c,u){let p=n.subarray(c,c+u);return A.decode(p)}function I(n,c,u){return u>200?N(n,c,u):O(n,c,u)}})),require_ExtData=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExtData=void 0,n.ExtData=class{type;data;constructor(n,c){this.type=n,this.data=c}}})),require_DecodeError=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DecodeError=void 0,n.DecodeError=class n extends Error{constructor(c){super(c);let u=Object.create(n.prototype);Object.setPrototypeOf(this,u),Object.defineProperty(this,`name`,{configurable:!0,enumerable:!1,value:n.name})}}})),require_int=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.UINT32_MAX=void 0,n.setUint64=c,n.setInt64=u,n.getInt64=p,n.getUint64=h,n.UINT32_MAX=4294967295;function c(n,c,u){let p=u/4294967296,h=u;n.setUint32(c,p),n.setUint32(c+4,h)}function u(n,c,u){let p=Math.floor(u/4294967296),h=u;n.setUint32(c,p),n.setUint32(c+4,h)}function p(n,c){let u=n.getInt32(c),p=n.getUint32(c+4);return u*4294967296+p}function h(n,c){let u=n.getUint32(c),p=n.getUint32(c+4);return u*4294967296+p}})),require_timestamp=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.timestampExtension=n.EXT_TIMESTAMP=void 0,n.encodeTimeSpecToTimestamp=x,n.encodeDateToTimeSpec=w,n.encodeTimestampExtension=T,n.decodeTimestampToTimeSpec=O,n.decodeTimestampExtension=A;let c=require_DecodeError(),u=require_int();n.EXT_TIMESTAMP=-1;let p=4294967295,h=17179869183;function x({sec:n,nsec:c}){if(n>=0&&c>=0&&n<=17179869183)if(c===0&&n<=4294967295){let c=new Uint8Array(4);return new DataView(c.buffer).setUint32(0,n),c}else{let u=n/4294967296,p=n&4294967295,h=new Uint8Array(8),x=new DataView(h.buffer);return x.setUint32(0,c<<2|u&3),x.setUint32(4,p),h}else{let p=new Uint8Array(12),h=new DataView(p.buffer);return h.setUint32(0,c),(0,u.setInt64)(h,4,n),p}}function w(n){let c=n.getTime(),u=Math.floor(c/1e3),p=(c-u*1e3)*1e6,h=Math.floor(p/1e9);return{sec:u+h,nsec:p-h*1e9}}function T(n){return n instanceof Date?x(w(n)):null}function O(n){let p=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:p.getUint32(0),nsec:0};case 8:{let n=p.getUint32(0),c=p.getUint32(4);return{sec:(n&3)*4294967296+c,nsec:n>>>2}}case 12:return{sec:(0,u.getInt64)(p,4),nsec:p.getUint32(0)};default:throw new c.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${n.length}`)}}function A(n){let c=O(n);return new Date(c.sec*1e3+c.nsec/1e6)}n.timestampExtension={type:n.EXT_TIMESTAMP,encode:T,decode:A}})),require_ExtensionCodec=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExtensionCodec=void 0;let c=require_ExtData(),u=require_timestamp();n.ExtensionCodec=class n{static defaultCodec=new n;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(u.timestampExtension)}register({type:n,encode:c,decode:u}){if(n>=0)this.encoders[n]=c,this.decoders[n]=u;else{let p=-1-n;this.builtInEncoders[p]=c,this.builtInDecoders[p]=u}}tryToEncode(n,u){for(let p=0;p<this.builtInEncoders.length;p++){let h=this.builtInEncoders[p];if(h!=null){let x=h(n,u);if(x!=null){let n=-1-p;return new c.ExtData(n,x)}}}for(let p=0;p<this.encoders.length;p++){let h=this.encoders[p];if(h!=null){let x=h(n,u);if(x!=null){let n=p;return new c.ExtData(n,x)}}}return n instanceof c.ExtData?n:null}decode(n,u,p){let h=u<0?this.builtInDecoders[-1-u]:this.decoders[u];return h?h(n,u,p):new c.ExtData(u,n)}}})),require_typedArrays=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ensureUint8Array=u;function c(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&n instanceof SharedArrayBuffer}function u(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):c(n)?new Uint8Array(n):Uint8Array.from(n)}})),require_Encoder=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Encoder=n.DEFAULT_INITIAL_BUFFER_SIZE=n.DEFAULT_MAX_DEPTH=void 0;let c=require_utf8$1(),u=require_ExtensionCodec(),p=require_int(),h=require_typedArrays();n.DEFAULT_MAX_DEPTH=100,n.DEFAULT_INITIAL_BUFFER_SIZE=2048,n.Encoder=class x{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(c){this.extensionCodec=c?.extensionCodec??u.ExtensionCodec.defaultCodec,this.context=c?.context,this.useBigInt64=c?.useBigInt64??!1,this.maxDepth=c?.maxDepth??n.DEFAULT_MAX_DEPTH,this.initialBufferSize=c?.initialBufferSize??n.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=c?.sortKeys??!1,this.forceFloat32=c?.forceFloat32??!1,this.ignoreUndefined=c?.ignoreUndefined??!1,this.forceIntegerToFloat=c?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new x({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(n){if(this.entered)return this.clone().encodeSharedRef(n);try{return this.entered=!0,this.reinitializeState(),this.doEncode(n,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(n){if(this.entered)return this.clone().encode(n);try{return this.entered=!0,this.reinitializeState(),this.doEncode(n,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(n,c){if(c>this.maxDepth)throw Error(`Too deep objects in depth ${c}`);n==null?this.encodeNil():typeof n==`boolean`?this.encodeBoolean(n):typeof n==`number`?this.forceIntegerToFloat?this.encodeNumberAsFloat(n):this.encodeNumber(n):typeof n==`string`?this.encodeString(n):this.useBigInt64&&typeof n==`bigint`?this.encodeBigInt64(n):this.encodeObject(n,c)}ensureBufferSizeToWrite(n){let c=this.pos+n;this.view.byteLength<c&&this.resizeBuffer(c*2)}resizeBuffer(n){let c=new ArrayBuffer(n),u=new Uint8Array(c),p=new DataView(c);u.set(this.bytes),this.view=p,this.bytes=u}encodeNil(){this.writeU8(192)}encodeBoolean(n){n===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(n){!this.forceIntegerToFloat&&Number.isSafeInteger(n)?n>=0?n<128?this.writeU8(n):n<256?(this.writeU8(204),this.writeU8(n)):n<65536?(this.writeU8(205),this.writeU16(n)):n<4294967296?(this.writeU8(206),this.writeU32(n)):this.useBigInt64?this.encodeNumberAsFloat(n):(this.writeU8(207),this.writeU64(n)):n>=-32?this.writeU8(224|n+32):n>=-128?(this.writeU8(208),this.writeI8(n)):n>=-32768?(this.writeU8(209),this.writeI16(n)):n>=-2147483648?(this.writeU8(210),this.writeI32(n)):this.useBigInt64?this.encodeNumberAsFloat(n):(this.writeU8(211),this.writeI64(n)):this.encodeNumberAsFloat(n)}encodeNumberAsFloat(n){this.forceFloat32?(this.writeU8(202),this.writeF32(n)):(this.writeU8(203),this.writeF64(n))}encodeBigInt64(n){n>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(n)):(this.writeU8(211),this.writeBigInt64(n))}writeStringHeader(n){if(n<32)this.writeU8(160+n);else if(n<256)this.writeU8(217),this.writeU8(n);else if(n<65536)this.writeU8(218),this.writeU16(n);else if(n<4294967296)this.writeU8(219),this.writeU32(n);else throw Error(`Too long string: ${n} bytes in UTF-8`)}encodeString(n){let u=5,p=(0,c.utf8Count)(n);this.ensureBufferSizeToWrite(5+p),this.writeStringHeader(p),(0,c.utf8Encode)(n,this.bytes,this.pos),this.pos+=p}encodeObject(n,c){let u=this.extensionCodec.tryToEncode(n,this.context);if(u!=null)this.encodeExtension(u);else if(Array.isArray(n))this.encodeArray(n,c);else if(ArrayBuffer.isView(n))this.encodeBinary(n);else if(typeof n==`object`)this.encodeMap(n,c);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(n)}`)}encodeBinary(n){let c=n.byteLength;if(c<256)this.writeU8(196),this.writeU8(c);else if(c<65536)this.writeU8(197),this.writeU16(c);else if(c<4294967296)this.writeU8(198),this.writeU32(c);else throw Error(`Too large binary: ${c}`);let u=(0,h.ensureUint8Array)(n);this.writeU8a(u)}encodeArray(n,c){let u=n.length;if(u<16)this.writeU8(144+u);else if(u<65536)this.writeU8(220),this.writeU16(u);else if(u<4294967296)this.writeU8(221),this.writeU32(u);else throw Error(`Too large array: ${u}`);for(let u of n)this.doEncode(u,c+1)}countWithoutUndefined(n,c){let u=0;for(let p of c)n[p]!==void 0&&u++;return u}encodeMap(n,c){let u=Object.keys(n);this.sortKeys&&u.sort();let p=this.ignoreUndefined?this.countWithoutUndefined(n,u):u.length;if(p<16)this.writeU8(128+p);else if(p<65536)this.writeU8(222),this.writeU16(p);else if(p<4294967296)this.writeU8(223),this.writeU32(p);else throw Error(`Too large map object: ${p}`);for(let p of u){let u=n[p];this.ignoreUndefined&&u===void 0||(this.encodeString(p),this.doEncode(u,c+1))}}encodeExtension(n){if(typeof n.data==`function`){let c=n.data(this.pos+6),u=c.length;if(u>=4294967296)throw Error(`Too large extension object: ${u}`);this.writeU8(201),this.writeU32(u),this.writeI8(n.type),this.writeU8a(c);return}let c=n.data.length;if(c===1)this.writeU8(212);else if(c===2)this.writeU8(213);else if(c===4)this.writeU8(214);else if(c===8)this.writeU8(215);else if(c===16)this.writeU8(216);else if(c<256)this.writeU8(199),this.writeU8(c);else if(c<65536)this.writeU8(200),this.writeU16(c);else if(c<4294967296)this.writeU8(201),this.writeU32(c);else throw Error(`Too large extension object: ${c}`);this.writeI8(n.type),this.writeU8a(n.data)}writeU8(n){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,n),this.pos++}writeU8a(n){let c=n.length;this.ensureBufferSizeToWrite(c),this.bytes.set(n,this.pos),this.pos+=c}writeI8(n){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,n),this.pos++}writeU16(n){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,n),this.pos+=2}writeI16(n){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,n),this.pos+=2}writeU32(n){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,n),this.pos+=4}writeI32(n){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,n),this.pos+=4}writeF32(n){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,n),this.pos+=4}writeF64(n){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,n),this.pos+=8}writeU64(n){this.ensureBufferSizeToWrite(8),(0,p.setUint64)(this.view,this.pos,n),this.pos+=8}writeI64(n){this.ensureBufferSizeToWrite(8),(0,p.setInt64)(this.view,this.pos,n),this.pos+=8}writeBigUint64(n){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,n),this.pos+=8}writeBigInt64(n){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,n),this.pos+=8}}})),require_encode=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.encode=u;let c=require_Encoder();function u(n,u){return new c.Encoder(u).encodeSharedRef(n)}})),require_prettyByte=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.prettyByte=c;function c(n){return`${n<0?`-`:``}0x${Math.abs(n).toString(16).padStart(2,`0`)}`}})),require_CachedKeyDecoder=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CachedKeyDecoder=void 0;let c=require_utf8$1(),u=16,p=16;n.CachedKeyDecoder=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(n=16,c=16){this.maxKeyLength=n,this.maxLengthPerKey=c,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(n){return n>0&&n<=this.maxKeyLength}find(n,c,u){let p=this.caches[u-1];FIND_CHUNK:for(let h of p){let p=h.bytes;for(let h=0;h<u;h++)if(p[h]!==n[c+h])continue FIND_CHUNK;return h.str}return null}store(n,c){let u=this.caches[n.length-1],p={bytes:n,str:c};u.length>=this.maxLengthPerKey?u[Math.random()*u.length|0]=p:u.push(p)}decode(n,u,p){let h=this.find(n,u,p);if(h!=null)return this.hit++,h;this.miss++;let x=(0,c.utf8DecodeJs)(n,u,p),w=Uint8Array.prototype.slice.call(n,u,u+p);return this.store(w,x),x}}})),require_Decoder=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Decoder=void 0;let c=require_prettyByte(),u=require_ExtensionCodec(),p=require_int(),h=require_utf8$1(),x=require_typedArrays(),w=require_CachedKeyDecoder(),T=require_DecodeError(),O=`array`,A=`map_key`,j=`map_value`,N=n=>{if(typeof n==`string`||typeof n==`number`)return n;throw new T.DecodeError(`The type of key must be string or number but `+typeof n)};var I=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(n){let c=this.getUninitializedStateFromPool();c.type=O,c.position=0,c.size=n,c.array=Array(n)}pushMapState(n){let c=this.getUninitializedStateFromPool();c.type=A,c.readCount=0,c.size=n,c.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(n){if(this.stack[this.stackHeadPosition]!==n)throw Error(`Invalid stack state. Released state is not on top of the stack.`);if(n.type===O){let c=n;c.size=0,c.array=void 0,c.position=0,c.type=void 0}if(n.type===A||n.type===j){let c=n;c.size=0,c.map=void 0,c.readCount=0,c.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}};let L=-1,z=new DataView(new ArrayBuffer(0)),B=new Uint8Array(z.buffer);try{z.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw Error(`This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access`)}let V=RangeError(`Insufficient data`),H=new w.CachedKeyDecoder;n.Decoder=class n{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=z;bytes=B;headByte=-1;stack=new I;entered=!1;constructor(n){this.extensionCodec=n?.extensionCodec??u.ExtensionCodec.defaultCodec,this.context=n?.context,this.useBigInt64=n?.useBigInt64??!1,this.rawStrings=n?.rawStrings??!1,this.maxStrLength=n?.maxStrLength??p.UINT32_MAX,this.maxBinLength=n?.maxBinLength??p.UINT32_MAX,this.maxArrayLength=n?.maxArrayLength??p.UINT32_MAX,this.maxMapLength=n?.maxMapLength??p.UINT32_MAX,this.maxExtLength=n?.maxExtLength??p.UINT32_MAX,this.keyDecoder=n?.keyDecoder===void 0?H:n.keyDecoder,this.mapKeyConverter=n?.mapKeyConverter??N}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.reset()}setBuffer(n){let c=(0,x.ensureUint8Array)(n);this.bytes=c,this.view=new DataView(c.buffer,c.byteOffset,c.byteLength),this.pos=0}appendBuffer(n){if(this.headByte===-1&&!this.hasRemaining(1))this.setBuffer(n);else{let c=this.bytes.subarray(this.pos),u=(0,x.ensureUint8Array)(n),p=new Uint8Array(c.length+u.length);p.set(c),p.set(u,c.length),this.setBuffer(p)}}hasRemaining(n){return this.view.byteLength-this.pos>=n}createExtraByteError(n){let{view:c,pos:u}=this;return RangeError(`Extra ${c.byteLength-u} of ${c.byteLength} byte(s) found at buffer[${n}]`)}decode(n){if(this.entered)return this.clone().decode(n);try{this.entered=!0,this.reinitializeState(),this.setBuffer(n);let c=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return c}finally{this.entered=!1}}*decodeMulti(n){if(this.entered){yield*this.clone().decodeMulti(n);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(n);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(n){if(this.entered)return this.clone().decodeAsync(n);try{this.entered=!0;let u=!1,p;for await(let c of n){if(u)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{p=this.doDecodeSync(),u=!0}catch(n){if(!(n instanceof RangeError))throw n}this.totalPos+=this.pos}if(u){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return p}let{headByte:h,pos:x,totalPos:w}=this;throw RangeError(`Insufficient data in parsing ${(0,c.prettyByte)(h)} at ${w} (${x} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(n){return this.decodeMultiAsync(n,!0)}decodeStream(n){return this.decodeMultiAsync(n,!1)}async*decodeMultiAsync(n,c){if(this.entered){yield*this.clone().decodeMultiAsync(n,c);return}try{this.entered=!0;let u=c,p=-1;for await(let h of n){if(c&&p===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(h),u&&(p=this.readArraySize(),u=!1,this.complete());try{for(;yield this.doDecodeSync(),--p!==0;);}catch(n){if(!(n instanceof RangeError))throw n}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){DECODE:for(;;){let n=this.readHeadByte(),u;if(n>=224)u=n-256;else if(n<192)if(n<128)u=n;else if(n<144){let c=n-128;if(c!==0){this.pushMapState(c),this.complete();continue DECODE}else u={}}else if(n<160){let c=n-144;if(c!==0){this.pushArrayState(c),this.complete();continue DECODE}else u=[]}else{let c=n-160;u=this.decodeString(c,0)}else if(n===192)u=null;else if(n===194)u=!1;else if(n===195)u=!0;else if(n===202)u=this.readF32();else if(n===203)u=this.readF64();else if(n===204)u=this.readU8();else if(n===205)u=this.readU16();else if(n===206)u=this.readU32();else if(n===207)u=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(n===208)u=this.readI8();else if(n===209)u=this.readI16();else if(n===210)u=this.readI32();else if(n===211)u=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(n===217){let n=this.lookU8();u=this.decodeString(n,1)}else if(n===218){let n=this.lookU16();u=this.decodeString(n,2)}else if(n===219){let n=this.lookU32();u=this.decodeString(n,4)}else if(n===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue DECODE}else u=[]}else if(n===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue DECODE}else u=[]}else if(n===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue DECODE}else u={}}else if(n===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue DECODE}else u={}}else if(n===196){let n=this.lookU8();u=this.decodeBinary(n,1)}else if(n===197){let n=this.lookU16();u=this.decodeBinary(n,2)}else if(n===198){let n=this.lookU32();u=this.decodeBinary(n,4)}else if(n===212)u=this.decodeExtension(1,0);else if(n===213)u=this.decodeExtension(2,0);else if(n===214)u=this.decodeExtension(4,0);else if(n===215)u=this.decodeExtension(8,0);else if(n===216)u=this.decodeExtension(16,0);else if(n===199){let n=this.lookU8();u=this.decodeExtension(n,1)}else if(n===200){let n=this.lookU16();u=this.decodeExtension(n,2)}else if(n===201){let n=this.lookU32();u=this.decodeExtension(n,4)}else throw new T.DecodeError(`Unrecognized type byte: ${(0,c.prettyByte)(n)}`);this.complete();let p=this.stack;for(;p.length>0;){let n=p.top();if(n.type===O)if(n.array[n.position]=u,n.position++,n.position===n.size)u=n.array,p.release(n);else continue DECODE;else if(n.type===A){if(u===`__proto__`)throw new T.DecodeError(`The key __proto__ is not allowed`);n.key=this.mapKeyConverter(u),n.type=j;continue DECODE}else if(n.map[n.key]=u,n.readCount++,n.readCount===n.size)u=n.map,p.release(n);else{n.key=null,n.type=A;continue DECODE}}return u}}readHeadByte(){return this.headByte===-1&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){let n=this.readHeadByte();switch(n){case 220:return this.readU16();case 221:return this.readU32();default:if(n<160)return n-144;throw new T.DecodeError(`Unrecognized array type byte: ${(0,c.prettyByte)(n)}`)}}pushMapState(n){if(n>this.maxMapLength)throw new T.DecodeError(`Max length exceeded: map length (${n}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(n)}pushArrayState(n){if(n>this.maxArrayLength)throw new T.DecodeError(`Max length exceeded: array length (${n}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(n)}decodeString(n,c){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(n,c):this.decodeBinary(n,c)}decodeUtf8String(n,c){if(n>this.maxStrLength)throw new T.DecodeError(`Max length exceeded: UTF-8 byte length (${n}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+c+n)throw V;let u=this.pos+c,p;return p=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(n)?this.keyDecoder.decode(this.bytes,u,n):(0,h.utf8Decode)(this.bytes,u,n),this.pos+=c+n,p}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===A:!1}decodeBinary(n,c){if(n>this.maxBinLength)throw new T.DecodeError(`Max length exceeded: bin length (${n}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(n+c))throw V;let u=this.pos+c,p=this.bytes.subarray(u,u+n);return this.pos+=c+n,p}decodeExtension(n,c){if(n>this.maxExtLength)throw new T.DecodeError(`Max length exceeded: ext length (${n}) > maxExtLength (${this.maxExtLength})`);let u=this.view.getInt8(this.pos+c),p=this.decodeBinary(n,c+1);return this.extensionCodec.decode(p,u,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let n=this.view.getUint8(this.pos);return this.pos++,n}readI8(){let n=this.view.getInt8(this.pos);return this.pos++,n}readU16(){let n=this.view.getUint16(this.pos);return this.pos+=2,n}readI16(){let n=this.view.getInt16(this.pos);return this.pos+=2,n}readU32(){let n=this.view.getUint32(this.pos);return this.pos+=4,n}readI32(){let n=this.view.getInt32(this.pos);return this.pos+=4,n}readU64(){let n=(0,p.getUint64)(this.view,this.pos);return this.pos+=8,n}readI64(){let n=(0,p.getInt64)(this.view,this.pos);return this.pos+=8,n}readU64AsBigInt(){let n=this.view.getBigUint64(this.pos);return this.pos+=8,n}readI64AsBigInt(){let n=this.view.getBigInt64(this.pos);return this.pos+=8,n}readF32(){let n=this.view.getFloat32(this.pos);return this.pos+=4,n}readF64(){let n=this.view.getFloat64(this.pos);return this.pos+=8,n}}})),require_decode=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.decode=u,n.decodeMulti=p;let c=require_Decoder();function u(n,u){return new c.Decoder(u).decode(n)}function p(n,u){return new c.Decoder(u).decodeMulti(n)}})),require_stream=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAsyncIterable=c,n.asyncIterableFromStream=u,n.ensureAsyncIterable=p;function c(n){return n[Symbol.asyncIterator]!=null}async function*u(n){let c=n.getReader();try{for(;;){let{done:n,value:u}=await c.read();if(n)return;yield u}}finally{c.releaseLock()}}function p(n){return c(n)?n:u(n)}})),require_decodeAsync=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.decodeAsync=p,n.decodeArrayStream=h,n.decodeMultiStream=x;let c=require_Decoder(),u=require_stream();async function p(n,p){let h=(0,u.ensureAsyncIterable)(n);return new c.Decoder(p).decodeAsync(h)}function h(n,p){let h=(0,u.ensureAsyncIterable)(n);return new c.Decoder(p).decodeArrayStream(h)}function x(n,p){let h=(0,u.ensureAsyncIterable)(n);return new c.Decoder(p).decodeStream(h)}})),import_dist_cjs=__commonJSMin((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.decodeTimestampExtension=n.encodeTimestampExtension=n.decodeTimestampToTimeSpec=n.encodeTimeSpecToTimestamp=n.encodeDateToTimeSpec=n.EXT_TIMESTAMP=n.ExtData=n.ExtensionCodec=n.Encoder=n.DecodeError=n.Decoder=n.decodeMultiStream=n.decodeArrayStream=n.decodeAsync=n.decodeMulti=n.decode=n.encode=void 0;let c=require_encode();Object.defineProperty(n,`encode`,{enumerable:!0,get:function(){return c.encode}});let u=require_decode();Object.defineProperty(n,`decode`,{enumerable:!0,get:function(){return u.decode}}),Object.defineProperty(n,`decodeMulti`,{enumerable:!0,get:function(){return u.decodeMulti}});let p=require_decodeAsync();Object.defineProperty(n,`decodeAsync`,{enumerable:!0,get:function(){return p.decodeAsync}}),Object.defineProperty(n,`decodeArrayStream`,{enumerable:!0,get:function(){return p.decodeArrayStream}}),Object.defineProperty(n,`decodeMultiStream`,{enumerable:!0,get:function(){return p.decodeMultiStream}});let h=require_Decoder();Object.defineProperty(n,`Decoder`,{enumerable:!0,get:function(){return h.Decoder}});let x=require_DecodeError();Object.defineProperty(n,`DecodeError`,{enumerable:!0,get:function(){return x.DecodeError}});let w=require_Encoder();Object.defineProperty(n,`Encoder`,{enumerable:!0,get:function(){return w.Encoder}});let T=require_ExtensionCodec();Object.defineProperty(n,`ExtensionCodec`,{enumerable:!0,get:function(){return T.ExtensionCodec}});let O=require_ExtData();Object.defineProperty(n,`ExtData`,{enumerable:!0,get:function(){return O.ExtData}});let A=require_timestamp();Object.defineProperty(n,`EXT_TIMESTAMP`,{enumerable:!0,get:function(){return A.EXT_TIMESTAMP}}),Object.defineProperty(n,`encodeDateToTimeSpec`,{enumerable:!0,get:function(){return A.encodeDateToTimeSpec}}),Object.defineProperty(n,`encodeTimeSpecToTimestamp`,{enumerable:!0,get:function(){return A.encodeTimeSpecToTimestamp}}),Object.defineProperty(n,`decodeTimestampToTimeSpec`,{enumerable:!0,get:function(){return A.decodeTimestampToTimeSpec}}),Object.defineProperty(n,`encodeTimestampExtension`,{enumerable:!0,get:function(){return A.encodeTimestampExtension}}),Object.defineProperty(n,`decodeTimestampExtension`,{enumerable:!0,get:function(){return A.decodeTimestampExtension}})}))();const encoder=new import_dist_cjs.Encoder({useBigInt64:!0}),decoder=new import_dist_cjs.Decoder({useBigInt64:!0}),messagePackCodec={encode(n){return encoder.encode(n)},decode(n){return decoder.decode(n)}};function encodeMessagePack(n){return messagePackCodec.encode(n)}function decodeMessagePack(n){return messagePackCodec.decode(n)}function encodeEnvelope(n){return encodeMessagePack(n)}function decodeEnvelope(n){return decodeMessagePack(n)}const isFunction$1=n=>typeof n==`function`,dual=function(n,c){if(typeof n==`function`)return function(){return n(arguments)?c.apply(this,arguments):n=>c(n,...arguments)};switch(n){case 0:case 1:throw RangeError(`Invalid arity ${n}`);case 2:return function(n,u){return arguments.length>=2?c(n,u):function(u){return c(u,n)}};case 3:return function(n,u,p){return arguments.length>=3?c(n,u,p):function(p){return c(p,n,u)}};case 4:return function(n,u,p,h){return arguments.length>=4?c(n,u,p,h):function(h){return c(h,n,u,p)}};case 5:return function(n,u,p,h,x){return arguments.length>=5?c(n,u,p,h,x):function(x){return c(x,n,u,p,h)}};default:return function(){if(arguments.length>=n)return c.apply(this,arguments);let u=arguments;return function(n){return c(n,...u)}}}},identity$1=n=>n,constant=n=>()=>n,constTrue=constant(!0),constFalse=constant(!1),constUndefined=constant(void 0),constVoid=constUndefined;function pipe(n,c,u,p,h,x,w,T,O){switch(arguments.length){case 1:return n;case 2:return c(n);case 3:return u(c(n));case 4:return p(u(c(n)));case 5:return h(p(u(c(n))));case 6:return x(h(p(u(c(n)))));case 7:return w(x(h(p(u(c(n))))));case 8:return T(w(x(h(p(u(c(n)))))));case 9:return O(T(w(x(h(p(u(c(n))))))));default:{let n=arguments[0];for(let c=1;c<arguments.length;c++)n=arguments[c](n);return n}}}const make$26=n=>(c,u)=>c===u||n(c,u),mapInput$1=dual(2,(n,c)=>make$26((u,p)=>n(c(u),c(p)))),array$1=n=>make$26((c,u)=>{if(c.length!==u.length)return!1;for(let p=0;p<c.length;p++)if(!n(c[p],u[p]))return!1;return!0}),globalStoreId=`effect/GlobalValue`;let globalStore;const globalValue=(n,c)=>(globalStore||=(globalThis[globalStoreId]??=new Map,globalThis[globalStoreId]),globalStore.has(n)||globalStore.set(n,c()),globalStore.get(n)),isString$2=n=>typeof n==`string`,isNumber=n=>typeof n==`number`,isBigInt=n=>typeof n==`bigint`,isFunction=isFunction$1,isRecordOrArray=n=>typeof n==`object`&&!!n,isObject=n=>isRecordOrArray(n)||isFunction(n),hasProperty=dual(2,(n,c)=>isObject(n)&&c in n),isTagged=dual(2,(n,c)=>hasProperty(n,`_tag`)&&n._tag===c),isNullable=n=>n==null,isIterable=n=>typeof n==`string`||hasProperty(n,Symbol.iterator),isPromiseLike$1=n=>hasProperty(n,`then`)&&isFunction(n.then),getBugErrorMessage=n=>`BUG: ${n} - please report an issue at https://github.com/Effect-TS/effect/issues`;var SingleShotGen$1=class n{self;called=!1;constructor(n){this.self=n}next(n){return this.called?{value:n,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(n){return{value:n,done:!0}}throw(n){throw n}[Symbol.iterator](){return new n(this.self)}};const defaultIncHi=335903614,defaultIncLo=4150755663,MUL_HI=1481765933,MUL_LO=1284865837,BIT_53=9007199254740992,BIT_27=134217728;var PCGRandom=class{_state;constructor(n,c,u,p){return isNullable(c)&&isNullable(n)?(c=Math.random()*4294967295>>>0,n=0):isNullable(c)&&(c=n,n=0),isNullable(p)&&isNullable(u)?(p=this._state?this._state[3]:defaultIncLo,u=this._state?this._state[2]:defaultIncHi):isNullable(p)&&(p=u,u=0),this._state=new Int32Array([0,0,u>>>0,((p||0)|1)>>>0]),this._next(),add64(this._state,this._state[0],this._state[1],n>>>0,c>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(n){this._state[0]=n[0],this._state[1]=n[1],this._state[2]=n[2],this._state[3]=n[3]|1}integer(n){return Math.round(this.number()*(2**53-1))%n}number(){let n=(this._next()&67108863)*1,c=(this._next()&134217727)*1;return(n*BIT_27+c)/BIT_53}_next(){let n=this._state[0]>>>0,c=this._state[1]>>>0;mul64(this._state,n,c,MUL_HI,MUL_LO),add64(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let u=n>>>18,p=(c>>>18|n<<14)>>>0;u=(u^n)>>>0,p=(p^c)>>>0;let h=(p>>>27|u<<5)>>>0,x=n>>>27,w=(-x>>>0&31)>>>0;return(h>>>x|h<<w)>>>0}};function mul64(n,c,u,p,h){let x=(u>>>16)*(h&65535)>>>0,w=(u&65535)*(h>>>16)>>>0,T=(u&65535)*(h&65535)>>>0,O=(u>>>16)*(h>>>16)+((w>>>16)+(x>>>16))>>>0;w=w<<16>>>0,T=T+w>>>0,T>>>0<w>>>0&&(O=O+1>>>0),x=x<<16>>>0,T=T+x>>>0,T>>>0<x>>>0&&(O=O+1>>>0),O=O+Math.imul(u,p)>>>0,O=O+Math.imul(c,h)>>>0,n[0]=O,n[1]=T}function add64(n,c,u,p,h){let x=c+p>>>0,w=u+h>>>0;w>>>0<u>>>0&&(x=x+1|0),n[0]=x,n[1]=w}const YieldWrapTypeId=Symbol.for(`effect/Utils/YieldWrap`);var YieldWrap=class{#e;constructor(n){this.#e=n}[YieldWrapTypeId](){return this.#e}};function yieldWrapGet(n){if(typeof n==`object`&&n&&YieldWrapTypeId in n)return n[YieldWrapTypeId]();throw Error(getBugErrorMessage(`yieldWrapGet`))}const structuralRegionState=globalValue(`effect/Utils/isStructuralRegion`,()=>({enabled:!1,tester:void 0})),standard={effect_internal_function:n=>n()},forced={effect_internal_function:n=>{try{return n()}finally{}}},isNotOptimizedAway=standard.effect_internal_function(()=>Error().stack)?.includes(`effect_internal_function`)===!0,internalCall=isNotOptimizedAway?standard.effect_internal_function:forced.effect_internal_function,genConstructor=function*(){}.constructor,randomHashCache=globalValue(Symbol.for(`effect/Hash/randomHashCache`),()=>new WeakMap),symbol$1=Symbol.for(`effect/Hash`),hash=n=>{if(structuralRegionState.enabled===!0)return 0;switch(typeof n){case`number`:return number$1(n);case`bigint`:return string(n.toString(10));case`boolean`:return string(String(n));case`symbol`:return string(String(n));case`string`:return string(n);case`undefined`:return string(`undefined`);case`function`:case`object`:return n===null?string(`null`):n instanceof Date?Number.isNaN(n.getTime())?string(`Invalid Date`):hash(n.toISOString()):n instanceof URL?hash(n.href):isHash(n)?n[symbol$1]():random(n);default:throw Error(`BUG: unhandled typeof ${typeof n} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},random=n=>(randomHashCache.has(n)||randomHashCache.set(n,number$1(Math.floor(Math.random()*(2**53-1)))),randomHashCache.get(n)),combine$5=n=>c=>c*53^n,optimize=n=>n&3221225471|n>>>1&1073741824,isHash=n=>hasProperty(n,symbol$1),number$1=n=>{if(n!==n||n===1/0)return 0;let c=n|0;for(c!==n&&(c^=n*4294967295);n>4294967295;)c^=n/=4294967295;return optimize(c)},string=n=>{let c=5381,u=n.length;for(;u;)c=c*33^n.charCodeAt(--u);return optimize(c)},structureKeys=(n,c)=>{let u=12289;for(let p=0;p<c.length;p++)u^=pipe(string(c[p]),combine$5(hash(n[c[p]])));return optimize(u)},structure=n=>structureKeys(n,Object.keys(n)),array=n=>{let c=6151;for(let u=0;u<n.length;u++)c=pipe(c,combine$5(hash(n[u])));return optimize(c)},cached=function(){if(arguments.length===1){let n=arguments[0];return function(c){return Object.defineProperty(n,symbol$1,{value(){return c},enumerable:!1}),c}}let n=arguments[0],c=arguments[1];return Object.defineProperty(n,symbol$1,{value(){return c},enumerable:!1}),c},symbol=Symbol.for(`effect/Equal`);function equals$1(){return arguments.length===1?n=>compareBoth(n,arguments[0]):compareBoth(arguments[0],arguments[1])}function compareBoth(n,c){if(n===c)return!0;let u=typeof n;if(u!==typeof c)return!1;if(u===`object`||u===`function`){if(n!==null&&c!==null){if(isEqual(n)&&isEqual(c))return hash(n)===hash(c)&&n[symbol](c)?!0:structuralRegionState.enabled&&structuralRegionState.tester?structuralRegionState.tester(n,c):!1;if(n instanceof Date&&c instanceof Date){let u=n.getTime(),p=c.getTime();return u===p||Number.isNaN(u)&&Number.isNaN(p)}else if(n instanceof URL&&c instanceof URL)return n.href===c.href}if(structuralRegionState.enabled){if(n===null||c===null)return!1;if(Array.isArray(n)&&Array.isArray(c))return n.length===c.length&&n.every((n,u)=>compareBoth(n,c[u]));if(Object.getPrototypeOf(n)===Object.prototype&&Object.getPrototypeOf(c)===Object.prototype){let u=Object.keys(n),p=Object.keys(c);if(u.length===p.length){for(let p of u)if(!(p in c&&compareBoth(n[p],c[p])))return structuralRegionState.tester?structuralRegionState.tester(n,c):!1;return!0}}return structuralRegionState.tester?structuralRegionState.tester(n,c):!1}}return structuralRegionState.enabled&&structuralRegionState.tester?structuralRegionState.tester(n,c):!1}const isEqual=n=>hasProperty(n,symbol),equivalence=()=>equals$1,NodeInspectSymbol=Symbol.for(`nodejs.util.inspect.custom`),toJSON=n=>{try{if(hasProperty(n,`toJSON`)&&isFunction(n.toJSON)&&n.toJSON.length===0)return n.toJSON();if(Array.isArray(n))return n.map(toJSON)}catch{return{}}return redact(n)},format$2=n=>JSON.stringify(n,null,2),toStringUnknown=(n,c=2)=>{if(typeof n==`string`)return n;try{return typeof n==`object`?stringifyCircular(n,c):String(n)}catch{return String(n)}},stringifyCircular=(n,c)=>{let u=[],p=JSON.stringify(n,(n,c)=>typeof c==`object`&&c?u.includes(c)?void 0:u.push(c)&&(redactableState.fiberRefs!==void 0&&isRedactable(c)?c[symbolRedactable](redactableState.fiberRefs):c):c,c);return u=void 0,p},symbolRedactable=Symbol.for(`effect/Inspectable/Redactable`),isRedactable=n=>typeof n==`object`&&!!n&&symbolRedactable in n,redactableState=globalValue(`effect/Inspectable/redactableState`,()=>({fiberRefs:void 0})),withRedactableContext=(n,c)=>{let u=redactableState.fiberRefs;redactableState.fiberRefs=n;try{return c()}finally{redactableState.fiberRefs=u}},redact=n=>isRedactable(n)&&redactableState.fiberRefs!==void 0?n[symbolRedactable](redactableState.fiberRefs):n,pipeArguments=(n,c)=>{switch(c.length){case 0:return n;case 1:return c[0](n);case 2:return c[1](c[0](n));case 3:return c[2](c[1](c[0](n)));case 4:return c[3](c[2](c[1](c[0](n))));case 5:return c[4](c[3](c[2](c[1](c[0](n)))));case 6:return c[5](c[4](c[3](c[2](c[1](c[0](n))))));case 7:return c[6](c[5](c[4](c[3](c[2](c[1](c[0](n)))))));case 8:return c[7](c[6](c[5](c[4](c[3](c[2](c[1](c[0](n))))))));case 9:return c[8](c[7](c[6](c[5](c[4](c[3](c[2](c[1](c[0](n)))))))));default:{let u=n;for(let n=0,p=c.length;n<p;n++)u=c[n](u);return u}}},OP_ASYNC=`Async`,OP_COMMIT=`Commit`,OP_FAILURE=`Failure`,OP_ON_FAILURE=`OnFailure`,OP_ON_SUCCESS=`OnSuccess`,OP_ON_SUCCESS_AND_FAILURE=`OnSuccessAndFailure`,OP_SUCCESS=`Success`,OP_SYNC=`Sync`,OP_TAG=`Tag`,OP_UPDATE_RUNTIME_FLAGS=`UpdateRuntimeFlags`,OP_WHILE=`While`,OP_ITERATOR=`Iterator`,OP_WITH_RUNTIME=`WithRuntime`,OP_YIELD=`Yield`,OP_REVERT_FLAGS=`RevertFlags`;let moduleVersion=`3.21.2`;const getCurrentVersion=()=>moduleVersion,EffectTypeId$1=Symbol.for(`effect/Effect`),StreamTypeId=Symbol.for(`effect/Stream`),SinkTypeId=Symbol.for(`effect/Sink`),ChannelTypeId=Symbol.for(`effect/Channel`),effectVariance={_R:n=>n,_E:n=>n,_A:n=>n,_V:getCurrentVersion()},sinkVariance={_A:n=>n,_In:n=>n,_L:n=>n,_E:n=>n,_R:n=>n},channelVariance={_Env:n=>n,_InErr:n=>n,_InElem:n=>n,_InDone:n=>n,_OutErr:n=>n,_OutElem:n=>n,_OutDone:n=>n},EffectPrototype$1={[EffectTypeId$1]:effectVariance,[StreamTypeId]:effectVariance,[SinkTypeId]:sinkVariance,[ChannelTypeId]:channelVariance,[symbol](n){return this===n},[symbol$1](){return cached(this,random(this))},[Symbol.iterator](){return new SingleShotGen$1(new YieldWrap(this))},pipe(){return pipeArguments(this,arguments)}},StructuralPrototype={[symbol$1](){return cached(this,structure(this))},[symbol](n){let c=Object.keys(this),u=Object.keys(n);if(c.length!==u.length)return!1;for(let u of c)if(!(u in n&&equals$1(this[u],n[u])))return!1;return!0}},CommitPrototype={...EffectPrototype$1,_op:OP_COMMIT},StructuralCommitPrototype={...CommitPrototype,...StructuralPrototype},Base$1=function(){function n(){}return n.prototype=CommitPrototype,n}(),TypeId$11=Symbol.for(`effect/Option`),CommonProto$1={...EffectPrototype$1,[TypeId$11]:{_A:n=>n},[NodeInspectSymbol](){return this.toJSON()},toString(){return format$2(this.toJSON())}},SomeProto=Object.assign(Object.create(CommonProto$1),{_tag:`Some`,_op:`Some`,[symbol](n){return isOption(n)&&isSome$1(n)&&equals$1(this.value,n.value)},[symbol$1](){return cached(this,combine$5(hash(this._tag))(hash(this.value)))},toJSON(){return{_id:`Option`,_tag:this._tag,value:toJSON(this.value)}}}),NoneHash=hash(`None`),NoneProto=Object.assign(Object.create(CommonProto$1),{_tag:`None`,_op:`None`,[symbol](n){return isOption(n)&&isNone$1(n)},[symbol$1](){return NoneHash},toJSON(){return{_id:`Option`,_tag:this._tag}}}),isOption=n=>hasProperty(n,TypeId$11),isNone$1=n=>n._tag===`None`,isSome$1=n=>n._tag===`Some`,none$5=Object.create(NoneProto),some$1=n=>{let c=Object.create(SomeProto);return c.value=n,c},TypeId$10=Symbol.for(`effect/Either`),CommonProto={...EffectPrototype$1,[TypeId$10]:{_R:n=>n},[NodeInspectSymbol](){return this.toJSON()},toString(){return format$2(this.toJSON())}},RightProto=Object.assign(Object.create(CommonProto),{_tag:`Right`,_op:`Right`,[symbol](n){return isEither(n)&&isRight$1(n)&&equals$1(this.right,n.right)},[symbol$1](){return combine$5(hash(this._tag))(hash(this.right))},toJSON(){return{_id:`Either`,_tag:this._tag,right:toJSON(this.right)}}}),LeftProto=Object.assign(Object.create(CommonProto),{_tag:`Left`,_op:`Left`,[symbol](n){return isEither(n)&&isLeft$1(n)&&equals$1(this.left,n.left)},[symbol$1](){return combine$5(hash(this._tag))(hash(this.left))},toJSON(){return{_id:`Either`,_tag:this._tag,left:toJSON(this.left)}}}),isEither=n=>hasProperty(n,TypeId$10),isLeft$1=n=>n._tag===`Left`,isRight$1=n=>n._tag===`Right`,left$1=n=>{let c=Object.create(LeftProto);return c.left=n,c},right$1=n=>{let c=Object.create(RightProto);return c.right=n,c},right=right$1,left=left$1,isLeft=isLeft$1,isRight=isRight$1,match$4=dual(2,(n,{onLeft:c,onRight:u})=>isLeft(n)?c(n.left):u(n.right)),merge$4=match$4({onLeft:identity$1,onRight:identity$1}),isNonEmptyArray$1=n=>n.length>0,make$25=n=>(c,u)=>c===u?0:n(c,u),number=make$25((n,c)=>n<c?-1:1),mapInput=dual(2,(n,c)=>make$25((u,p)=>n(c(u),c(p)))),greaterThan$1=n=>dual(2,(c,u)=>n(c,u)===1),none$4=()=>none$5,some=some$1,isNone=isNone$1,isSome=isSome$1,match$3=dual(2,(n,{onNone:c,onSome:u})=>isNone(n)?c():u(n.value)),getOrElse=dual(2,(n,c)=>isNone(n)?c():n.value),orElseSome=dual(2,(n,c)=>isNone(n)?some(c()):n),fromNullable=n=>n==null?none$4():some(n),getOrUndefined=getOrElse(constUndefined),map$4=dual(2,(n,c)=>isNone(n)?none$4():some(c(n.value))),flatMap$4=dual(2,(n,c)=>isNone(n)?none$4():c(n.value)),containsWith=n=>dual(2,(c,u)=>isNone(c)?!1:n(c.value,u)),_equivalence$3=equivalence(),contains=containsWith(_equivalence$3),make$24=(...n)=>n,allocate=n=>Array(n),makeBy=dual(2,(n,c)=>{let u=Math.max(1,Math.floor(n)),p=Array(u);for(let n=0;n<u;n++)p[n]=c(n);return p}),fromIterable$6=n=>Array.isArray(n)?n:Array.from(n),ensure=n=>Array.isArray(n)?n:[n],prepend$2=dual(2,(n,c)=>[c,...n]),append$2=dual(2,(n,c)=>[...n,c]),appendAll$2=dual(2,(n,c)=>fromIterable$6(n).concat(fromIterable$6(c))),isArray=Array.isArray,isEmptyArray=n=>n.length===0,isEmptyReadonlyArray=isEmptyArray,isNonEmptyArray=isNonEmptyArray$1,isNonEmptyReadonlyArray=isNonEmptyArray$1,isOutOfBounds=(n,c)=>n<0||n>=c.length,clamp$1=(n,c)=>Math.floor(Math.min(Math.max(0,n),c.length)),get$9=dual(2,(n,c)=>{let u=Math.floor(c);return isOutOfBounds(u,n)?none$4():some(n[u])}),unsafeGet$3=dual(2,(n,c)=>{let u=Math.floor(c);if(isOutOfBounds(u,n))throw Error(`Index ${u} out of bounds`);return n[u]}),head$1=get$9(0),headNonEmpty$1=unsafeGet$3(0),last=n=>isNonEmptyReadonlyArray(n)?some(lastNonEmpty(n)):none$4(),lastNonEmpty=n=>n[n.length-1],tailNonEmpty$1=n=>n.slice(1),spanIndex=(n,c)=>{let u=0;for(let p of n){if(!c(p,u))break;u++}return u},span=dual(2,(n,c)=>splitAt(n,spanIndex(n,c))),drop$1=dual(2,(n,c)=>{let u=fromIterable$6(n);return u.slice(clamp$1(c,u),u.length)}),reverse$2=n=>Array.from(n).reverse(),sort=dual(2,(n,c)=>{let u=Array.from(n);return u.sort(c),u}),zip$1=dual(2,(n,c)=>zipWith(n,c,make$24)),zipWith=dual(3,(n,c,u)=>{let p=fromIterable$6(n),h=fromIterable$6(c);if(isNonEmptyReadonlyArray(p)&&isNonEmptyReadonlyArray(h)){let n=[u(headNonEmpty$1(p),headNonEmpty$1(h))],c=Math.min(p.length,h.length);for(let x=1;x<c;x++)n[x]=u(p[x],h[x]);return n}return[]}),_equivalence$2=equivalence(),splitAt=dual(2,(n,c)=>{let u=Array.from(n),p=Math.floor(c);return isNonEmptyReadonlyArray(u)?p>=1?splitNonEmptyAt(u,p):[[],u]:[u,[]]}),splitNonEmptyAt=dual(2,(n,c)=>{let u=Math.max(1,Math.floor(c));return u>=n.length?[copy$2(n),[]]:[prepend$2(n.slice(1,u),headNonEmpty$1(n)),n.slice(u)]}),copy$2=n=>n.slice(),unionWith=dual(3,(n,c,u)=>{let p=fromIterable$6(n),h=fromIterable$6(c);return isNonEmptyReadonlyArray(p)?isNonEmptyReadonlyArray(h)?dedupeWith(u)(appendAll$2(p,h)):p:h}),union$2=dual(2,(n,c)=>unionWith(n,c,_equivalence$2)),empty$20=()=>[],of$2=n=>[n],map$3=dual(2,(n,c)=>n.map(c)),flatMap$3=dual(2,(n,c)=>{if(isEmptyReadonlyArray(n))return[];let u=[];for(let p=0;p<n.length;p++){let h=c(n[p],p);for(let n=0;n<h.length;n++)u.push(h[n])}return u}),flatten$3=flatMap$3(identity$1),filter$1=dual(2,(n,c)=>{let u=fromIterable$6(n),p=[];for(let n=0;n<u.length;n++)c(u[n],n)&&p.push(u[n]);return p}),reduce$6=dual(3,(n,c,u)=>fromIterable$6(n).reduce((n,c,p)=>u(n,c,p),c)),unfold=(n,c)=>{let u=[],p=n,h;for(;isSome(h=c(p));){let[n,c]=h.value;u.push(n),p=c}return u},getEquivalence$2=array$1,dedupeWith=dual(2,(n,c)=>{let u=fromIterable$6(n);if(isNonEmptyReadonlyArray(u)){let n=[headNonEmpty$1(u)],p=tailNonEmpty$1(u);for(let u of p)n.every(n=>!c(u,n))&&n.push(u);return n}return[]}),dedupe=n=>dedupeWith(n,equivalence()),join$3=dual(2,(n,c)=>fromIterable$6(n).join(c)),Order$1=number,escape$4=n=>n.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),TagTypeId=Symbol.for(`effect/Context/Tag`),ReferenceTypeId=Symbol.for(`effect/Context/Reference`),STMSymbolKey=`effect/STM`,STMTypeId=Symbol.for(STMSymbolKey),TagProto={...EffectPrototype$1,_op:`Tag`,[STMTypeId]:effectVariance,[TagTypeId]:{_Service:n=>n,_Identifier:n=>n},toString(){return format$2(this.toJSON())},toJSON(){return{_id:`Tag`,key:this.key,stack:this.stack}},[NodeInspectSymbol](){return this.toJSON()},of(n){return n},context(n){return make$23(this,n)}},ReferenceProto={...TagProto,[ReferenceTypeId]:ReferenceTypeId},makeGenericTag=n=>{let c=Error.stackTraceLimit;Error.stackTraceLimit=2;let u=Error();Error.stackTraceLimit=c;let p=Object.create(TagProto);return Object.defineProperty(p,`stack`,{get(){return u.stack}}),p.key=n,p},Reference$1=()=>(n,c)=>{let u=Error.stackTraceLimit;Error.stackTraceLimit=2;let p=Error();Error.stackTraceLimit=u;function h(){}return Object.setPrototypeOf(h,ReferenceProto),h.key=n,h.defaultValue=c.defaultValue,Object.defineProperty(h,`stack`,{get(){return p.stack}}),h},TypeId$9=Symbol.for(`effect/Context`),ContextProto={[TypeId$9]:{_Services:n=>n},[symbol](n){if(isContext(n)&&this.unsafeMap.size===n.unsafeMap.size){for(let c of this.unsafeMap.keys())if(!n.unsafeMap.has(c)||!equals$1(this.unsafeMap.get(c),n.unsafeMap.get(c)))return!1;return!0}return!1},[symbol$1](){return cached(this,number$1(this.unsafeMap.size))},pipe(){return pipeArguments(this,arguments)},toString(){return format$2(this.toJSON())},toJSON(){return{_id:`Context`,services:Array.from(this.unsafeMap).map(toJSON)}},[NodeInspectSymbol](){return this.toJSON()}},makeContext=n=>{let c=Object.create(ContextProto);return c.unsafeMap=n,c},serviceNotFoundError=n=>{let c=Error(`Service not found${n.key?`: ${String(n.key)}`:``}`);if(n.stack){let u=n.stack.split(`
|
|
5
5
|
`);if(u.length>2){let n=u[2].match(/at (.*)/);n&&(c.message+=` (defined at ${n[1]})`)}}if(c.stack){let n=c.stack.split(`
|
|
6
6
|
`);n.splice(1,3),c.stack=n.join(`
|
|
@@ -74,7 +74,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
74
74
|
`);if(A===-1){debugLog$1(`have not received end of HTTP headers yet...`),x();return}let j=O.subarray(0,A).toString(`ascii`).split(`\r
|
|
75
75
|
`),N=j.shift();if(!N)return n.destroy(),u(Error(`No header received from proxy CONNECT response`));let I=N.split(` `),L=+(I[1]||0),z=I.slice(2).join(` `),B={};for(let c of j){if(!c)continue;let p=c.indexOf(`:`);if(p===-1)return n.destroy(),u(Error(`Invalid header from proxy CONNECT response: "${c}"`));let h=c.slice(0,p).toLowerCase(),x=c.slice(p+1).trimStart(),w=B[h];typeof w==`string`?B[h]=[w,x]:Array.isArray(w)?w.push(x):B[h]=x}debugLog$1(`got proxy server response: %o %o`,N,B),w(),c({connect:{statusCode:L,statusText:z,headers:B},buffered:O})}n.on(`error`,O),n.on(`end`,T),x()})}function debugLog(...n){debug.log(`[https-proxy-agent]`,...n)}var HttpsProxyAgent=class extends Agent{static __initStatic(){this.protocols=[`http`,`https`]}constructor(n,c){super(c),this.options={},this.proxy=typeof n==`string`?new URL(n):n,this.proxyHeaders=c?.headers??{},debugLog(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let u=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),p=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...c?omit(c,`headers`):null,host:u,port:p}}async connect(n,c){let{proxy:u}=this;if(!c.host)throw TypeError(`No "host" provided`);let p;if(u.protocol===`https:`){debugLog("Creating `tls.Socket`: %o",this.connectOpts);let n=this.connectOpts.servername||this.connectOpts.host;p=tls.connect({...this.connectOpts,servername:n&&net.isIP(n)?void 0:n})}else debugLog("Creating `net.Socket`: %o",this.connectOpts),p=net.connect(this.connectOpts);let h=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},x=net.isIPv6(c.host)?`[${c.host}]`:c.host,w=`CONNECT ${x}:${c.port} HTTP/1.1\r\n`;if(u.username||u.password){let n=`${decodeURIComponent(u.username)}:${decodeURIComponent(u.password)}`;h[`Proxy-Authorization`]=`Basic ${Buffer.from(n).toString(`base64`)}`}h.Host=`${x}:${c.port}`,h[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let n of Object.keys(h))w+=`${n}: ${h[n]}\r\n`;let T=parseProxyResponse(p);p.write(`${w}\r\n`);let{connect:O,buffered:A}=await T;if(n.emit(`proxyConnect`,O),this.emit(`proxyConnect`,O,n),O.statusCode===200){if(n.once(`socket`,resume),c.secureEndpoint){debugLog(`Upgrading socket connection to TLS`);let n=c.servername||c.host;return tls.connect({...omit(c,`host`,`path`,`port`),socket:p,servername:net.isIP(n)?void 0:n})}return p}p.destroy();let j=new net.Socket({writable:!1});return j.readable=!0,n.once(`socket`,n=>{debugLog(`Replaying proxy buffer for failed request`),n.push(A),n.push(null)}),j}};HttpsProxyAgent.__initStatic();function resume(n){n.resume()}function omit(n,...c){let u={},p;for(p in n)c.includes(p)||(u[p]=n[p]);return u}const GZIP_THRESHOLD=1024*32;function streamFromBody(n){return new Readable({read(){this.push(n),this.push(null)}})}function makeNodeTransport(n){let c;try{c=new URL(n.url)}catch{return consoleSandbox(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),createTransport(n,()=>Promise.resolve({}))}let u=c.protocol===`https:`,p=applyNoProxyOption(c,n.proxy||(u?process.env.https_proxy:void 0)||process.env.http_proxy),h=u?https:http,x=n.keepAlive===void 0?!1:n.keepAlive,w=p?new HttpsProxyAgent(p):new h.Agent({keepAlive:x,maxSockets:30,timeout:2e3});return createTransport(n,createRequestExecutor(n,n.httpModule??h,w))}function applyNoProxyOption(n,c){let{no_proxy:u}=process.env;if(!u?.split(`,`).some(c=>n.host.endsWith(c)||n.hostname.endsWith(c)))return c}function createRequestExecutor(n,c,u){let{hostname:p,pathname:h,port:x,protocol:w,search:T}=new URL(n.url);return function(O){return new Promise((A,j)=>{suppressTracing$2(()=>{let N=streamFromBody(O.body),I={...n.headers};O.body.length>GZIP_THRESHOLD&&(I[`content-encoding`]=`gzip`,N=N.pipe(createGzip()));let L=p.startsWith(`[`),z=c.request({method:`POST`,agent:u,headers:I,hostname:L?p.slice(1,-1):p,path:`${h}${T}`,port:x,protocol:w,ca:n.caCerts},n=>{n.on(`data`,()=>{}),n.on(`end`,()=>{}),n.setEncoding(`utf8`);let c=n.headers[`retry-after`]??null,u=n.headers[`x-sentry-rate-limits`]??null;A({statusCode:n.statusCode,headers:{"retry-after":c,"x-sentry-rate-limits":Array.isArray(u)?u[0]||null:u}})});z.on(`error`,j),N.pipe(z)})})}}function getSpotlightConfig(n){if(n===!1)return!1;if(typeof n==`string`)return n;let c=envToBool(process.env.SENTRY_SPOTLIGHT,{strict:!0}),u=c===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return n===!0?u??!0:c??u}function normalizeWindowsPath(n){return n.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function createGetModuleFromFilename(n=process.argv[1]?dirname$2(process.argv[1]):process.cwd(),c=sep===`\\`){let u=c?normalizeWindowsPath(n):n;return n=>{if(!n)return;let p=c?normalizeWindowsPath(n):n,{dir:h,base:x,ext:w}=posix.parse(p);(w===`.js`||w===`.mjs`||w===`.cjs`)&&(x=x.slice(0,w.length*-1));let T=decodeURIComponent(x);h||=`.`;let O=h.lastIndexOf(`/node_modules`);if(O>-1)return`${h.slice(O+14).replace(/\//g,`.`)}:${T}`;if(h.startsWith(u)){let n=h.slice(u.length+1).replace(/\//g,`.`);return n?`${n}:${T}`:T}return T}}function getSentryRelease(n){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(GLOBAL_OBJ.SENTRY_RELEASE?.id)return GLOBAL_OBJ.SENTRY_RELEASE.id;let c=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,u=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,p=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return c||u||p||n}const defaultStackParser=createStackParser(nodeStackLineParser(createGetModuleFromFilename()));init_esm$2();const DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS=6e4;var NodeClient=class extends ServerRuntimeClient{constructor(n){let c=n.includeServerName===!1?void 0:n.serverName||global.process.env.SENTRY_NAME||os$5.hostname(),u={...n,platform:`node`,runtime:n.runtime||{name:`node`,version:global.process.version},serverName:c};n.openTelemetryInstrumentations&&(0,import_src$35.registerInstrumentations)({instrumentations:n.openTelemetryInstrumentations}),applySdkMetadata(u,`node`),debug.log(`Initializing Sentry: process: ${process.pid}, thread: ${isMainThread?`main`:`worker-${threadId}`}.`),super(u),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{_INTERNAL_flushLogsBuffer(this)},c&&this.on(`beforeCaptureLog`,n=>{n.attributes={...n.attributes,"server.address":c}}),process.on(`beforeExit`,this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let n=`@sentry/node`,c=SDK_VERSION,u=trace.getTracer(`@sentry/node`,c);return this._tracer=u,u}async flush(n){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(n)}async close(n){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener);let c=await super.close(n);return this.traceProvider&&await this.traceProvider.shutdown(),c}startClientReportTracking(){let n=this.getOptions();n.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{DEBUG_BUILD$2&&debug.log(`Flushing client reports based on interval.`),this._flushOutcomes()},n.clientReportFlushInterval??DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){_INTERNAL_clearAiProviderSkips(),super._setupIntegrations()}_getTraceInfoFromScope(n){return n?getTraceContextForScope(this,n):[void 0,void 0]}},import_import_in_the_middle=require_import_in_the_middle$2();function initializeEsmLoader(){if(supportsEsmLoaderHooks()&&!GLOBAL_OBJ._sentryEsmLoaderHookRegistered){GLOBAL_OBJ._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:n}=(0,import_import_in_the_middle.createAddHookMessageChannel)();moduleModule.register(`import-in-the-middle/hook.mjs`,import.meta.url,{data:{addHookMessagePort:n,include:[]},transferList:[n]})}catch(n){debug.warn(`Failed to register 'import-in-the-middle' hook`,n)}}}function getDefaultIntegrations$1(){return[inboundFiltersIntegration(),functionToStringIntegration(),linkedErrorsIntegration(),requestDataIntegration(),systemErrorIntegration(),conversationIdIntegration(),consoleIntegration(),httpIntegration$1(),nativeNodeFetchIntegration$1(),onUncaughtExceptionIntegration(),onUnhandledRejectionIntegration(),contextLinesIntegration(),localVariablesIntegration(),nodeContextIntegration(),childProcessIntegration(),processSessionIntegration(),modulesIntegration()]}function init$1(n={}){return _init$1(n,getDefaultIntegrations$1)}function _init$1(n={},c){let u=getClientOptions(n,c);u.debug===!0&&(DEBUG_BUILD$2?debug.enable():consoleSandbox(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),u.registerEsmLoaderHooks!==!1&&initializeEsmLoader(),setOpenTelemetryContextAsyncContextStrategy(),getCurrentScope().update(u.initialScope),u.spotlight&&!u.integrations.some(({name:n})=>n===`Spotlight`)&&u.integrations.push(spotlightIntegration({sidecarUrl:typeof u.spotlight==`string`?u.spotlight:void 0})),applySdkMetadata(u,`node-core`);let p=new NodeClient(u);return getCurrentScope().setClient(p),p.init(),debug.log(`SDK initialized from ${isCjs()?`CommonJS`:`ESM`}`),p.startClientReportTracking(),updateScopeFromEnvVariables(),enhanceDscWithOpenTelemetryRootSpanName(p),setupEventContextTrace(p),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await p.flush(200)}),p}function validateOpenTelemetrySetup(){if(!DEBUG_BUILD$2)return;let n=openTelemetrySetupCheck(),c=[`SentryContextManager`,`SentryPropagator`];hasSpansEnabled()&&c.push(`SentrySpanProcessor`);for(let u of c)n.includes(u)||debug.error(`You have to set up the ${u}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);n.includes(`SentrySampler`)||debug.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function getClientOptions(n,c){let u=getRelease(n.release),p=getSpotlightConfig(n.spotlight),h=getTracesSampleRate(n.tracesSampleRate),x={...n,dsn:n.dsn??process.env.SENTRY_DSN,environment:n.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:n.sendClientReports??!0,transport:n.transport??makeNodeTransport,stackParser:stackParserFromStackParserOptions(n.stackParser||defaultStackParser),release:u,tracesSampleRate:h,spotlight:p,debug:envToBool(n.debug??process.env.SENTRY_DEBUG)},w=n.integrations,T=getIntegrationsToSetup({defaultIntegrations:n.defaultIntegrations??c(x),integrations:w});return x.traceLifecycle===`stream`&&!T.some(n=>n.name===`SpanStreaming`)&&T.push(spanStreamingIntegration()),{...x,integrations:T}}function getRelease(n){if(n!==void 0)return n;let c=getSentryRelease();if(c!==void 0)return c}function getTracesSampleRate(n){if(n!==void 0)return n;let c=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!c)return;let u=parseFloat(c);return isFinite(u)?u:void 0}function updateScopeFromEnvVariables(){if(envToBool(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let n=process.env.SENTRY_TRACE,c=process.env.SENTRY_BAGGAGE,u=propagationContextFromHeaders(n,c);getCurrentScope().setPropagationContext(u)}}function addOriginToSpan(n,c){n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,c)}const INTEGRATION_NAME$23=`Http`,instrumentSentryHttp=generateInstrumentOnce(`${INTEGRATION_NAME$23}.sentry`,n=>new SentryHttpInstrumentation(n)),httpIntegration=defineIntegration((n={})=>{let c=n.spans??!0,u=n.disableIncomingRequestSpans,p=c&&!u,h={sessions:n.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:n.sessionFlushingDelayMS,ignoreRequestBody:n.ignoreIncomingRequestBody,maxRequestBodySize:n.maxIncomingRequestBodySize},x={ignoreIncomingRequests:n.ignoreIncomingRequests,ignoreStaticAssets:n.ignoreStaticAssets,ignoreStatusCodes:n.dropSpansForIncomingRequestStatusCodes,instrumentation:n.instrumentation,onSpanCreated:n.incomingRequestSpanHook},w=httpServerIntegration(h),T=httpServerSpansIntegration(x);return{name:INTEGRATION_NAME$23,setup(n){let c=n.getOptions();p&&hasSpansEnabled(c)&&T.setup(n)},setupOnce(){w.setupOnce(),instrumentSentryHttp({breadcrumbs:n.breadcrumbs,spans:c,propagateTraceInOutgoingRequests:n.tracePropagation??!0,createSpansForOutgoingRequests:c,ignoreOutgoingRequests:n.ignoreOutgoingRequests,outgoingRequestHook:(c,u)=>{let p=getRequestUrlFromClientRequest(u);if(p.startsWith(`data:`)){let n=stripDataUrlContent(p);c.setAttribute(`http.url`,n),c.setAttribute(SEMANTIC_ATTRIBUTE_URL_FULL,n),c.updateName(`${u.method||`GET`} ${n}`)}n.instrumentation?.requestHook?.(c,u)},outgoingResponseHook:n.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:n.instrumentation?.applyCustomAttributesOnSpan})},processEvent(n){return T.processEvent(n)}}});var require_suppress_tracing$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$35=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$11();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$10(),p=require_constants$11(),h=require_utils$35();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$10().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$27=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$27(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$26();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$10();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$11();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$10();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$25();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$25(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$10(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$10(),p=require_TraceState$10();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$10(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$10();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$10();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$47=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$10();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$10();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$10();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$10();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$10();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$10();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$10();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$10();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$35();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$25();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$10();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$10();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$10();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$10();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$10();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$10();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$10();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$10();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$10();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$10();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$10()._export}}));init_esm$2();var import_src$31=require_src$47();init_esm$1();const PACKAGE_NAME$4=`@sentry/instrumentation-undici`;var UndiciInstrumentation=class n extends import_src$35.InstrumentationBase{__init(){this._recordFromReq=new WeakMap}constructor(c={}){super(PACKAGE_NAME$4,SDK_VERSION,c),n.prototype.__init.call(this)}init(){}disable(){super.disable(),this._channelSubs.forEach(n=>n.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel(`undici:request:create`,this.onRequestCreated.bind(this)),this.subscribeToChannel(`undici:client:sendHeaders`,this.onRequestHeaders.bind(this)),this.subscribeToChannel(`undici:request:headers`,this.onResponseHeaders.bind(this)),this.subscribeToChannel(`undici:request:trailers`,this.onDone.bind(this)),this.subscribeToChannel(`undici:request:error`,this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:`Measures the duration of outbound HTTP requests.`,unit:`s`,valueType:ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(n,c){let[u=0,p=0]=process.version.replace(`v`,``).split(`.`).map(n=>Number(n)),h=u>18||u===18&&p>=19,x;if(h)diagch.subscribe?.(n,c),x=()=>diagch.unsubscribe?.(n,c);else{let u=diagch.channel(n);u.subscribe(c),x=()=>u.unsubscribe(c)}this._channelSubs.push({name:n,unsubscribe:x})}parseRequestHeaders(n){let c=new Map;if(Array.isArray(n.headers))for(let u=0;u<n.headers.length;u+=2){let p=n.headers[u],h=n.headers[u+1];typeof p==`string`&&h!==void 0&&c.set(p.toLowerCase(),h)}else if(typeof n.headers==`string`){let u=n.headers.split(`\r
|
|
76
76
|
`);for(let n of u){if(!n)continue;let u=n.indexOf(`:`);if(u===-1)continue;let p=n.substring(0,u).toLowerCase(),h=n.substring(u+1).trim(),x=c.get(p);x&&Array.isArray(x)?x.push(h):x?c.set(p,[x,h]):c.set(p,h)}}return c}onRequestCreated({request:n}){let c=this.getConfig(),u=c.enabled!==!1;if((0,import_src$35.safeExecuteInTheMiddle)(()=>!u||n.method===`CONNECT`||c.ignoreRequestHook?.(n),n=>n&&this._diag.error(`caught ignoreRequestHook error: `,n),!0))return;let p=(0,import_src$31.hrTime)(),h;try{h=new URL$1(n.path,n.origin)}catch(n){this._diag.warn(`could not determine url.full:`,n);return}let x=h.protocol.replace(`:`,``),w=this.getRequestMethod(n.method),T={[ATTR_HTTP_REQUEST_METHOD]:w,[ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:n.method,[ATTR_URL_FULL]:h.toString(),[ATTR_URL_PATH]:h.pathname,[ATTR_URL_QUERY]:h.search,[ATTR_URL_SCHEME]:x},O={https:`443`,http:`80`},A=h.hostname,j=h.port||O[x];T[ATTR_SERVER_ADDRESS]=A,j&&!isNaN(Number(j))&&(T[ATTR_SERVER_PORT]=Number(j));let N=this.parseRequestHeaders(n).get(`user-agent`);N&&(T[ATTR_USER_AGENT_ORIGINAL]=Array.isArray(N)?N[N.length-1]:N);let I=(0,import_src$35.safeExecuteInTheMiddle)(()=>c.startSpanHook?.(n),n=>n&&this._diag.error(`caught startSpanHook error: `,n),!0);I&&Object.entries(I).forEach(([n,c])=>{T[n]=c});let L=context$1.active(),z=trace.getSpan(L),B;B=c.requireParentforSpans&&(!z||!trace.isSpanContextValid(z.spanContext()))?trace.wrapSpanContext(INVALID_SPAN_CONTEXT):this.tracer.startSpan(w===`_OTHER`?`HTTP`:w,{kind:SpanKind.CLIENT,attributes:T},L),(0,import_src$35.safeExecuteInTheMiddle)(()=>c.requestHook?.(B,n),n=>n&&this._diag.error(`caught requestHook error: `,n),!0);let V=trace.setSpan(context$1.active(),B),H={};propagation.inject(V,H);let U=Object.entries(H);for(let c=0;c<U.length;c++){let u=U[c];if(!u)continue;let[p,h]=u;typeof n.addHeader==`function`?n.addHeader(p,h):typeof n.headers==`string`?n.headers+=`${p}: ${h}\r\n`:Array.isArray(n.headers)&&n.headers.push(p,h)}this._recordFromReq.set(n,{span:B,attributes:T,startTime:p})}onRequestHeaders({request:n,socket:c}){let u=this._recordFromReq.get(n);if(!u)return;let p=this.getConfig(),{span:h}=u,{remoteAddress:x,remotePort:w}=c,T={[ATTR_NETWORK_PEER_ADDRESS]:x,[ATTR_NETWORK_PEER_PORT]:w};if(p.headersToSpanAttributes?.requestHeaders){let c=new Set(p.headersToSpanAttributes.requestHeaders.map(n=>n.toLowerCase())),u=this.parseRequestHeaders(n);for(let[n,p]of u.entries())if(c.has(n)){let c=Array.isArray(p)?p:[p];T[`http.request.header.${n}`]=c}}h.setAttributes(T)}onResponseHeaders({request:n,response:c}){let u=this._recordFromReq.get(n);if(!u)return;let{span:p,attributes:h}=u,x={[ATTR_HTTP_RESPONSE_STATUS_CODE]:c.statusCode},w=this.getConfig();if((0,import_src$35.safeExecuteInTheMiddle)(()=>w.responseHook?.(p,{request:n,response:c}),n=>n&&this._diag.error(`caught responseHook error: `,n),!0),w.headersToSpanAttributes?.responseHeaders){let n=new Set;w.headersToSpanAttributes?.responseHeaders.forEach(c=>n.add(c.toLowerCase()));for(let u=0;u<c.headers.length;u+=2){let p=c.headers[u],h=c.headers[u+1];if(p===void 0||h===void 0)continue;let w=p.toString().toLowerCase(),T=h;if(n.has(w)){let n=`http.response.header.${w}`;Object.prototype.hasOwnProperty.call(x,n)?x[n].push(T.toString()):x[n]=[T.toString()]}}}p.setAttributes(x),p.setStatus({code:c.statusCode>=400?SpanStatusCode.ERROR:SpanStatusCode.UNSET}),u.attributes=Object.assign(h,x)}onDone({request:n}){let c=this._recordFromReq.get(n);if(!c)return;let{span:u,attributes:p,startTime:h}=c;u.end(),this._recordFromReq.delete(n),this.recordRequestDuration(p,h)}onError({request:n,error:c}){let u=this._recordFromReq.get(n);if(!u)return;let{span:p,attributes:h,startTime:x}=u;p.recordException(c),p.setStatus({code:SpanStatusCode.ERROR,message:c.message}),p.end(),this._recordFromReq.delete(n),h[ATTR_ERROR_TYPE]=c.message,this.recordRequestDuration(h,x)}recordRequestDuration(n,c){let u={};[ATTR_HTTP_RESPONSE_STATUS_CODE,ATTR_HTTP_REQUEST_METHOD,ATTR_SERVER_ADDRESS,ATTR_SERVER_PORT,ATTR_URL_SCHEME,ATTR_ERROR_TYPE].forEach(c=>{c in n&&(u[c]=n[c])});let p=(0,import_src$31.hrTimeToMilliseconds)((0,import_src$31.hrTimeDuration)(c,(0,import_src$31.hrTime)()))/1e3;this._httpClientDurationHistogram.record(p,u)}getRequestMethod(n){return n.toUpperCase()in{CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0}?n.toUpperCase():`_OTHER`}};const INTEGRATION_NAME$22=`NodeFetch`,instrumentOtelNodeFetch=generateInstrumentOnce(INTEGRATION_NAME$22,UndiciInstrumentation,n=>_getConfigWithDefaults(n)),instrumentSentryNodeFetch=generateInstrumentOnce(`${INTEGRATION_NAME$22}.sentry`,SentryNodeFetchInstrumentation,n=>n),_nativeNodeFetchIntegration=((n={})=>({name:`NodeFetch`,setupOnce(){_shouldInstrumentSpans(n,getClient()?.getOptions())&&instrumentOtelNodeFetch(n),instrumentSentryNodeFetch(n)}})),nativeNodeFetchIntegration=defineIntegration(_nativeNodeFetchIntegration);function getAbsoluteUrl(n,c=`/`){let u=`${n}`;return u.endsWith(`/`)&&c.startsWith(`/`)?`${u}${c.slice(1)}`:!u.endsWith(`/`)&&!c.startsWith(`/`)?`${u}/${c}`:`${u}${c}`}function _shouldInstrumentSpans(n,c={}){return typeof n.spans==`boolean`?n.spans:!c.skipOpenTelemetrySetup&&hasSpansEnabled(c)}function _getConfigWithDefaults(n={}){return{requireParentforSpans:!1,ignoreRequestHook:c=>{let u=getAbsoluteUrl(c.origin,c.path),p=n.ignoreOutgoingRequests;return!!(p&&u&&p(u))},startSpanHook:n=>{let c=getAbsoluteUrl(n.origin,n.path);if(c.startsWith(`data:`)){let u=stripDataUrlContent(c);return{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.node_fetch`,"http.url":u,[SEMANTIC_ATTRIBUTE_URL_FULL]:u,[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]:`${n.method||`GET`} ${u}`}}return{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.node_fetch`}},requestHook:n.requestHook,responseHook:n.responseHook,headersToSpanAttributes:n.headersToSpanAttributes}}const DEBUG_BUILD=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;init_esm$2();const INTEGRATION_NAME$21=`Express`,SUPPORTED_VERSIONS$2=[`>=4.0.0 <6`],instrumentExpress=generateInstrumentOnce(INTEGRATION_NAME$21,n=>new ExpressInstrumentation(n));var ExpressInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`sentry-express`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`express`,SUPPORTED_VERSIONS$2,n=>{try{patchExpressModule(n,()=>({...this.getConfig(),onRouteResolved(n){let c=(0,import_src$31.getRPCMetadata)(context$1.active());n&&c?.type===import_src$31.RPCType.HTTP&&(c.route=n)}}))}catch(n){DEBUG_BUILD&&debug.error(`Failed to patch express module:`,n)}return n},n=>n)}};const _expressIntegration=(n=>({name:INTEGRATION_NAME$21,setupOnce(){instrumentExpress(n)}})),expressIntegration=defineIntegration(_expressIntegration);var require_suppress_tracing$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$34=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$10();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$9(),p=require_constants$10(),h=require_utils$34();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$9().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$26(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$25();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$9();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$10();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$9();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$24();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$24(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$9(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$9(),p=require_TraceState$9();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$9(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$9();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$9();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$46=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$9();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$9();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$9();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$9();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$9();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$9();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$9();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$9();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$34();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$24();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$9();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$9();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$9();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$9();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$9();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$9();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$9();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$9();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$9();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$9();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$9()._export}})),require_LogRecord$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SeverityNumber=void 0,(function(n){n[n.UNSPECIFIED=0]=`UNSPECIFIED`,n[n.TRACE=1]=`TRACE`,n[n.TRACE2=2]=`TRACE2`,n[n.TRACE3=3]=`TRACE3`,n[n.TRACE4=4]=`TRACE4`,n[n.DEBUG=5]=`DEBUG`,n[n.DEBUG2=6]=`DEBUG2`,n[n.DEBUG3=7]=`DEBUG3`,n[n.DEBUG4=8]=`DEBUG4`,n[n.INFO=9]=`INFO`,n[n.INFO2=10]=`INFO2`,n[n.INFO3=11]=`INFO3`,n[n.INFO4=12]=`INFO4`,n[n.WARN=13]=`WARN`,n[n.WARN2=14]=`WARN2`,n[n.WARN3=15]=`WARN3`,n[n.WARN4=16]=`WARN4`,n[n.ERROR=17]=`ERROR`,n[n.ERROR2=18]=`ERROR2`,n[n.ERROR3=19]=`ERROR3`,n[n.ERROR4=20]=`ERROR4`,n[n.FATAL=21]=`FATAL`,n[n.FATAL2=22]=`FATAL2`,n[n.FATAL3=23]=`FATAL3`,n[n.FATAL4=24]=`FATAL4`})(n.SeverityNumber||={})})),require_NoopLogger$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER=n.NoopLogger=void 0;var c=class{emit(n){}};n.NoopLogger=c,n.NOOP_LOGGER=new c})),require_global_utils$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.API_BACKWARDS_COMPATIBILITY_VERSION=n.makeGetter=n._global=n.GLOBAL_LOGS_API_KEY=void 0,n.GLOBAL_LOGS_API_KEY=Symbol.for(`io.opentelemetry.js.api.logs`),n._global=globalThis;function c(n,c,u){return p=>p===n?c:u}n.makeGetter=c,n.API_BACKWARDS_COMPATIBILITY_VERSION=1})),require_NoopLoggerProvider$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER_PROVIDER=n.NoopLoggerProvider=void 0;let c=require_NoopLogger$2();var u=class{getLogger(n,u,p){return new c.NoopLogger}};n.NoopLoggerProvider=u,n.NOOP_LOGGER_PROVIDER=new u})),require_ProxyLogger$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLogger=void 0;let c=require_NoopLogger$2();n.ProxyLogger=class{constructor(n,c,u,p){this._provider=n,this.name=c,this.version=u,this.options=p}emit(n){this._getLogger().emit(n)}_getLogger(){if(this._delegate)return this._delegate;let n=this._provider._getDelegateLogger(this.name,this.version,this.options);return n?(this._delegate=n,this._delegate):c.NOOP_LOGGER}}})),require_ProxyLoggerProvider$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLoggerProvider=void 0;let c=require_NoopLoggerProvider$2(),u=require_ProxyLogger$2();n.ProxyLoggerProvider=class{getLogger(n,c,p){var h;return this._getDelegateLogger(n,c,p)??new u.ProxyLogger(this,n,c,p)}_getDelegate(){var n;return this._delegate??c.NOOP_LOGGER_PROVIDER}_setDelegate(n){this._delegate=n}_getDelegateLogger(n,c,u){var p;return this._delegate?.getLogger(n,c,u)}}})),require_logs$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LogsAPI=void 0;let c=require_global_utils$2(),u=require_NoopLoggerProvider$2(),p=require_ProxyLoggerProvider$2();n.LogsAPI=class n{constructor(){this._proxyLoggerProvider=new p.ProxyLoggerProvider}static getInstance(){return this._instance||=new n,this._instance}setGlobalLoggerProvider(n){return c._global[c.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(c._global[c.GLOBAL_LOGS_API_KEY]=(0,c.makeGetter)(c.API_BACKWARDS_COMPATIBILITY_VERSION,n,u.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(n),n)}getLoggerProvider(){var n,u;return c._global[c.GLOBAL_LOGS_API_KEY]?.call(c._global,c.API_BACKWARDS_COMPATIBILITY_VERSION)??this._proxyLoggerProvider}getLogger(n,c,u){return this.getLoggerProvider().getLogger(n,c,u)}disable(){delete c._global[c.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new p.ProxyLoggerProvider}}})),require_src$45=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.logs=n.NoopLogger=n.NOOP_LOGGER=n.SeverityNumber=void 0;var c=require_LogRecord$2();Object.defineProperty(n,`SeverityNumber`,{enumerable:!0,get:function(){return c.SeverityNumber}});var u=require_NoopLogger$2();Object.defineProperty(n,`NOOP_LOGGER`,{enumerable:!0,get:function(){return u.NOOP_LOGGER}}),Object.defineProperty(n,`NoopLogger`,{enumerable:!0,get:function(){return u.NoopLogger}}),n.logs=require_logs$4().LogsAPI.getInstance()})),require_autoLoaderUtils$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.disableInstrumentations=n.enableInstrumentations=void 0;function c(n,c,u,p){for(let h=0,x=n.length;h<x;h++){let x=n[h];c&&x.setTracerProvider(c),u&&x.setMeterProvider(u),p&&x.setLoggerProvider&&x.setLoggerProvider(p),x.getConfig().enabled||x.enable()}}n.enableInstrumentations=c;function u(n){n.forEach(n=>n.disable())}n.disableInstrumentations=u})),require_autoLoader$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.registerInstrumentations=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$45(),p=require_autoLoaderUtils$2();function h(n){let h=n.tracerProvider||c.trace.getTracerProvider(),x=n.meterProvider||c.metrics.getMeterProvider(),w=n.loggerProvider||u.logs.getLoggerProvider(),T=n.instrumentations?.flat()??[];return(0,p.enableInstrumentations)(T,h,x,w),()=>{(0,p.disableInstrumentations)(T)}}n.registerInstrumentations=h})),require_semver$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.satisfies=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,p=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function x(n,u,p){if(!w(n))return c.diag.error(`Invalid version: ${n}`),!1;if(!u)return!0;u=u.replace(/([<>=~^]+)\s+/g,`$1`);let h=L(n);if(!h)return!1;let x=[],O=T(h,u,x,p);return O&&!p?.includePrerelease?j(h,x):O}n.satisfies=x;function w(n){return typeof n==`string`&&u.test(n)}function T(n,c,u,p){if(c.includes(`||`)){let h=c.trim().split(`||`);for(let c of h)if(O(n,c,u,p))return!0;return!1}else if(c.includes(` - `))c=ge(c,p);else if(c.includes(` `)){let h=c.trim().replace(/\s{2,}/g,` `).split(` `);for(let c of h)if(!O(n,c,u,p))return!1;return!0}return O(n,c,u,p)}function O(n,c,u,p){if(c=N(c,p),c.includes(` `))return T(n,c,u,p);{let p=z(c);return u.push(p),A(n,p)}}function A(n,c){if(c.invalid)return!1;if(!c.version||B(c.version))return!0;let u=W(n.versionSegments||[],c.versionSegments||[]);if(u===0){let p=n.prereleaseSegments||[],h=c.prereleaseSegments||[];u=!p.length&&!h.length?0:!p.length&&h.length?1:p.length&&!h.length?-1:W(p,h)}return h[c.op]?.includes(u)}function j(n,c){return n.prerelease?c.some(c=>c.prerelease&&c.version===n.version):!0}function N(n,c){return n=n.trim(),n=me(n,c),n=pe(n),n=he(n,c),n=n.trim(),n}function I(n){return!n||n.toLowerCase()===`x`||n===`*`}function L(n){let p=n.match(u);if(!p){c.diag.error(`Invalid version: ${n}`);return}let h=p.groups.version,x=p.groups.prerelease,w=p.groups.build,T=h.split(`.`),O=x?.split(`.`);return{op:void 0,version:h,versionSegments:T,versionSegmentCount:T.length,prerelease:x,prereleaseSegments:O,prereleaseSegmentCount:O?O.length:0,build:w}}function z(n){if(!n)return{};let u=n.match(p);if(!u)return c.diag.error(`Invalid range: ${n}`),{invalid:!0};let h=u.groups.op,x=u.groups.version,w=u.groups.prerelease,T=u.groups.build,O=x.split(`.`),A=w?.split(`.`);return h===`==`&&(h=`=`),{op:h||`=`,version:x,versionSegments:O,versionSegmentCount:O.length,prerelease:w,prereleaseSegments:A,prereleaseSegmentCount:A?A.length:0,build:T}}function B(n){return n===`*`||n===`x`||n===`X`}function V(n){let c=parseInt(n,10);return isNaN(c)?n:c}function H(n,c){if(typeof n==typeof c){if(typeof n==`number`||typeof n==`string`)return[n,c];throw Error(`Version segments can only be strings or numbers`)}else return[String(n),String(c)]}function U(n,c){if(B(n)||B(c))return 0;let[u,p]=H(V(n),V(c));return u>p?1:u<p?-1:0}function W(n,c){for(let u=0;u<Math.max(n.length,c.length);u++){let p=U(n[u]||`0`,c[u]||`0`);if(p!==0)return p}return 0}let G=`[a-zA-Z0-9-]`,K=`0|[1-9]\\d*`,ee=`\\d*[a-zA-Z-]${G}*`,te=`((?:<|>)?=?)`,J=`(?:${K}|${ee})`,Y=`(?:-(${J}(?:\\.${J})*))`,ne=`${G}+`,re=`(?:\\+(${ne}(?:\\.${ne})*))`,X=`${K}|x|X|\\*`,ie=`[v=\\s]*(${X})(?:\\.(${X})(?:\\.(${X})(?:${Y})?${re}?)?)?`,ae=`^((?:<|>)?=?)\\s*${ie}$`,oe=new RegExp(ae),se=`^\\s*(${ie})\\s+-\\s+(${ie})\\s*$`,ce=new RegExp(se),le=`^(?:~>?)${ie}$`,ue=new RegExp(le),de=`^(?:\\^)${ie}$`,fe=new RegExp(de);function pe(n){let c=ue;return n.replace(c,(n,c,u,p,h)=>{let x;return x=I(c)?``:I(u)?`>=${c}.0.0 <${+c+1}.0.0-0`:I(p)?`>=${c}.${u}.0 <${c}.${+u+1}.0-0`:h?`>=${c}.${u}.${p}-${h} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${p} <${c}.${+u+1}.0-0`,x})}function me(n,c){let u=fe,p=c?.includePrerelease?`-0`:``;return n.replace(u,(n,c,u,h,x)=>{let w;return w=I(c)?``:I(u)?`>=${c}.0.0${p} <${+c+1}.0.0-0`:I(h)?c===`0`?`>=${c}.${u}.0${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.0${p} <${+c+1}.0.0-0`:x?c===`0`?u===`0`?`>=${c}.${u}.${h}-${x} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}-${x} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h}-${x} <${+c+1}.0.0-0`:c===`0`?u===`0`?`>=${c}.${u}.${h}${p} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h} <${+c+1}.0.0-0`,w})}function he(n,c){let u=oe;return n.replace(u,(n,u,p,h,x,w)=>{let T=I(p),O=T||I(h),A=O||I(x),j=A;return u===`=`&&j&&(u=``),w=c?.includePrerelease?`-0`:``,T?n=u===`>`||u===`<`?`<0.0.0-0`:`*`:u&&j?(O&&(h=0),x=0,u===`>`?(u=`>=`,O?(p=+p+1,h=0,x=0):(h=+h+1,x=0)):u===`<=`&&(u=`<`,O?p=+p+1:h=+h+1),u===`<`&&(w=`-0`),n=`${u+p}.${h}.${x}${w}`):O?n=`>=${p}.0.0${w} <${+p+1}.0.0-0`:A&&(n=`>=${p}.${h}.0${w} <${p}.${+h+1}.0-0`),n})}function ge(n,c){let u=ce;return n.replace(u,(n,u,p,h,x,w,T,O,A,j,N,L)=>(u=I(p)?``:I(h)?`>=${p}.0.0${c?.includePrerelease?`-0`:``}`:I(x)?`>=${p}.${h}.0${c?.includePrerelease?`-0`:``}`:w?`>=${u}`:`>=${u}${c?.includePrerelease?`-0`:``}`,O=I(A)?``:I(j)?`<${+A+1}.0.0-0`:I(N)?`<${A}.${+j+1}.0-0`:L?`<=${A}.${j}.${N}-${L}`:c?.includePrerelease?`<${A}.${j}.${+N+1}-0`:`<=${O}`,`${u} ${O}`.trim()))}})),require_shimmer$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.massUnwrap=n.unwrap=n.massWrap=n.wrap=void 0;let c=console.error.bind(console);function u(n,c,u){let p=!!n[c]&&Object.prototype.propertyIsEnumerable.call(n,c);Object.defineProperty(n,c,{configurable:!0,enumerable:p,writable:!0,value:u})}n.wrap=(n,p,h)=>{if(!n||!n[p]){c(`no original function `+String(p)+` to wrap`);return}if(!h){c(`no wrapper function`),c(Error().stack);return}let x=n[p];if(typeof x!=`function`||typeof h!=`function`){c(`original object and wrapper must be functions`);return}let w=h(x,p);return u(w,`__original`,x),u(w,`__unwrap`,()=>{n[p]===w&&u(n,p,x)}),u(w,`__wrapped`,!0),u(n,p,w),w},n.massWrap=(u,p,h)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to wrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.wrap)(c,u,h)})})},n.unwrap=(n,u)=>{if(!n||!n[u]){c(`no function to unwrap.`),c(Error().stack);return}let p=n[u];if(!p.__unwrap)c(`no original to unwrap to -- has `+String(u)+` already been unwrapped?`);else{p.__unwrap();return}},n.massUnwrap=(u,p)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to unwrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.unwrap)(c,u)})})};function p(n){n&&n.logger&&(typeof n.logger==`function`?c=n.logger:c(`new logger isn't a function, not replacing`))}n.default=p,p.wrap=n.wrap,p.massWrap=n.massWrap,p.unwrap=n.unwrap,p.massUnwrap=n.massUnwrap})),require_instrumentation$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationAbstract=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$45(),p=require_shimmer$2();n.InstrumentationAbstract=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(n,p,h){this.instrumentationName=n,this.instrumentationVersion=p,this.setConfig(h),this._diag=c.diag.createComponentLogger({namespace:n}),this._tracer=c.trace.getTracer(n,p),this._meter=c.metrics.getMeter(n,p),this._logger=u.logs.getLogger(n,p),this._updateMetricInstruments()}_wrap=p.wrap;_unwrap=p.unwrap;_massWrap=p.massWrap;_massUnwrap=p.massUnwrap;get meter(){return this._meter}setMeterProvider(n){this._meter=n.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(n){this._logger=n.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let n=this.init()??[];return Array.isArray(n)?n:[n]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(n){this._config={enabled:!0,...n}}setTracerProvider(n){this._tracer=n.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(n,c,u,p){if(n)try{n(u,p)}catch(n){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:c},n)}}}})),require_ModuleNameTrie$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ModuleNameTrie=n.ModuleNameSeparator=void 0,n.ModuleNameSeparator=`/`;var c=class{hooks=[];children=new Map};n.ModuleNameTrie=class{_trie=new c;_counter=0;insert(u){let p=this._trie;for(let h of u.moduleName.split(n.ModuleNameSeparator)){let n=p.children.get(h);n||(n=new c,p.children.set(h,n)),p=n}p.hooks.push({hook:u,insertedId:this._counter++})}search(c,{maintainInsertionOrder:u,fullOnly:p}={}){let h=this._trie,x=[],w=!0;for(let u of c.split(n.ModuleNameSeparator)){let n=h.children.get(u);if(!n){w=!1;break}p||x.push(...n.hooks),h=n}return p&&w&&x.push(...h.hooks),x.length===0?[]:x.length===1?[x[0].hook]:(u&&x.sort((n,c)=>n.insertedId-c.insertedId),x.map(({hook:n})=>n))}}})),require_RequireInTheMiddleSingleton$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RequireInTheMiddleSingleton=void 0;let c=require_require_in_the_middle(),u=__require(`path`),p=require_ModuleNameTrie$2(),h=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(n=>typeof global[n]==`function`);n.RequireInTheMiddleSingleton=class n{_moduleNameTrie=new p.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new c.Hook(null,{internals:!0},(n,c,u)=>{let p=x(c),h=this._moduleNameTrie.search(p,{maintainInsertionOrder:!0,fullOnly:u===void 0});for(let{onRequire:p}of h)n=p(n,c,u);return n})}register(n,c){let u={moduleName:n,onRequire:c};return this._moduleNameTrie.insert(u),u}static getInstance(){return h?new n:this._instance=this._instance??new n}};function x(n){return u.sep===p.ModuleNameSeparator?n:n.split(u.sep).join(p.ModuleNameSeparator)}})),require_register$1=__commonJSMin$1((n=>{let c=[],u=new WeakMap,p=new WeakMap,h=new Map,x=[],w={set(n,c,p){let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p):!0},get(n,c){if(c===Symbol.toStringTag)return`Module`;let u=p.get(n)[c];if(typeof u==`function`)return u()},defineProperty(n,c,p){if(!(`value`in p))throw Error(`Getters/setters are not supported for exports property descriptors.`);let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p.value):!0}};function T(n,T,O,A,j){h.set(n,j),u.set(T,O),p.set(T,A);let N=new Proxy(T,w);c.forEach(c=>c(n,N,j)),x.push([n,N,j])}n.register=T,n.importHooks=c,n.specifiers=h,n.toHook=x})),require_import_in_the_middle$1=__commonJSMin$1(((n,c)=>{let u=__require(`path`),p=require_module_details_from_path(),{fileURLToPath:h}=__require(`url`),{MessageChannel:x}=__require(`worker_threads`),{isBuiltin:w}=__require(`module`);w||=()=>!0;let{importHooks:T,specifiers:O,toHook:A}=require_register$1();function j(n){T.push(n),A.forEach(([c,u,p])=>n(c,u,p))}function N(n){let c=T.indexOf(n);c>-1&&T.splice(c,1)}function I(n,c,u,p){let h=n(c,u,p);h&&h!==c&&`default`in c&&(c.default=h)}let L;function z(){let{port1:n,port2:c}=new x,u=0,p;L=c=>{u++,n.postMessage(c)},n.on(`message`,()=>{u--,p&&u<=0&&p()}).unref();function h(){let n=setInterval(()=>{},1e3),c=new Promise(n=>{p=n}).then(()=>{clearInterval(n)});return u===0&&p(),c}let w=c;return{registerOptions:{data:{addHookMessagePort:w,include:[]},transferList:[w]},addHookMessagePort:w,waitForAllMessagesAcknowledged:h}}function B(n,c,x){if(!(this instanceof B))return new B(n,c,x);typeof n==`function`?(x=n,n=null,c=null):typeof c==`function`&&(x=c,c=null);let T=c?c.internals===!0:!1;L&&Array.isArray(n)&&L(n),this._iitmHook=(c,A,j)=>{let N=c,L=N.startsWith(`node:`),z,B;if(L){let n=c.slice(5);w(n)&&(c=n)}else if(N.startsWith(`file://`)){let n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{z=h(c),c=z}catch{}if(Error.stackTraceLimit=n,z){let n=p(z);n&&(c=n.name,B=n.basedir)}}if(n)for(let p of n)if(z&&p===z)I(x,A,z,void 0);else if(p===c){if(!B)I(x,A,c,B);else if(B.endsWith(O.get(N)))I(x,A,c,B);else if(T){let n=c+u.sep+u.relative(B,z);I(x,A,n,B)}}else p===j&&I(x,A,j,B);else I(x,A,c,B)},j(this._iitmHook)}B.prototype.unhook=function(){N(this._iitmHook)},c.exports=B,c.exports.Hook=B,c.exports.addHook=j,c.exports.removeHook=N,c.exports.createAddHookMessageChannel=z})),require_utils$33=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isWrapped=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=void 0;function c(n,c,u){let p,h;try{h=n()}catch(n){p=n}finally{if(c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddle=c;async function u(n,c,u){let p,h;try{h=await n()}catch(n){p=n}finally{if(await c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddleAsync=u;function p(n){return typeof n==`function`&&typeof n.__original==`function`&&typeof n.__unwrap==`function`&&n.__wrapped===!0}n.isWrapped=p})),require_instrumentation$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationBase=void 0;let c=__require(`path`),u=__require(`util`),p=require_semver$2(),h=require_shimmer$2(),x=require_instrumentation$17(),w=require_RequireInTheMiddleSingleton$2(),T=require_import_in_the_middle$1(),O=(init_esm$2(),__toCommonJS(esm_exports$2)),A=require_require_in_the_middle(),j=__require(`fs`),N=require_utils$33();n.InstrumentationBase=class extends x.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=w.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(n,c,u){super(n,c,u);let p=this.init();p&&!Array.isArray(p)&&(p=[p]),this._modules=p||[],this._config.enabled&&this.enable()}_wrap=(n,c,p)=>{if((0,N.isWrapped)(n[c])&&this._unwrap(n,c),u.types.isProxy(n)){let u=(0,h.wrap)(Object.assign({},n),c,p);return Object.defineProperty(n,c,{value:u}),u}else return(0,h.wrap)(n,c,p)};_unwrap=(n,c)=>u.types.isProxy(n)?Object.defineProperty(n,c,{value:n[c]}):(0,h.unwrap)(n,c);_massWrap=(n,c,u)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._wrap(n,c,u)})})};_massUnwrap=(n,c)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._unwrap(n,c)})})};_warnOnPreloadedModules(){this._modules.forEach(n=>{let{name:c}=n;try{let n=__require.resolve(c);__require.cache[n]&&this._diag.warn(`Module ${c} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${c}`)}catch{}})}_extractPackageVersion(n){try{let u=(0,j.readFileSync)(c.join(n,`package.json`),{encoding:`utf8`}),p=JSON.parse(u).version;return typeof p==`string`?p:void 0}catch{O.diag.warn(`Failed extracting version`,n)}}_onRequire(n,u,p,h){if(!h)return typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:n.name}),n.patch(u)):u;let x=this._extractPackageVersion(h);if(n.moduleVersion=x,n.name===p)return I(n.supportedVersions,x,n.includePrerelease)&&typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:n.name,version:n.moduleVersion,baseDir:h}),n.patch(u,n.moduleVersion)):u;let w=n.files??[],T=c.normalize(p);return w.filter(c=>c.name===T&&I(c.supportedVersions,x,n.includePrerelease)).reduce((c,u)=>(u.moduleExports=c,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:n.name,version:n.moduleVersion,fileName:u.name,baseDir:h}),u.patch(c,n.moduleVersion)):c),u)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let n of this._modules){typeof n.patch==`function`&&n.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:n.name,version:n.moduleVersion}),n.patch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.patch(c.moduleExports,n.moduleVersion))}return}this._warnOnPreloadedModules();for(let n of this._modules){let u=(u,p,h)=>{if(!h&&c.isAbsolute(p)){let n=c.parse(p);p=n.name,h=n.dir}return this._onRequire(n,u,p,h)},p=(c,u,p)=>this._onRequire(n,c,u,p),h=c.isAbsolute(n.name)?new A.Hook([n.name],{internals:!0},p):this._requireInTheMiddleSingleton.register(n.name,p);this._hooks.push(h);let x=new T.Hook([n.name],{internals:!0},u);this._hooks.push(x)}}}disable(){if(this._enabled){this._enabled=!1;for(let n of this._modules){typeof n.unpatch==`function`&&n.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:n.name,version:n.moduleVersion}),n.unpatch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.unpatch(c.moduleExports,n.moduleVersion))}}}isEnabled(){return this._enabled}};function I(n,c,u){return c===void 0?n.includes(`*`):n.some(n=>(0,p.satisfies)(c,n,{includePrerelease:u}))}})),require_normalize$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=void 0;var c=__require(`path`);Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_node$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_instrumentation$16();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}});var u=require_normalize$2();Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return u.normalize}})})),require_platform$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_node$23();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}}),Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_instrumentationNodeModuleDefinition$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleDefinition=void 0,n.InstrumentationNodeModuleDefinition=class{files;name;supportedVersions;patch;unpatch;constructor(n,c,u,p,h){this.files=h||[],this.name=n,this.supportedVersions=c,this.patch=u,this.unpatch=p}}})),require_instrumentationNodeModuleFile$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleFile=void 0;let c=require_platform$23();n.InstrumentationNodeModuleFile=class{name;supportedVersions;patch;unpatch;constructor(n,u,p,h){this.name=(0,c.normalize)(n),this.supportedVersions=u,this.patch=p,this.unpatch=h}}})),require_semconvStability$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=void 0;var c;(function(n){n[n.STABLE=1]=`STABLE`,n[n.OLD=2]=`OLD`,n[n.DUPLICATE=3]=`DUPLICATE`})(c=n.SemconvStability||={});function u(n,u){let p=c.OLD,h=u?.split(`,`).map(n=>n.trim()).filter(n=>n!==``);for(let u of h??[])if(u.toLowerCase()===n+`/dup`){p=c.DUPLICATE;break}else u.toLowerCase()===n&&(p=c.STABLE);return p}n.semconvStabilityFromStr=u})),require_src$44=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=n.isWrapped=n.InstrumentationNodeModuleFile=n.InstrumentationNodeModuleDefinition=n.InstrumentationBase=n.registerInstrumentations=void 0;var c=require_autoLoader$2();Object.defineProperty(n,`registerInstrumentations`,{enumerable:!0,get:function(){return c.registerInstrumentations}});var u=require_platform$23();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return u.InstrumentationBase}});var p=require_instrumentationNodeModuleDefinition$2();Object.defineProperty(n,`InstrumentationNodeModuleDefinition`,{enumerable:!0,get:function(){return p.InstrumentationNodeModuleDefinition}});var h=require_instrumentationNodeModuleFile$2();Object.defineProperty(n,`InstrumentationNodeModuleFile`,{enumerable:!0,get:function(){return h.InstrumentationNodeModuleFile}});var x=require_utils$33();Object.defineProperty(n,`isWrapped`,{enumerable:!0,get:function(){return x.isWrapped}}),Object.defineProperty(n,`safeExecuteInTheMiddle`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddle}}),Object.defineProperty(n,`safeExecuteInTheMiddleAsync`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddleAsync}});var w=require_semconvStability$2();Object.defineProperty(n,`SemconvStability`,{enumerable:!0,get:function(){return w.SemconvStability}}),Object.defineProperty(n,`semconvStabilityFromStr`,{enumerable:!0,get:function(){return w.semconvStabilityFromStr}})})),require_package=__commonJSMin$1(((n,c)=>{c.exports={name:`@fastify/otel`,version:`0.18.0`,description:`Official Fastify OpenTelemetry Instrumentation`,main:`index.js`,type:`commonjs`,types:`types/index.d.ts`,scripts:{lint:`eslint`,"lint:fix":`eslint --fix`,test:`npm run test:all && npm run test:typescript`,"test:unit":`c8 --100 node --test`,"test:all":`npm run test:v4 && npm run test:v5`,"test:v4":`cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit`,"test:v5":`cross-env FASTIFY_VERSION=fastify npm run test:unit`,"test:coverage":`c8 node --test && c8 report --reporter=html`,"test:typescript":`tsd`},repository:{type:`git`,url:`git+https://github.com/fastify/otel.git`},keywords:[`plugin`,`helper`,`fastify`,`instrumentation`,`otel`,`opentelemetry`],author:`Carlos Fuentes - @metcoder95 (https://metcoder.dev)`,license:`MIT`,bugs:{url:`https://github.com/fastify/otel/issues`},homepage:`https://github.com/fastify/otel#readme`,funding:[{type:`github`,url:`https://github.com/sponsors/fastify`},{type:`opencollective`,url:`https://opencollective.com/fastify`}],devDependencies:{"@fastify/type-provider-typebox":`^6.1.0`,"@opentelemetry/context-async-hooks":`^2.0.0`,"@opentelemetry/contrib-test-utils":`^0.59.0`,"@opentelemetry/instrumentation-http":`^0.212.0`,"@opentelemetry/propagator-jaeger":`^2.0.0`,"@opentelemetry/sdk-trace-base":`^2.0.0`,"@opentelemetry/sdk-trace-node":`^2.2.0`,"@types/node":`^25.0.3`,c8:`^11.0.0`,"cross-env":`^10.0.0`,eslint:`^9.16.0`,fastify:`^5.1.0`,"fastify-plugin":`^5.1.0`,fastifyv4:`npm:fastify@^4.0.0`,neostandard:`^0.12.0`,tsd:`^0.33.0`},dependencies:{"@opentelemetry/core":`^2.0.0`,"@opentelemetry/instrumentation":`^0.212.0`,"@opentelemetry/semantic-conventions":`^1.28.0`,minimatch:`^10.2.4`},peerDependencies:{"@opentelemetry/api":`^1.9.0`},tsd:{directory:`types`}}})),require_commonjs$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.range=n.balanced=void 0,n.balanced=(u,p,h)=>{let x=u instanceof RegExp?c(u,h):u,w=p instanceof RegExp?c(p,h):p,T=x!==null&&w!=null&&(0,n.range)(x,w,h);return T&&{start:T[0],end:T[1],pre:h.slice(0,T[0]),body:h.slice(T[0]+x.length,T[1]),post:h.slice(T[1]+w.length)}};let c=(n,c)=>{let u=c.match(n);return u?u[0]:null};n.range=(n,c,u)=>{let p,h,x,w,T,O=u.indexOf(n),A=u.indexOf(c,O+1),j=O;if(O>=0&&A>0){if(n===c)return[O,A];for(p=[],x=u.length;j>=0&&!T;){if(j===O)p.push(j),O=u.indexOf(n,j+1);else if(p.length===1){let n=p.pop();n!==void 0&&(T=[n,A])}else h=p.pop(),h!==void 0&&h<x&&(x=h,w=A),A=u.indexOf(c,j+1);j=O<A&&O>=0?O:A}p.length&&w!==void 0&&(T=[x,w])}return T}})),require_commonjs$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EXPANSION_MAX=void 0,n.expand=K;let c=require_commonjs$2(),u=`\0SLASH`+Math.random()+`\0`,p=`\0OPEN`+Math.random()+`\0`,h=`\0CLOSE`+Math.random()+`\0`,x=`\0COMMA`+Math.random()+`\0`,w=`\0PERIOD`+Math.random()+`\0`,T=new RegExp(u,`g`),O=new RegExp(p,`g`),A=new RegExp(h,`g`),j=new RegExp(x,`g`),N=new RegExp(w,`g`),I=/\\\\/g,L=/\\{/g,z=/\\}/g,B=/\\,/g,V=/\\\./g;n.EXPANSION_MAX=1e5;function H(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function U(n){return n.replace(I,u).replace(L,p).replace(z,h).replace(B,x).replace(V,w)}function W(n){return n.replace(T,`\\`).replace(O,`{`).replace(A,`}`).replace(j,`,`).replace(N,`.`)}function G(n){if(!n)return[``];let u=[],p=(0,c.balanced)(`{`,`}`,n);if(!p)return n.split(`,`);let{pre:h,body:x,post:w}=p,T=h.split(`,`);T[T.length-1]+=`{`+x+`}`;let O=G(w);return w.length&&(T[T.length-1]+=O.shift(),T.push.apply(T,O)),u.push.apply(u,T),u}function K(c,u={}){if(!c)return[];let{max:p=n.EXPANSION_MAX}=u;return c.slice(0,2)===`{}`&&(c=`\\{\\}`+c.slice(2)),ne(U(c),p,!0).map(W)}function ee(n){return`{`+n+`}`}function te(n){return/^-?0\d/.test(n)}function J(n,c){return n<=c}function Y(n,c){return n>=c}function ne(n,u,p){let x=[],w=(0,c.balanced)(`{`,`}`,n);if(!w)return[n];let T=w.pre,O=w.post.length?ne(w.post,u,!1):[``];if(/\$$/.test(w.pre))for(let n=0;n<O.length&&n<u;n++){let c=T+`{`+w.body+`}`+O[n];x.push(c)}else{let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(w.body),A=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(w.body),j=c||A,N=w.body.indexOf(`,`)>=0;if(!j&&!N)return w.post.match(/,(?!,).*\}/)?(n=w.pre+`{`+w.body+h+w.post,ne(n,u,!0)):[n];let I;if(j)I=w.body.split(/\.\./);else if(I=G(w.body),I.length===1&&I[0]!==void 0&&(I=ne(I[0],u,!1).map(ee),I.length===1))return O.map(n=>w.pre+I[0]+n);let L;if(j&&I[0]!==void 0&&I[1]!==void 0){let n=H(I[0]),c=H(I[1]),u=Math.max(I[0].length,I[1].length),p=I.length===3&&I[2]!==void 0?Math.max(Math.abs(H(I[2])),1):1,h=J;c<n&&(p*=-1,h=Y);let x=I.some(te);L=[];for(let w=n;h(w,c);w+=p){let n;if(A)n=String.fromCharCode(w),n===`\\`&&(n=``);else if(n=String(w),x){let c=u-n.length;if(c>0){let u=Array(c+1).join(`0`);n=w<0?`-`+u+n.slice(1):u+n}}L.push(n)}}else{L=[];for(let n=0;n<I.length;n++)L.push.apply(L,ne(I[n],u,!1))}for(let n=0;n<L.length;n++)for(let c=0;c<O.length&&x.length<u;c++){let u=T+L[n]+O[c];(!p||j||u)&&x.push(u)}}return x}})),require_assert_valid_pattern=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.assertValidPattern=void 0;let c=1024*64;n.assertValidPattern=n=>{if(typeof n!=`string`)throw TypeError(`invalid pattern`);if(n.length>65536)throw TypeError(`pattern is too long`)}})),require_brace_expressions=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseClass=void 0;let c={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},u=n=>n.replace(/[[\]\\-]/g,`\\$&`),p=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),h=n=>n.join(``);n.parseClass=(n,x)=>{let w=x;if(n.charAt(w)!==`[`)throw Error(`not in a brace expression`);let T=[],O=[],A=w+1,j=!1,N=!1,I=!1,L=!1,z=w,B=``;WHILE:for(;A<n.length;){let p=n.charAt(A);if((p===`!`||p===`^`)&&A===w+1){L=!0,A++;continue}if(p===`]`&&j&&!I){z=A+1;break}if(j=!0,p===`\\`&&!I){I=!0,A++;continue}if(p===`[`&&!I){for(let[u,[p,h,x]]of Object.entries(c))if(n.startsWith(u,A)){if(B)return[`$.`,!1,n.length-w,!0];A+=u.length,x?O.push(p):T.push(p),N||=h;continue WHILE}}if(I=!1,B){p>B?T.push(u(B)+`-`+u(p)):p===B&&T.push(u(p)),B=``,A++;continue}if(n.startsWith(`-]`,A+1)){T.push(u(p+`-`)),A+=2;continue}if(n.startsWith(`-`,A+1)){B=p,A+=2;continue}T.push(u(p)),A++}if(z<A)return[``,!1,0,!1];if(!T.length&&!O.length)return[`$.`,!1,n.length-w,!0];if(O.length===0&&T.length===1&&/^\\?.$/.test(T[0])&&!L)return[p(T[0].length===2?T[0].slice(-1):T[0]),!1,z-w,!1];let V=`[`+(L?`^`:``)+h(T)+`]`,H=`[`+(L?``:`^`)+h(O)+`]`;return[T.length&&O.length?`(`+V+`|`+H+`)`:T.length?V:H,N,z-w,!0]}})),require_unescape=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unescape=void 0,n.unescape=(n,{windowsPathsNoEscape:c=!1,magicalBraces:u=!0}={})=>u?c?n.replace(/\[([^/\\])\]/g,`$1`):n.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):c?n.replace(/\[([^/\\{}])\]/g,`$1`):n.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`)})),require_ast=__commonJSMin$1((n=>{var c;Object.defineProperty(n,`__esModule`,{value:!0}),n.AST=void 0;let u=require_brace_expressions(),p=require_unescape(),h=new Set([`!`,`?`,`+`,`*`,`@`]),x=n=>h.has(n),w=n=>x(n.type),T=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),O=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),A=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),j=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),N=`(?!(?:^|/)\\.\\.?(?:$|/))`,I=`(?!\\.)`,L=new Set([`[`,`.`]),z=new Set([`..`,`.`]),B=new Set(`().*{}+?[]^$\\!`),V=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),H=`[^/]`,U=H+`*?`,W=H+`+?`,G=0;var K=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++G;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(n,c,u={}){this.type=n,n&&(this.#t=!0),this.#i=c,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?u:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,n===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let n of this.#r)if(typeof n!=`string`&&(n.type||n.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(n=>String(n)).join(`|`)+`)`:this.#l=this.#r.map(n=>String(n)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let n;for(;n=this.#o.pop();){if(n.type!==`!`)continue;let c=n,u=c.#i;for(;u;){for(let p=c.#a+1;!u.type&&p<u.#r.length;p++)for(let c of n.#r){if(typeof c==`string`)throw Error(`string part in extglob AST??`);c.copyIn(u.#r[p])}c=u,u=c.#i}}return this}push(...n){for(let u of n)if(u!==``){if(typeof u!=`string`&&!(u instanceof c&&u.#i===this))throw Error(`invalid part: `+u);this.#r.push(u)}}toJSON(){let n=this.type===null?this.#r.slice().map(n=>typeof n==`string`?n:n.toJSON()):[this.type,...this.#r.map(n=>n.toJSON())];return this.isStart()&&!this.type&&n.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&n.push({}),n}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let n=this.#i;for(let u=0;u<this.#a;u++){let p=n.#r[u];if(!(p instanceof c&&p.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let n=this.#i?this.#i.#r.length:0;return this.#a===n-1}copyIn(n){typeof n==`string`?this.push(n):this.push(n.clone(this))}clone(n){let u=new c(this.type,n);for(let n of this.#r)u.copyIn(n);return u}static#f(n,u,p,h,w){let T=h.maxExtglobRecursion??2,O=!1,A=!1,j=-1,N=!1;if(u.type===null){let I=p,L=``;for(;I<n.length;){let p=n.charAt(I++);if(O||p===`\\`){O=!O,L+=p;continue}if(A){I===j+1?(p===`^`||p===`!`)&&(N=!0):p===`]`&&!(I===j+2&&N)&&(A=!1),L+=p;continue}else if(p===`[`){A=!0,j=I,N=!1,L+=p;continue}if(!h.noext&&x(p)&&n.charAt(I)===`(`&&w<=T){u.push(L),L=``;let x=new c(p,u);I=c.#f(n,x,I,h,w+1),u.push(x);continue}L+=p}return u.push(L),I}let I=p+1,L=new c(null,u),z=[],B=``;for(;I<n.length;){let p=n.charAt(I++);if(O||p===`\\`){O=!O,B+=p;continue}if(A){I===j+1?(p===`^`||p===`!`)&&(N=!0):p===`]`&&!(I===j+2&&N)&&(A=!1),B+=p;continue}else if(p===`[`){A=!0,j=I,N=!1,B+=p;continue}if(!h.noext&&x(p)&&n.charAt(I)===`(`&&(w<=T||u&&u.#h(p))){let x=u&&u.#h(p)?0:1;L.push(B),B=``;let T=new c(p,L);L.push(T),I=c.#f(n,T,I,h,w+x);continue}if(p===`|`){L.push(B),B=``,z.push(L),L=new c(null,u);continue}if(p===`)`)return B===``&&u.#r.length===0&&(u.#u=!0),L.push(B),B=``,u.push(...z,L),I;B+=p}return u.type=null,u.#t=void 0,u.#r=[n.substring(p-1)],I}#p(n){return this.#m(n,O)}#m(n,c=T){if(!n||typeof n!=`object`||n.type!==null||n.#r.length!==1||this.type===null)return!1;let u=n.#r[0];return!u||typeof u!=`object`||u.type===null?!1:this.#h(u.type,c)}#h(n,c=A){return!!c.get(this.type)?.includes(n)}#g(n,u){let p=n.#r[0],h=new c(null,p,this.options);h.#r.push(``),p.push(h),this.#_(n,u)}#_(n,c){let u=n.#r[0];this.#r.splice(c,1,...u.#r);for(let n of u.#r)typeof n==`object`&&(n.#i=this);this.#l=void 0}#v(n){return!!j.get(this.type)?.has(n)}#y(n){if(!n||typeof n!=`object`||n.type!==null||n.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let c=n.#r[0];return!c||typeof c!=`object`||c.type===null?!1:this.#v(c.type)}#b(n){let c=j.get(this.type),u=n.#r[0],p=c?.get(u.type);if(!p)return!1;this.#r=u.#r;for(let n of this.#r)typeof n==`object`&&(n.#i=this);this.type=p,this.#l=void 0,this.#u=!1}static fromGlob(n,u={}){let p=new c(null,void 0,u);return c.#f(n,p,0,u,0),p}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let n=this.toString(),[c,u,p,h]=this.toRegExpSource();if(!(p||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&n.toUpperCase()!==n.toLowerCase()))return u;let x=(this.#c.nocase?`i`:``)+(h?`u`:``);return Object.assign(RegExp(`^${c}$`,x),{_src:c,_glob:n})}get options(){return this.#c}toRegExpSource(n){let u=n??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!w(this)){let h=this.isStart()&&this.isEnd()&&!this.#r.some(n=>typeof n!=`string`),x=this.#r.map(u=>{let[p,x,w,T]=typeof u==`string`?c.#C(u,this.#t,h):u.toRegExpSource(n);return this.#t=this.#t||w,this.#n=this.#n||T,p}).join(``),w=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&z.has(this.#r[0]))){let c=L,p=u&&c.has(x.charAt(0))||x.startsWith(`\\.`)&&c.has(x.charAt(2))||x.startsWith(`\\.\\.`)&&c.has(x.charAt(4)),h=!u&&!n&&c.has(x.charAt(0));w=p?`(?!(?:^|/)\\.\\.?(?:$|/))`:h?I:``}let T=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(T=`(?:$|\\/)`),[w+x+T,(0,p.unescape)(x),this.#t=!!this.#t,this.#n]}let h=this.type===`*`||this.type===`+`,x=this.type===`!`?`(?:(?!(?:`:`(?:`,T=this.#S(u);if(this.isStart()&&this.isEnd()&&!T&&this.type!==`!`){let n=this.toString(),c=this;return c.#r=[n],c.type=null,c.#t=void 0,[n,(0,p.unescape)(this.toString()),!1,!1]}let O=!h||n||u?``:this.#S(!0);O===T&&(O=``),O&&(T=`(?:${T})(?:${O})*?`);let A=``;if(this.type===`!`&&this.#u)A=(this.isStart()&&!u?I:``)+W;else{let c=this.type===`!`?`))`+(this.isStart()&&!u&&!n?I:``)+U+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&O?`)`:this.type===`*`&&O?`)?`:`)${this.type}`;A=x+T+c}return[A,(0,p.unescape)(T),this.#t=!!this.#t,this.#n]}#x(){if(w(this)){let n=0,c=!1;do{c=!0;for(let n=0;n<this.#r.length;n++){let u=this.#r[n];typeof u==`object`&&(u.#x(),this.#m(u)?(c=!1,this.#_(u,n)):this.#p(u)?(c=!1,this.#g(u,n)):this.#y(u)&&(c=!1,this.#b(u)))}}while(!c&&++n<10)}else for(let n of this.#r)typeof n==`object`&&n.#x();this.#l=void 0}#S(n){return this.#r.map(c=>{if(typeof c==`string`)throw Error(`string type in extglob ast??`);let[u,p,h,x]=c.toRegExpSource(n);return this.#n=this.#n||x,u}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join(`|`)}static#C(n,c,h=!1){let x=!1,w=``,T=!1,O=!1;for(let p=0;p<n.length;p++){let A=n.charAt(p);if(x){x=!1,w+=(B.has(A)?`\\`:``)+A;continue}if(A===`*`){if(O)continue;O=!0,w+=h&&/^[*]+$/.test(n)?W:U,c=!0;continue}else O=!1;if(A===`\\`){p===n.length-1?w+=`\\\\`:x=!0;continue}if(A===`[`){let[h,x,O,A]=(0,u.parseClass)(n,p);if(O){w+=h,T||=x,p+=O-1,c||=A;continue}}if(A===`?`){w+=H,c=!0;continue}w+=V(A)}return[w,(0,p.unescape)(n),!!c,T]}};n.AST=K,c=K})),require_escape=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.escape=void 0,n.escape=(n,{windowsPathsNoEscape:c=!1,magicalBraces:u=!1}={})=>u?c?n.replace(/[?*()[\]{}]/g,`[$&]`):n.replace(/[?*()[\]\\{}]/g,`\\$&`):c?n.replace(/[?*()[\]]/g,`[$&]`):n.replace(/[?*()[\]\\]/g,`\\$&`)})),require_commonjs=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unescape=n.escape=n.AST=n.Minimatch=n.match=n.makeRe=n.braceExpand=n.defaults=n.filter=n.GLOBSTAR=n.sep=n.minimatch=void 0;let c=require_commonjs$1(),u=require_assert_valid_pattern(),p=require_ast(),h=require_escape(),x=require_unescape();n.minimatch=(n,c,p={})=>((0,u.assertValidPattern)(c),!p.nocomment&&c.charAt(0)===`#`?!1:new le(c,p).match(n));let w=/^\*+([^+@!?*[(]*)$/,T=n=>c=>!c.startsWith(`.`)&&c.endsWith(n),O=n=>c=>c.endsWith(n),A=n=>(n=n.toLowerCase(),c=>!c.startsWith(`.`)&&c.toLowerCase().endsWith(n)),j=n=>(n=n.toLowerCase(),c=>c.toLowerCase().endsWith(n)),N=/^\*+\.\*+$/,I=n=>!n.startsWith(`.`)&&n.includes(`.`),L=n=>n!==`.`&&n!==`..`&&n.includes(`.`),z=/^\.\*+$/,B=n=>n!==`.`&&n!==`..`&&n.startsWith(`.`),V=/^\*+$/,H=n=>n.length!==0&&!n.startsWith(`.`),U=n=>n.length!==0&&n!==`.`&&n!==`..`,W=/^\?+([^+@!?*[(]*)?$/,G=([n,c=``])=>{let u=J([n]);return c?(c=c.toLowerCase(),n=>u(n)&&n.toLowerCase().endsWith(c)):u},K=([n,c=``])=>{let u=Y([n]);return c?(c=c.toLowerCase(),n=>u(n)&&n.toLowerCase().endsWith(c)):u},ee=([n,c=``])=>{let u=Y([n]);return c?n=>u(n)&&n.endsWith(c):u},te=([n,c=``])=>{let u=J([n]);return c?n=>u(n)&&n.endsWith(c):u},J=([n])=>{let c=n.length;return n=>n.length===c&&!n.startsWith(`.`)},Y=([n])=>{let c=n.length;return n=>n.length===c&&n!==`.`&&n!==`..`},ne=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,re={win32:{sep:`\\`},posix:{sep:`/`}};n.sep=ne===`win32`?re.win32.sep:re.posix.sep,n.minimatch.sep=n.sep,n.GLOBSTAR=Symbol(`globstar **`),n.minimatch.GLOBSTAR=n.GLOBSTAR;let X=`[^/]*?`,ie=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,ae=`(?:(?!(?:\\/|^)\\.).)*?`;n.filter=(c,u={})=>p=>(0,n.minimatch)(p,c,u),n.minimatch.filter=n.filter;let oe=(n,c={})=>Object.assign({},n,c);n.defaults=c=>{if(!c||typeof c!=`object`||!Object.keys(c).length)return n.minimatch;let u=n.minimatch;return Object.assign((n,p,h={})=>u(n,p,oe(c,h)),{Minimatch:class extends u.Minimatch{constructor(n,u={}){super(n,oe(c,u))}static defaults(n){return u.defaults(oe(c,n)).Minimatch}},AST:class extends u.AST{constructor(n,u,p={}){super(n,u,oe(c,p))}static fromGlob(n,p={}){return u.AST.fromGlob(n,oe(c,p))}},unescape:(n,p={})=>u.unescape(n,oe(c,p)),escape:(n,p={})=>u.escape(n,oe(c,p)),filter:(n,p={})=>u.filter(n,oe(c,p)),defaults:n=>u.defaults(oe(c,n)),makeRe:(n,p={})=>u.makeRe(n,oe(c,p)),braceExpand:(n,p={})=>u.braceExpand(n,oe(c,p)),match:(n,p,h={})=>u.match(n,p,oe(c,h)),sep:u.sep,GLOBSTAR:n.GLOBSTAR})},n.minimatch.defaults=n.defaults,n.braceExpand=(n,p={})=>((0,u.assertValidPattern)(n),p.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,c.expand)(n,{max:p.braceExpandMax})),n.minimatch.braceExpand=n.braceExpand,n.makeRe=(n,c={})=>new le(n,c).makeRe(),n.minimatch.makeRe=n.makeRe,n.match=(n,c,u={})=>{let p=new le(c,u);return n=n.filter(n=>p.match(n)),p.options.nonull&&!n.length&&n.push(c),n},n.minimatch.match=n.match;let se=/[?*]|[+@!]\(.*?\)|\[|\]/,ce=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var le=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(n,c={}){(0,u.assertValidPattern)(n),c||={},this.options=c,this.maxGlobstarRecursion=c.maxGlobstarRecursion??200,this.pattern=n,this.platform=c.platform||ne,this.isWindows=this.platform===`win32`;let p=`allowWindowsEscape`;this.windowsPathsNoEscape=!!c.windowsPathsNoEscape||c.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!c.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!c.nonegate,this.comment=!1,this.empty=!1,this.partial=!!c.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=c.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):c.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let n of this.set)for(let c of n)if(typeof c!=`string`)return!0;return!1}debug(...n){}make(){let n=this.pattern,c=this.options;if(!c.nocomment&&n.charAt(0)===`#`){this.comment=!0;return}if(!n){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],c.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let u=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(u),this.debug(this.pattern,this.globParts);let p=this.globParts.map((n,c,u)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=n[0]===``&&n[1]===``&&(n[2]===`?`||!se.test(n[2]))&&!se.test(n[3]),u=/^[a-z]:/i.test(n[0]);if(c)return[...n.slice(0,4),...n.slice(4).map(n=>this.parse(n))];if(u)return[n[0],...n.slice(1).map(n=>this.parse(n))]}return n.map(n=>this.parse(n))});if(this.debug(this.pattern,p),this.set=p.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let c=this.set[n];c[0]===``&&c[1]===``&&this.globParts[n][2]===`?`&&typeof c[3]==`string`&&/^[a-z]:$/i.test(c[3])&&(c[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(n){if(this.options.noglobstar)for(let c of n)for(let n=0;n<c.length;n++)c[n]===`**`&&(c[n]=`*`);let{optimizationLevel:c=1}=this.options;return c>=2?(n=this.firstPhasePreProcess(n),n=this.secondPhasePreProcess(n)):n=c>=1?this.levelOneOptimize(n):this.adjascentGlobstarOptimize(n),n}adjascentGlobstarOptimize(n){return n.map(n=>{let c=-1;for(;(c=n.indexOf(`**`,c+1))!==-1;){let u=c;for(;n[u+1]===`**`;)u++;u!==c&&n.splice(c,u-c)}return n})}levelOneOptimize(n){return n.map(n=>(n=n.reduce((n,c)=>{let u=n[n.length-1];return c===`**`&&u===`**`?n:c===`..`&&u&&u!==`..`&&u!==`.`&&u!==`**`?(n.pop(),n):(n.push(c),n)},[]),n.length===0?[``]:n))}levelTwoFileOptimize(n){Array.isArray(n)||(n=this.slashSplit(n));let c=!1;do{if(c=!1,!this.preserveMultipleSlashes){for(let u=1;u<n.length-1;u++){let p=n[u];u===1&&p===``&&n[0]===``||(p===`.`||p===``)&&(c=!0,n.splice(u,1),u--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(c=!0,n.pop())}let u=0;for(;(u=n.indexOf(`..`,u+1))!==-1;){let p=n[u-1];p&&p!==`.`&&p!==`..`&&p!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(p))&&(c=!0,n.splice(u-1,2),u-=2)}}while(c);return n.length===0?[``]:n}firstPhasePreProcess(n){let c=!1;do{c=!1;for(let u of n){let p=-1;for(;(p=u.indexOf(`**`,p+1))!==-1;){let h=p;for(;u[h+1]===`**`;)h++;h>p&&u.splice(p+1,h-p);let x=u[p+1],w=u[p+2],T=u[p+3];if(x!==`..`||!w||w===`.`||w===`..`||!T||T===`.`||T===`..`)continue;c=!0,u.splice(p,1);let O=u.slice(0);O[p]=`**`,n.push(O),p--}if(!this.preserveMultipleSlashes){for(let n=1;n<u.length-1;n++){let p=u[n];n===1&&p===``&&u[0]===``||(p===`.`||p===``)&&(c=!0,u.splice(n,1),n--)}u[0]===`.`&&u.length===2&&(u[1]===`.`||u[1]===``)&&(c=!0,u.pop())}let h=0;for(;(h=u.indexOf(`..`,h+1))!==-1;){let n=u[h-1];if(n&&n!==`.`&&n!==`..`&&n!==`**`){c=!0;let n=h===1&&u[h+1]===`**`?[`.`]:[];u.splice(h-1,2,...n),u.length===0&&u.push(``),h-=2}}}}while(c);return n}secondPhasePreProcess(n){for(let c=0;c<n.length-1;c++)for(let u=c+1;u<n.length;u++){let p=this.partsMatch(n[c],n[u],!this.preserveMultipleSlashes);if(p){n[c]=[],n[u]=p;break}}return n.filter(n=>n.length)}partsMatch(n,c,u=!1){let p=0,h=0,x=[],w=``;for(;p<n.length&&h<c.length;)if(n[p]===c[h])x.push(w===`b`?c[h]:n[p]),p++,h++;else if(u&&n[p]===`**`&&c[h]===n[p+1])x.push(n[p]),p++;else if(u&&c[h]===`**`&&n[p]===c[h+1])x.push(c[h]),h++;else if(n[p]===`*`&&c[h]&&(this.options.dot||!c[h].startsWith(`.`))&&c[h]!==`**`){if(w===`b`)return!1;w=`a`,x.push(n[p]),p++,h++}else if(c[h]===`*`&&n[p]&&(this.options.dot||!n[p].startsWith(`.`))&&n[p]!==`**`){if(w===`a`)return!1;w=`b`,x.push(c[h]),p++,h++}else return!1;return n.length===c.length&&x}parseNegate(){if(this.nonegate)return;let n=this.pattern,c=!1,u=0;for(let p=0;p<n.length&&n.charAt(p)===`!`;p++)c=!c,u++;u&&(this.pattern=n.slice(u)),this.negate=c}matchOne(c,u,p=!1){let h=0,x=0;if(this.isWindows){let n=typeof c[0]==`string`&&/^[a-z]:$/i.test(c[0]),p=!n&&c[0]===``&&c[1]===``&&c[2]===`?`&&/^[a-z]:$/i.test(c[3]),w=typeof u[0]==`string`&&/^[a-z]:$/i.test(u[0]),T=!w&&u[0]===``&&u[1]===``&&u[2]===`?`&&typeof u[3]==`string`&&/^[a-z]:$/i.test(u[3]),O=p?3:n?0:void 0,A=T?3:w?0:void 0;if(typeof O==`number`&&typeof A==`number`){let[n,p]=[c[O],u[A]];n.toLowerCase()===p.toLowerCase()&&(u[A]=n,x=A,h=O)}}let{optimizationLevel:w=1}=this.options;return w>=2&&(c=this.levelTwoFileOptimize(c)),u.includes(n.GLOBSTAR)?this.#e(c,u,p,h,x):this.#n(c,u,p,h,x)}#e(c,u,p,h,x){let w=u.indexOf(n.GLOBSTAR,x),T=u.lastIndexOf(n.GLOBSTAR),[O,A,j]=p?[u.slice(x,w),u.slice(w+1),[]]:[u.slice(x,w),u.slice(w+1,T),u.slice(T+1)];if(O.length){let n=c.slice(h,h+O.length);if(!this.#n(n,O,p,0,0))return!1;h+=O.length,x+=O.length}let N=0;if(j.length){if(j.length+h>c.length)return!1;let n=c.length-j.length;if(this.#n(c,j,p,n,0))N=j.length;else{if(c[c.length-1]!==``||h+j.length===c.length||(n--,!this.#n(c,j,p,n,0)))return!1;N=j.length+1}}if(!A.length){let n=!!N;for(let u=h;u<c.length-N;u++){let p=String(c[u]);if(n=!0,p===`.`||p===`..`||!this.options.dot&&p.startsWith(`.`))return!1}return p||n}let I=[[[],0]],L=I[0],z=0,B=[0];for(let c of A)c===n.GLOBSTAR?(B.push(z),L=[[],0],I.push(L)):(L[0].push(c),z++);let V=I.length-1,H=c.length-N;for(let n of I)n[1]=H-(B[V--]+n[0].length);return!!this.#t(c,I,h,0,p,0,!!N)}#t(n,c,u,p,h,x,w){let T=c[p];if(!T){for(let c=u;c<n.length;c++){w=!0;let u=n[c];if(u===`.`||u===`..`||!this.options.dot&&u.startsWith(`.`))return!1}return w}let[O,A]=T;for(;u<=A;){if(this.#n(n.slice(0,u+O.length),O,h,u,0)&&x<this.maxGlobstarRecursion){let T=this.#t(n,c,u+O.length,p+1,h,x+1,w);if(T!==!1)return T}let T=n[u];if(T===`.`||T===`..`||!this.options.dot&&T.startsWith(`.`))return!1;u++}return h||null}#n(c,u,p,h,x){let w,T,O,A;for(w=h,T=x,A=c.length,O=u.length;w<A&&T<O;w++,T++){this.debug(`matchOne loop`);let p=u[T],h=c[w];if(this.debug(u,p,h),p===!1||p===n.GLOBSTAR)return!1;let x;if(typeof p==`string`?(x=h===p,this.debug(`string match`,p,h,x)):(x=p.test(h),this.debug(`pattern match`,p,h,x)),!x)return!1}if(w===A&&T===O)return!0;if(w===A)return p;if(T===O)return w===A-1&&c[w]===``;throw Error(`wtf?`)}braceExpand(){return(0,n.braceExpand)(this.pattern,this.options)}parse(c){(0,u.assertValidPattern)(c);let h=this.options;if(c===`**`)return n.GLOBSTAR;if(c===``)return``;let x,J=null;(x=c.match(V))?J=h.dot?U:H:(x=c.match(w))?J=(h.nocase?h.dot?j:A:h.dot?O:T)(x[1]):(x=c.match(W))?J=(h.nocase?h.dot?K:G:h.dot?ee:te)(x):(x=c.match(N))?J=h.dot?L:I:(x=c.match(z))&&(J=B);let Y=p.AST.fromGlob(c,this.options).toMMPattern();return J&&typeof Y==`object`&&Reflect.defineProperty(Y,`test`,{value:J}),Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let c=this.set;if(!c.length)return this.regexp=!1,this.regexp;let u=this.options,p=u.noglobstar?`[^/]*?`:u.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,h=new Set(u.nocase?[`i`]:[]),x=c.map(c=>{let u=c.map(c=>{if(c instanceof RegExp)for(let n of c.flags.split(``))h.add(n);return typeof c==`string`?ce(c):c===n.GLOBSTAR?n.GLOBSTAR:c._src});u.forEach((c,h)=>{let x=u[h+1],w=u[h-1];c!==n.GLOBSTAR||w===n.GLOBSTAR||(w===void 0?x!==void 0&&x!==n.GLOBSTAR?u[h+1]=`(?:\\/|`+p+`\\/)?`+x:u[h]=p:x===void 0?u[h-1]=w+`(?:\\/|\\/`+p+`)?`:x!==n.GLOBSTAR&&(u[h-1]=w+`(?:\\/|\\/`+p+`\\/)`+x,u[h+1]=n.GLOBSTAR))});let x=u.filter(c=>c!==n.GLOBSTAR);if(this.partial&&x.length>=1){let n=[];for(let c=1;c<=x.length;c++)n.push(x.slice(0,c).join(`/`));return`(?:`+n.join(`|`)+`)`}return x.join(`/`)}).join(`|`),[w,T]=c.length>1?[`(?:`,`)`]:[``,``];x=`^`+w+x+T+`$`,this.partial&&(x=`^(?:\\/|`+w+x.slice(1,-1)+T+`)$`),this.negate&&(x=`^(?!`+x+`).+$`);try{this.regexp=new RegExp(x,[...h].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(n){return this.preserveMultipleSlashes?n.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(n)?[``,...n.split(/\/+/)]:n.split(/\/+/)}match(n,c=this.partial){if(this.debug(`match`,n,this.pattern),this.comment)return!1;if(this.empty)return n===``;if(n===`/`&&c)return!0;let u=this.options;this.isWindows&&(n=n.split(`\\`).join(`/`));let p=this.slashSplit(n);this.debug(this.pattern,`split`,p);let h=this.set;this.debug(this.pattern,`set`,h);let x=p[p.length-1];if(!x)for(let n=p.length-2;!x&&n>=0;n--)x=p[n];for(let n of h){let h=p;if(u.matchBase&&n.length===1&&(h=[x]),this.matchOne(h,n,c))return u.flipNegate?!0:!this.negate}return u.flipNegate?!1:this.negate}static defaults(c){return n.minimatch.defaults(c).Minimatch}};n.Minimatch=le;var ue=require_ast();Object.defineProperty(n,`AST`,{enumerable:!0,get:function(){return ue.AST}});var de=require_escape();Object.defineProperty(n,`escape`,{enumerable:!0,get:function(){return de.escape}});var fe=require_unescape();Object.defineProperty(n,`unescape`,{enumerable:!0,get:function(){return fe.unescape}}),n.minimatch.AST=p.AST,n.minimatch.Minimatch=le,n.minimatch.escape=h.escape,n.minimatch.unescape=x.unescape})),require_otel=__commonJSMin$1(((n,c)=>{let u=__require(`node:diagnostics_channel`),{context:p,trace:h,SpanStatusCode:x,propagation:w,diag:T}=(init_esm$2(),__toCommonJS(esm_exports$2)),{getRPCMetadata:O,RPCType:A}=require_src$46(),{ATTR_HTTP_ROUTE:j,ATTR_HTTP_RESPONSE_STATUS_CODE:N,ATTR_HTTP_REQUEST_METHOD:I,ATTR_URL_PATH:L}=(init_esm$1(),__toCommonJS(esm_exports$1)),{InstrumentationBase:z}=require_src$44(),{version:B,name:V}=require_package(),H=`>=4.0.0 <6`,U=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],W={HOOK_NAME:`hook.name`,FASTIFY_TYPE:`fastify.type`,HOOK_CALLBACK_NAME:`hook.callback.name`,ROOT:`fastify.root`},G={ROUTE:`route-hook`,INSTANCE:`hook`,HANDLER:`request-handler`},K=`anonymous`,ee=Symbol(`fastify otel instance`),te=Symbol(`fastify otel request spans`),J=Symbol(`fastify otel request context`),Y=Symbol(`fastify otel addhook original`),ne=Symbol(`fastify otel setnotfound original`),re=Symbol(`fastify otel ignore path`),X=Symbol(`fastify otel record exceptions`);var ie=class extends z{logger=null;_requestHook=null;_lifecycleHook=null;constructor(n){if(super(V,B,n),this.logger=T.createComponentLogger({namespace:V}),this[re]=null,this[X]=!0,n?.recordExceptions!=null){if(typeof n.recordExceptions!=`boolean`)throw TypeError(`recordExceptions must be a boolean`);this[X]=n.recordExceptions}if(typeof n?.requestHook==`function`&&(this._requestHook=n.requestHook),typeof n?.lifecycleHook==`function`&&(this._lifecycleHook=n.lifecycleHook),n?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let c=n?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof c!=`string`||c.length===0)&&typeof c!=`function`)throw TypeError(`ignorePaths must be a string or a function`);let u=null;this[re]=n=>typeof c==`function`?c(n):(u??=require_commonjs().minimatch,u(n.url,c))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=n=>{this.plugin()(n.fastify,void 0,()=>{});let c=(n,c,u)=>{u()};c[Symbol.for(`skip-override`)]=!0,c[Symbol.for(`fastify.display-name`)]=`@fastify/otel`,n.fastify.register(c)},u.subscribe(`fastify.initialization`,this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&=(u.unsubscribe(`fastify.initialization`,this._handleInitialization),void 0),super.disable()}init(){return[]}plugin(){let n=this;return c[Symbol.for(`skip-override`)]=!0,c[Symbol.for(`fastify.display-name`)]=`@fastify/otel`,c[Symbol.for(`plugin-meta`)]={fastify:`>=4.0.0 <6`,name:`@fastify/otel`},c;function c(c,u,T){c.decorate(ee,n),c.decorate(Y,c.addHook),c.decorate(ne,c.setNotFoundHandler),c.decorateRequest(`opentelemetry`,function(){let c=this[J],u=this[te];return{enabled:this.routeOptions.config?.otel!==!1,span:u,tracer:n.tracer,context:c,inject:(n,u)=>w.inject(c,n,u),extract:(n,u)=>w.extract(c,n,u)}}),c.decorateRequest(te,null),c.decorateRequest(J,null),c.addHook(`onRoute`,function(c){if(n[re]?.(c)===!0){n.logger.debug(`Ignoring route instrumentation ${c.method} ${c.url} because it matches the ignore path`);return}if(c.config?.otel===!1){n.logger.debug(`Ignoring route instrumentation ${c.method} ${c.url} because it is disabled`);return}for(let n of U)if(c[n]!=null){let u=c[n];if(typeof u==`function`)c[n]=ae(u,n,{[W.HOOK_NAME]:`${this.pluginName} - route -> ${n}`,[W.FASTIFY_TYPE]:G.ROUTE,[j]:c.url,[W.HOOK_CALLBACK_NAME]:u.name?.length>0?u.name:K});else if(Array.isArray(u)){let p=[];for(let h of u)p.push(ae(h,n,{[W.HOOK_NAME]:`${this.pluginName} - route -> ${n}`,[W.FASTIFY_TYPE]:G.ROUTE,[j]:c.url,[W.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:K}));c[n]=p}}c.onSend==null?c.onSend=z:c.onSend=Array.isArray(c.onSend)?[...c.onSend,z]:[c.onSend,z],c.onError==null?c.onError=B:c.onError=Array.isArray(c.onError)?[...c.onError,B]:[c.onError,B],c.handler=ae(c.handler,`handler`,{[W.HOOK_NAME]:`${this.pluginName} - route-handler`,[W.FASTIFY_TYPE]:G.HANDLER,[j]:c.url,[W.HOOK_CALLBACK_NAME]:c.handler.name.length>0?c.handler.name:K})}),c.addHook(`onRequest`,function(n,c,u){if(this[ee].isEnabled()===!1||n.routeOptions.config?.otel===!1)return u();if(this[ee][re]?.({url:n.url,method:n.method})===!0)return this[ee].logger.debug(`Ignoring request ${n.method} ${n.url} because it matches the ignore path`),u();let x=p.active();h.getSpan(x)??(x=w.extract(x,n.headers));let T=O(x);n.routeOptions.url!=null&&T?.type===A.HTTP&&(T.route=n.routeOptions.url);let N={[W.ROOT]:`@fastify/otel`,[I]:n.method,[L]:n.url};n.routeOptions.url!=null&&(N[j]=n.routeOptions.url);let z=this[ee].tracer.startSpan(`request`,{attributes:N},x);try{this[ee]._requestHook?.(z,n)}catch(n){this[ee].logger.error({err:n},`requestHook threw`)}n[J]=h.setSpan(x,z),n[te]=z,p.with(n[J],()=>{u()})}),c.addHook(`onResponse`,function(n,c,u){let p=n[te];p!=null&&(p.setAttributes({[N]:c.statusCode}),p.end()),n[te]=null,u()}),c.addHook=V,c.setNotFoundHandler=H,T();function z(n,c,u,p){let h=n[te];h!=null&&(c.statusCode>=500&&h.setStatus({code:x.ERROR}),h.setAttributes({[N]:c.statusCode}),h.end()),n[te]=null,p(null,u)}function B(c,u,p,h){let w=c[te];w!=null&&(w.setStatus({code:x.ERROR,message:p.message}),n[X]!==!1&&w.recordException(p)),h()}function V(n,c){let u=this[Y];return U.includes(n)?u.call(this,n,ae(c,n,{[W.HOOK_NAME]:`${this.pluginName} - ${n}`,[W.FASTIFY_TYPE]:G.INSTANCE,[W.HOOK_CALLBACK_NAME]:c.name?.length>0?c.name:K})):u.call(this,n,c)}function H(n,c){let u=this[ne];typeof n==`function`?(c=ae(n,`notFoundHandler`,{[W.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[W.FASTIFY_TYPE]:G.INSTANCE,[W.HOOK_CALLBACK_NAME]:n.name?.length>0?n.name:K}),u.call(this,c)):(n.preValidation!=null&&(n.preValidation=ae(n.preValidation,`notFoundHandler - preValidation`,{[W.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[W.FASTIFY_TYPE]:G.INSTANCE,[W.HOOK_CALLBACK_NAME]:n.preValidation.name?.length>0?n.preValidation.name:K})),n.preHandler!=null&&(n.preHandler=ae(n.preHandler,`notFoundHandler - preHandler`,{[W.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[W.FASTIFY_TYPE]:G.INSTANCE,[W.HOOK_CALLBACK_NAME]:n.preHandler.name?.length>0?n.preHandler.name:K})),c=ae(c,`notFoundHandler`,{[W.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[W.FASTIFY_TYPE]:G.INSTANCE,[W.HOOK_CALLBACK_NAME]:c.name?.length>0?c.name:K}),u.call(this,n,c))}function ie(n){for(let c of n)if(c?.routeOptions&&c.url&&c.method)return c;return null}function ae(n,c,u={}){return function(...w){let T=this[ee],O=ie(w);if(O===null)return T.logger.debug(`Ignoring route instrumentation because ${c} was called without a Fastify request argument`),n.call(this,...w);if(T.isEnabled()===!1||O.routeOptions.config?.otel===!1)return T.logger.debug(`Ignoring route instrumentation ${O.routeOptions.method} ${O.routeOptions.url} because it is disabled`),n.call(this,...w);if(T[re]?.({url:O.url,method:O.method})===!0)return T.logger.debug(`Ignoring route instrumentation ${O.routeOptions.method} ${O.routeOptions.url} because it matches the ignore path`),n.call(this,...w);let A=O[J]??p.active(),j=n.name?.length>0?n.name:this.pluginName??K,N=T.tracer.startSpan(`${c} - ${j}`,{attributes:u},A);if(T._lifecycleHook!=null)try{T._lifecycleHook(N,{hookName:c,request:O,handler:j})}catch(n){T.logger.error({err:n},`Execution of lifecycleHook failed`)}return p.with(h.setSpan(A,N),function(){try{let c=n.call(this,...w);return typeof c?.then==`function`?c.then(n=>(N.end(),n),n=>(N.setStatus({code:x.ERROR,message:n.message}),T[X]!==!1&&N.recordException(n),N.end(),Promise.reject(n))):(N.end(),c)}catch(n){throw N.setStatus({code:x.ERROR,message:n.message}),T[X]!==!1&&N.recordException(n),N.end(),n}},this)}}}}};c.exports=ie,c.exports.FastifyOtelInstrumentation=ie})),AttributeNames$1;(function(n){n.FASTIFY_NAME=`fastify.name`,n.FASTIFY_TYPE=`fastify.type`,n.HOOK_NAME=`hook.name`,n.PLUGIN_NAME=`plugin.name`})(AttributeNames$1||={});var FastifyTypes;(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request_handler`})(FastifyTypes||={});var FastifyNames;(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request handler`})(FastifyNames||={});const spanRequestSymbol=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`);init_esm$2();function startSpan(n,c,u,p={}){let h=c.startSpan(u,{attributes:p}),x=n[spanRequestSymbol]||[];return x.push(h),Object.defineProperty(n,spanRequestSymbol,{enumerable:!1,configurable:!0,value:x}),h}function endSpan$2(n,c){let u=n[spanRequestSymbol]||[];u.length&&(u.forEach(n=>{c&&(n.setStatus({code:SpanStatusCode.ERROR,message:c.message}),n.recordException(c)),n.end()}),delete n[spanRequestSymbol])}function safeExecuteInTheMiddleMaybePromise(n,c,u){let p,h;try{h=n(),isPromise(h)&&h.then(n=>c(void 0,n),n=>c(n))}catch(n){p=n}finally{if(!isPromise(h)&&(c(p,h),p))throw p;return h}}function isPromise(n){return typeof n==`object`&&n&&typeof Object.getOwnPropertyDescriptor(n,`then`)?.value==`function`||!1}init_esm$2(),init_esm$1();const PACKAGE_VERSION$3=`0.1.0`,PACKAGE_NAME$3=`@sentry/instrumentation-fastify-v3`,ANONYMOUS_NAME=`anonymous`,hooksNamesToWrap=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]);var FastifyInstrumentationV3=class extends import_src$35.InstrumentationBase{constructor(n={}){super(PACKAGE_NAME$3,PACKAGE_VERSION$3,n)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`fastify`,[`>=3.0.0 <4`],n=>this._patchConstructor(n))]}_hookOnRequest(){let n=this;return function(c,u,p){if(!n.isEnabled())return p();n._wrap(u,`send`,n._patchSend());let h=c,x=(0,import_src$31.getRPCMetadata)(context$1.active()),w=h.routeOptions?h.routeOptions.url:c.routerPath;w&&x?.type===import_src$31.RPCType.HTTP&&(x.route=w);let T=c.method||`GET`;getIsolationScope().setTransactionName(`${T} ${w}`),p()}}_wrapHandler(n,c,u,p){let h=this;return this._diag.debug(`Patching fastify route.handler function`),function(...x){if(!h.isEnabled())return u.apply(this,x);let w=u.name||n||ANONYMOUS_NAME,T=`${FastifyNames.MIDDLEWARE} - ${w}`,O=x[1],A=startSpan(O,h.tracer,T,{[AttributeNames$1.FASTIFY_TYPE]:FastifyTypes.MIDDLEWARE,[AttributeNames$1.PLUGIN_NAME]:n,[AttributeNames$1.HOOK_NAME]:c}),j=p&&x[x.length-1];return j&&(x[x.length-1]=function(...n){endSpan$2(O),j.apply(this,n)}),context$1.with(trace.setSpan(context$1.active(),A),()=>safeExecuteInTheMiddleMaybePromise(()=>u.apply(this,x),n=>{n instanceof Error&&(A.setStatus({code:SpanStatusCode.ERROR,message:n.message}),A.recordException(n)),p||endSpan$2(O)}))}}_wrapAddHook(){let n=this;return this._diag.debug(`Patching fastify server.addHook function`),function(c){return function(...u){let p=u[0],h=u[1],x=this.pluginName;if(!hooksNamesToWrap.has(p))return c.apply(this,u);let w=typeof u[u.length-1]==`function`&&h.constructor.name!==`AsyncFunction`;return c.apply(this,[p,n._wrapHandler(x,p,h,w)])}}}_patchConstructor(n){let c=this;function u(...u){let p=n.fastify.apply(this,u);return p.addHook(`onRequest`,c._hookOnRequest()),p.addHook(`preHandler`,c._hookPreHandler()),instrumentClient$1(),c._wrap(p,`addHook`,c._wrapAddHook()),p}return n.errorCodes!==void 0&&(u.errorCodes=n.errorCodes),u.fastify=u,u.default=u,u}_patchSend(){let n=this;return this._diag.debug(`Patching fastify reply.send function`),function(c){return function(...u){let p=u[0];return n.isEnabled()?(0,import_src$35.safeExecuteInTheMiddle)(()=>c.apply(this,u),n=>{!n&&p instanceof Error&&(n=p),endSpan$2(this,n)}):c.apply(this,u)}}}_hookPreHandler(){let n=this;return this._diag.debug(`Patching fastify preHandler function`),function(c,u,p){if(!n.isEnabled())return p();let h=c,x=h.routeOptions?.handler||h.context?.handler,w=x?.name.startsWith(`bound `)?x.name.substring(6):x?.name,T=`${FastifyNames.REQUEST_HANDLER} - ${w||this.pluginName||ANONYMOUS_NAME}`,O={[AttributeNames$1.PLUGIN_NAME]:this.pluginName,[AttributeNames$1.FASTIFY_TYPE]:FastifyTypes.REQUEST_HANDLER,[SEMATTRS_HTTP_ROUTE]:h.routeOptions?h.routeOptions.url:c.routerPath};w&&(O[AttributeNames$1.FASTIFY_NAME]=w);let A=startSpan(u,n.tracer,T,O);addFastifyV3SpanAttributes(A);let{requestHook:j}=n.getConfig();return j&&(0,import_src$35.safeExecuteInTheMiddle)(()=>j(A,{request:c}),c=>{c&&n._diag.error(`request hook failed`,c)},!0),context$1.with(trace.setSpan(context$1.active(),A),()=>{p()})}}};function instrumentClient$1(){let n=getClient();n&&n.on(`spanStart`,n=>{addFastifyV3SpanAttributes(n)})}function addFastifyV3SpanAttributes(n){let c=spanToJSON(n).data,u=c[`fastify.type`];if(c[`sentry.op`]||!u)return;n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.fastify`,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`${u}.fastify`});let p=c[`fastify.name`]||c[`plugin.name`]||c[`hook.name`];if(typeof p==`string`){let c=p.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);n.updateName(c)}}var import_otel=require_otel();const INTEGRATION_NAME$20=`Fastify`,instrumentFastifyV3=generateInstrumentOnce(`${INTEGRATION_NAME$20}.v3`,()=>new FastifyInstrumentationV3);function getFastifyIntegration(){let n=getClient();if(n)return n.getIntegrationByName(INTEGRATION_NAME$20)}function handleFastifyError(n,c,u,p){let h=getFastifyIntegration()?.getShouldHandleError()||defaultShouldHandleError;if(p===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&p===`onError-hook`){DEBUG_BUILD&&debug.warn(`Fastify error handler was already registered via diagnostics channel.`,"You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}h(n,c,u)&&captureException(n,{mechanism:{handled:!1,type:`auto.function.fastify`}})}const instrumentFastify=generateInstrumentOnce(`${INTEGRATION_NAME$20}.v5`,()=>{let n=new import_otel.FastifyOtelInstrumentation,c=n.plugin();return diagnosticsChannel.subscribe(`fastify.initialization`,n=>{let u=n.fastify;u?.register(c).after(n=>{n?DEBUG_BUILD&&debug.error(`Failed to setup Fastify instrumentation`,n):(instrumentClient(),u&&instrumentOnRequest(u))})}),diagnosticsChannel.subscribe(`tracing:fastify.request.handler:error`,n=>{let{error:c,request:u,reply:p}=n;handleFastifyError.call(handleFastifyError,c,u,p,`diagnostics-channel`)}),n}),_fastifyIntegration=(({shouldHandleError:n})=>{let c;return{name:INTEGRATION_NAME$20,setupOnce(){c=n||defaultShouldHandleError,instrumentFastifyV3(),instrumentFastify()},getShouldHandleError(){return c},setShouldHandleError(n){c=n}}}),fastifyIntegration=defineIntegration((n={})=>_fastifyIntegration(n));function defaultShouldHandleError(n,c,u){let p=u.statusCode;return p>=500||p<=299}function addFastifySpanAttributes(n){let c=spanToJSON(n),u=c.description,p=c.data,h=p[`fastify.type`],x=h===`hook`,w=h===u?.startsWith(`handler -`),T=u===`request`||h===`request-handler`;if(p[`sentry.op`]||!w&&!T&&!x)return;let O=x?`hook`:w?`middleware`:T?`request_handler`:`<unknown>`;n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.fastify`,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`${O}.fastify`});let A=p[`fastify.name`]||p[`plugin.name`]||p[`hook.name`];if(typeof A==`string`){let c=A.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);n.updateName(c)}}function instrumentClient(){let n=getClient();n&&n.on(`spanStart`,n=>{addFastifySpanAttributes(n)})}function instrumentOnRequest(n){n.addHook(`onRequest`,async(n,c)=>{if(n.opentelemetry){let{span:c}=n.opentelemetry();c&&addFastifySpanAttributes(c)}let u=n.routeOptions?.url,p=n.method||`GET`;getIsolationScope().setTransactionName(`${p} ${u}`)})}var require_enum=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanNames=n.TokenKind=n.AllowedOperationTypes=void 0,(function(n){n.QUERY=`query`,n.MUTATION=`mutation`,n.SUBSCRIPTION=`subscription`})(n.AllowedOperationTypes||={}),(function(n){n.SOF=`<SOF>`,n.EOF=`<EOF>`,n.BANG=`!`,n.DOLLAR=`$`,n.AMP=`&`,n.PAREN_L=`(`,n.PAREN_R=`)`,n.SPREAD=`...`,n.COLON=`:`,n.EQUALS=`=`,n.AT=`@`,n.BRACKET_L=`[`,n.BRACKET_R=`]`,n.BRACE_L=`{`,n.PIPE=`|`,n.BRACE_R=`}`,n.NAME=`Name`,n.INT=`Int`,n.FLOAT=`Float`,n.STRING=`String`,n.BLOCK_STRING=`BlockString`,n.COMMENT=`Comment`})(n.TokenKind||={}),(function(n){n.EXECUTE=`graphql.execute`,n.PARSE=`graphql.parse`,n.RESOLVE=`graphql.resolve`,n.VALIDATE=`graphql.validate`,n.SCHEMA_VALIDATE=`graphql.validateSchema`,n.SCHEMA_PARSE=`graphql.parseSchema`})(n.SpanNames||={})})),require_AttributeNames$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.SOURCE=`graphql.source`,n.FIELD_NAME=`graphql.field.name`,n.FIELD_PATH=`graphql.field.path`,n.FIELD_TYPE=`graphql.field.type`,n.PARENT_NAME=`graphql.parent.name`,n.OPERATION_TYPE=`graphql.operation.type`,n.OPERATION_NAME=`graphql.operation.name`,n.VARIABLES=`graphql.variables.`,n.ERROR_VALIDATION_NAME=`graphql.validation.error`})(n.AttributeNames||={})})),require_symbols=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.OTEL_GRAPHQL_DATA_SYMBOL=n.OTEL_PATCHED_SYMBOL=void 0,n.OTEL_PATCHED_SYMBOL=Symbol.for(`opentelemetry.patched`),n.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for(`opentelemetry.graphql_data`)})),require_internal_types$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.OPERATION_NOT_SUPPORTED=void 0,require_symbols(),n.OPERATION_NOT_SUPPORTED=`Operation$operationName$not supported`})),require_utils$32=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.wrapFieldResolver=n.wrapFields=n.getSourceFromLocation=n.getOperation=n.endSpan=n.addSpanSource=n.addInputVariableAttributes=n.isPromise=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_enum(),p=require_AttributeNames$5(),h=require_symbols(),x=Object.values(u.AllowedOperationTypes);n.isPromise=n=>typeof n?.then==`function`;let w=n=>typeof n==`object`&&!!n;function T(n,c,u){Array.isArray(u)?u.forEach((u,p)=>{T(n,`${c}.${p}`,u)}):u instanceof Object?Object.entries(u).forEach(([u,p])=>{T(n,`${c}.${u}`,p)}):n.setAttribute(`${p.AttributeNames.VARIABLES}${String(c)}`,u)}function O(n,c){Object.entries(c).forEach(([c,u])=>{T(n,c,u)})}n.addInputVariableAttributes=O;function A(n,c,u,h,x){let w=te(c,u,h,x);n.setAttribute(p.AttributeNames.SOURCE,w)}n.addSpanSource=A;function j(n,c,u,p,h){let x=B(u,h);return x?{field:x,spanAdded:!1}:(x={span:N(n,c,u,p,h,c().flatResolveSpans?H(u):V(u,h))},z(u,h,x),{field:x,spanAdded:!0})}function N(n,x,w,T,O,j){let N={[p.AttributeNames.FIELD_NAME]:T.fieldName,[p.AttributeNames.FIELD_PATH]:O.join(`.`),[p.AttributeNames.FIELD_TYPE]:T.returnType.toString(),[p.AttributeNames.PARENT_NAME]:T.parentType.name},I=n.startSpan(`${u.SpanNames.RESOLVE} ${N[p.AttributeNames.FIELD_PATH]}`,{attributes:N},j?c.trace.setSpan(c.context.active(),j):void 0),L=w[h.OTEL_GRAPHQL_DATA_SYMBOL].source,z=T.fieldNodes.find(n=>n.kind===`Field`);return z&&A(I,L.loc,x().allowValues,z.loc?.start,z.loc?.end),I}function I(n,c){c&&n.recordException(c),n.end()}n.endSpan=I;function L(n,c){if(!(!n||!Array.isArray(n.definitions)))return c?n.definitions.filter(n=>x.indexOf(n?.operation)!==-1).find(n=>c===n?.name?.value):n.definitions.find(n=>x.indexOf(n?.operation)!==-1)}n.getOperation=L;function z(n,c,u){return n[h.OTEL_GRAPHQL_DATA_SYMBOL].fields[c.join(`.`)]=u}function B(n,c){return n[h.OTEL_GRAPHQL_DATA_SYMBOL].fields[c.join(`.`)]}function V(n,c){for(let u=c.length-1;u>0;u--){let p=B(n,c.slice(0,u));if(p)return p.span}return H(n)}function H(n){return n[h.OTEL_GRAPHQL_DATA_SYMBOL].span}function U(n,c){let u=[],p=c;for(;p;){let c=p.key;n&&typeof c==`number`&&(c=`*`),u.push(String(c)),p=p.prev}return u.reverse()}function W(n){return K(`
|
|
77
|
-
`,n)}function G(n){return K(` `,n)}function K(n,c){let u=``;for(let p=0;p<c;p++)u+=n;return u}let ee=[u.TokenKind.FLOAT,u.TokenKind.STRING,u.TokenKind.INT,u.TokenKind.BLOCK_STRING];function te(n,c=!1,p,h){let x=``;if(n?.startToken){let w=typeof p==`number`?p:n.start,T=typeof h==`number`?h:n.end,O=n.startToken.next,A=1;for(;O;){if(O.start<w){O=O.next,A=O?.line;continue}if(O.end>T){O=O.next,A=O?.line;continue}let n=O.value||O.kind,p=``;!c&&ee.indexOf(O.kind)>=0&&(n=`*`),O.kind===u.TokenKind.STRING&&(n=`"${n}"`),O.kind===u.TokenKind.EOF&&(n=``),O.line>A?(x+=W(O.line-A),A=O.line,p=G(O.column-1)):O.line===O.prev?.line&&(p=G(O.start-(O.prev?.end||0))),x+=p+n,O&&=O.next}}return x}n.getSourceFromLocation=te;function J(n,c,u){if(!n||n[h.OTEL_PATCHED_SYMBOL])return;let p=n.getFields();n[h.OTEL_PATCHED_SYMBOL]=!0,Object.keys(p).forEach(n=>{let h=p[n];if(h&&(h.resolve&&=ae(c,u,h.resolve),h.type)){let n=Y(h.type);for(let p of n)J(p,c,u)}})}n.wrapFields=J;function Y(n){return`ofType`in n?Y(n.ofType):ne(n)?n.getTypes():re(n)?[n]:[]}function ne(n){return`getTypes`in n&&typeof n.getTypes==`function`}function re(n){return`getFields`in n&&typeof n.getFields==`function`}let X=(n,u,p)=>{p&&(n.recordException(u),n.setStatus({code:c.SpanStatusCode.ERROR,message:u.message}),n.end())},ie=(n,c)=>{c&&n.end()};function ae(u,p,x,T=!1){if(O[h.OTEL_PATCHED_SYMBOL]||typeof x!=`function`)return x;function O(O,A,N,I){if(!x)return;let L=p();if(L.ignoreTrivialResolveSpans&&T&&(w(O)||typeof O==`function`)&&typeof O[I.fieldName]!=`function`||!N[h.OTEL_GRAPHQL_DATA_SYMBOL])return x.call(this,O,A,N,I);let z=U(L.mergeItems,I&&I.path),B=z.filter(n=>typeof n==`string`).length,H,W=!1;if(L.depth>=0&&L.depth<B)H=V(N,z);else{let{field:n,spanAdded:c}=j(u,p,N,I,z);H=n.span,W=c}return c.context.with(c.trace.setSpan(c.context.active(),H),()=>{try{let c=x.call(this,O,A,N,I);return(0,n.isPromise)(c)?c.then(n=>(ie(H,W),n),n=>{throw X(H,n,W),n}):(ie(H,W),c)}catch(n){throw X(H,n,W),n}})}return O[h.OTEL_PATCHED_SYMBOL]=!0,O}n.wrapFieldResolver=ae})),require_version$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.62.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-graphql`})),require_instrumentation$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GraphQLInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_enum(),h=require_AttributeNames$5(),x=require_symbols(),w=require_internal_types$7(),T=require_utils$32(),O=require_version$25(),A={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},j=[`>=14.0.0 <17`];n.GraphQLInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(O.PACKAGE_NAME,O.PACKAGE_VERSION,{...A,...n})}setConfig(n={}){super.setConfig({...A,...n})}init(){let n=new u.InstrumentationNodeModuleDefinition(`graphql`,j);return n.files.push(this._addPatchingExecute()),n.files.push(this._addPatchingParser()),n.files.push(this._addPatchingValidate()),n}_addPatchingExecute(){return new u.InstrumentationNodeModuleFile(`graphql/execution/execute.js`,j,n=>((0,u.isWrapped)(n.execute)&&this._unwrap(n,`execute`),this._wrap(n,`execute`,this._patchExecute(n.defaultFieldResolver)),n),n=>{n&&this._unwrap(n,`execute`)})}_addPatchingParser(){return new u.InstrumentationNodeModuleFile(`graphql/language/parser.js`,j,n=>((0,u.isWrapped)(n.parse)&&this._unwrap(n,`parse`),this._wrap(n,`parse`,this._patchParse()),n),n=>{n&&this._unwrap(n,`parse`)})}_addPatchingValidate(){return new u.InstrumentationNodeModuleFile(`graphql/validation/validate.js`,j,n=>((0,u.isWrapped)(n.validate)&&this._unwrap(n,`validate`),this._wrap(n,`validate`,this._patchValidate()),n),n=>{n&&this._unwrap(n,`validate`)})}_patchExecute(n){let p=this;return function(h){return function(){let w;if(arguments.length>=2){let c=arguments;w=p._wrapExecuteArgs(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],n)}else{let c=arguments[0];w=p._wrapExecuteArgs(c.schema,c.document,c.rootValue,c.contextValue,c.variableValues,c.operationName,c.fieldResolver,c.typeResolver,n)}let O=(0,T.getOperation)(w.document,w.operationName),A=p._createExecuteSpan(O,w);return w.contextValue[x.OTEL_GRAPHQL_DATA_SYMBOL]={source:w.document?w.document||w.document[x.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:A,fields:{}},c.context.with(c.trace.setSpan(c.context.active(),A),()=>(0,u.safeExecuteInTheMiddle)(()=>h.apply(this,[w]),(n,c)=>{p._handleExecutionResult(A,n,c)}))}}}_handleExecutionResult(n,c,u){let p=this.getConfig();if(u===void 0||c){(0,T.endSpan)(n,c);return}if((0,T.isPromise)(u))u.then(c=>{if(typeof p.responseHook!=`function`){(0,T.endSpan)(n);return}this._executeResponseHook(n,c)},c=>{(0,T.endSpan)(n,c)});else{if(typeof p.responseHook!=`function`){(0,T.endSpan)(n);return}this._executeResponseHook(n,u)}}_executeResponseHook(n,c){let{responseHook:p}=this.getConfig();p&&(0,u.safeExecuteInTheMiddle)(()=>{p(n,c)},c=>{c&&this._diag.error(`Error running response hook`,c),(0,T.endSpan)(n,void 0)},!0)}_patchParse(){let n=this;return function(c){return function(u,p){return n._parse(this,c,u,p)}}}_patchValidate(){let n=this;return function(c){return function(u,p,h,x,w){return n._validate(this,c,u,p,h,w,x)}}}_parse(n,h,x,w){let O=this.getConfig(),A=this.tracer.startSpan(p.SpanNames.PARSE);return c.context.with(c.trace.setSpan(c.context.active(),A),()=>(0,u.safeExecuteInTheMiddle)(()=>h.call(n,x,w),(n,c)=>{c&&((0,T.getOperation)(c)?c.loc&&(0,T.addSpanSource)(A,c.loc,O.allowValues):A.updateName(p.SpanNames.SCHEMA_PARSE)),(0,T.endSpan)(A,n)}))}_validate(n,x,w,O,A,j,N){let I=this.tracer.startSpan(p.SpanNames.VALIDATE,{});return c.context.with(c.trace.setSpan(c.context.active(),I),()=>(0,u.safeExecuteInTheMiddle)(()=>x.call(n,w,O,A,N,j),(n,c)=>{O.loc||I.updateName(p.SpanNames.SCHEMA_VALIDATE),c&&c.length&&I.recordException({name:h.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(c)}),(0,T.endSpan)(I,n)}))}_createExecuteSpan(n,c){let u=this.getConfig(),x=this.tracer.startSpan(p.SpanNames.EXECUTE,{});if(n){let{operation:c,name:u}=n;x.setAttribute(h.AttributeNames.OPERATION_TYPE,c);let p=u?.value;p?(x.setAttribute(h.AttributeNames.OPERATION_NAME,p),x.updateName(`${c} ${p}`)):x.updateName(c)}else{let n=` `;c.operationName&&(n=` "${c.operationName}" `),n=w.OPERATION_NOT_SUPPORTED.replace(`$operationName$`,n),x.setAttribute(h.AttributeNames.OPERATION_NAME,n)}return c.document?.loc&&(0,T.addSpanSource)(x,c.document.loc,u.allowValues),c.variableValues&&u.allowValues&&(0,T.addInputVariableAttributes)(x,c.variableValues),x}_wrapExecuteArgs(n,c,u,p,h,w,O,A,j){if(p||={},p[x.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:n,document:c,rootValue:u,contextValue:p,variableValues:h,operationName:w,fieldResolver:O,typeResolver:A};let N=O==null,I=O??j;return O=(0,T.wrapFieldResolver)(this.tracer,()=>this.getConfig(),I,N),n&&((0,T.wrapFields)(n.getQueryType(),this.tracer,()=>this.getConfig()),(0,T.wrapFields)(n.getMutationType(),this.tracer,()=>this.getConfig())),{schema:n,document:c,rootValue:u,contextValue:p,variableValues:h,operationName:w,fieldResolver:O,typeResolver:A}}}})),require_src$43=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GraphQLInstrumentation=void 0;var c=require_instrumentation$15();Object.defineProperty(n,`GraphQLInstrumentation`,{enumerable:!0,get:function(){return c.GraphQLInstrumentation}})}));init_esm$2();var import_src$30=require_src$43();const INTEGRATION_NAME$19=`Graphql`,instrumentGraphql=generateInstrumentOnce(INTEGRATION_NAME$19,import_src$30.GraphQLInstrumentation,n=>{let c=getOptionsWithDefaults(n);return{...c,responseHook(n,u){addOriginToSpan(n,`auto.graphql.otel.graphql`),u.errors?.length&&!spanToJSON(n).status&&n.setStatus({code:SpanStatusCode.ERROR});let p=spanToJSON(n).data,h=p[`graphql.operation.type`],x=p[`graphql.operation.name`];if(c.useOperationNameForRootSpan&&h){let c=getRootSpan(n),u=spanToJSON(c).data[`sentry.graphql.operation`]||[],p=x?`${h} ${x}`:`${h}`;Array.isArray(u)?(u.push(p),c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,u)):typeof u==`string`?c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,[u,p]):c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,p),spanToJSON(c).data[`original-description`]||c.setAttribute(`original-description`,spanToJSON(c).description),c.updateName(`${spanToJSON(c).data[`original-description`]} (${getGraphqlOperationNamesFromAttribute(u)})`)}}}}),_graphqlIntegration=((n={})=>({name:INTEGRATION_NAME$19,setupOnce(){instrumentGraphql(getOptionsWithDefaults(n))}})),graphqlIntegration=defineIntegration(_graphqlIntegration);function getOptionsWithDefaults(n){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...n}}function getGraphqlOperationNamesFromAttribute(n){if(Array.isArray(n)){let c=n.slice().sort();return c.length<=5?c.join(`, `):`${c.slice(0,5).join(`, `)}, +${c.length-5}`}return`${n}`}var require_internal_types$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EVENT_LISTENERS_SET=void 0,n.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.kafkajs.eventListenersSet`)})),require_propagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.bufferTextMapGetter=void 0,n.bufferTextMapGetter={get(n,c){if(!n)return;let u=Object.keys(n);for(let p of u)if(p===c||p.toLowerCase()===c)return n[p]?.toString()},keys(n){return n?Object.keys(n):[]}}})),require_semconv$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_MESSAGING_PROCESS_DURATION=n.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=n.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=n.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=n.MESSAGING_SYSTEM_VALUE_KAFKA=n.MESSAGING_OPERATION_TYPE_VALUE_SEND=n.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=n.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=n.ATTR_MESSAGING_SYSTEM=n.ATTR_MESSAGING_OPERATION_TYPE=n.ATTR_MESSAGING_OPERATION_NAME=n.ATTR_MESSAGING_KAFKA_OFFSET=n.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=n.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=n.ATTR_MESSAGING_DESTINATION_PARTITION_ID=n.ATTR_MESSAGING_DESTINATION_NAME=n.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0,n.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=`messaging.batch.message_count`,n.ATTR_MESSAGING_DESTINATION_NAME=`messaging.destination.name`,n.ATTR_MESSAGING_DESTINATION_PARTITION_ID=`messaging.destination.partition.id`,n.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=`messaging.kafka.message.key`,n.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=`messaging.kafka.message.tombstone`,n.ATTR_MESSAGING_KAFKA_OFFSET=`messaging.kafka.offset`,n.ATTR_MESSAGING_OPERATION_NAME=`messaging.operation.name`,n.ATTR_MESSAGING_OPERATION_TYPE=`messaging.operation.type`,n.ATTR_MESSAGING_SYSTEM=`messaging.system`,n.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=`process`,n.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=`receive`,n.MESSAGING_OPERATION_TYPE_VALUE_SEND=`send`,n.MESSAGING_SYSTEM_VALUE_KAFKA=`kafka`,n.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=`messaging.client.consumed.messages`,n.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=`messaging.client.operation.duration`,n.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=`messaging.client.sent.messages`,n.METRIC_MESSAGING_PROCESS_DURATION=`messaging.process.duration`})),require_version$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.23.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-kafkajs`})),require_instrumentation$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KafkaJsInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_internal_types$6(),x=require_propagator(),w=require_semconv$24(),T=require_version$24();function O(n,c,u){return h=>{n.add(c,{...u,...h?{[p.ATTR_ERROR_TYPE]:h}:{}})}}function A(n,c,u){return h=>{n.record((Date.now()-c)/1e3,{...u,...h?{[p.ATTR_ERROR_TYPE]:h}:{}})}}let j=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10];n.KafkaJsInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(w.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:j}}),this._sentMessages=this.meter.createCounter(w.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(w.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(w.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:j}})}init(){let n=n=>{(0,u.isWrapped)(n?.Kafka?.prototype.producer)&&this._unwrap(n.Kafka.prototype,`producer`),(0,u.isWrapped)(n?.Kafka?.prototype.consumer)&&this._unwrap(n.Kafka.prototype,`consumer`)};return new u.InstrumentationNodeModuleDefinition(`kafkajs`,[`>=0.3.0 <3`],c=>(n(c),this._wrap(c?.Kafka?.prototype,`producer`,this._getProducerPatch()),this._wrap(c?.Kafka?.prototype,`consumer`,this._getConsumerPatch()),c),n)}_getConsumerPatch(){let n=this;return c=>function(...p){let h=c.apply(this,p);return(0,u.isWrapped)(h.run)&&n._unwrap(h,`run`),n._wrap(h,`run`,n._getConsumerRunPatch()),n._setKafkaEventListeners(h),h}}_setKafkaEventListeners(n){n[h.EVENT_LISTENERS_SET]||(n.events?.REQUEST&&n.on(n.events.REQUEST,this._recordClientDurationMetric.bind(this)),n[h.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(n){let[c,u]=n.payload.broker.split(`:`);this._clientDuration.record(n.payload.duration/1e3,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`${n.payload.apiName}`,[p.ATTR_SERVER_ADDRESS]:c,[p.ATTR_SERVER_PORT]:Number.parseInt(u,10)})}_getProducerPatch(){let n=this;return c=>function(...p){let h=c.apply(this,p);return(0,u.isWrapped)(h.sendBatch)&&n._unwrap(h,`sendBatch`),n._wrap(h,`sendBatch`,n._getSendBatchPatch()),(0,u.isWrapped)(h.send)&&n._unwrap(h,`send`),n._wrap(h,`send`,n._getSendPatch()),(0,u.isWrapped)(h.transaction)&&n._unwrap(h,`transaction`),n._wrap(h,`transaction`,n._getProducerTransactionPatch()),n._setKafkaEventListeners(h),h}}_getConsumerRunPatch(){let n=this;return c=>function(...p){let h=p[0];return h?.eachMessage&&((0,u.isWrapped)(h.eachMessage)&&n._unwrap(h,`eachMessage`),n._wrap(h,`eachMessage`,n._getConsumerEachMessagePatch())),h?.eachBatch&&((0,u.isWrapped)(h.eachBatch)&&n._unwrap(h,`eachBatch`),n._wrap(h,`eachBatch`,n._getConsumerEachBatchPatch())),c.call(this,h)}}_getConsumerEachMessagePatch(){let n=this;return u=>function(...p){let h=p[0],T=c.propagation.extract(c.ROOT_CONTEXT,h.message.headers,x.bufferTextMapGetter),j=n._startConsumerSpan({topic:h.topic,message:h.message,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:T,attributes:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)}}),N=[A(n._processDuration,Date.now(),{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)}),O(n._consumedMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)})],I=c.context.with(c.trace.setSpan(T,j),()=>u.apply(this,p));return n._endSpansOnPromise([j],N,I)}}_getConsumerEachBatchPatch(){return n=>{let u=this;return function(...p){let h=p[0],T=u._startConsumerSpan({topic:h.batch.topic,message:void 0,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:c.ROOT_CONTEXT,attributes:{[w.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:h.batch.messages.length,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}});return c.context.with(c.trace.setSpan(c.context.active(),T),()=>{let j=Date.now(),N=[],I=[O(u._consumedMessages,h.batch.messages.length,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.batch.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)})];h.batch.messages.forEach(n=>{let p=c.propagation.extract(c.ROOT_CONTEXT,n.headers,x.bufferTextMapGetter),T=c.trace.getSpan(p)?.spanContext(),O;T&&(O={context:T}),N.push(u._startConsumerSpan({topic:h.batch.topic,message:n,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:O,attributes:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}})),I.push(A(u._processDuration,j,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.batch.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}))});let L=n.apply(this,p);return N.unshift(T),u._endSpansOnPromise(N,I,L)})}}}_getProducerTransactionPatch(){let n=this;return u=>function(...p){let h=n.tracer.startSpan(`transaction`),x=u.apply(this,p);return x.then(u=>{let p=u.send;u.send=function(...u){return c.context.with(c.trace.setSpan(c.context.active(),h),()=>n._getSendPatch()(p).apply(this,u).catch(n=>{throw h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),n}))};let x=u.sendBatch;u.sendBatch=function(...u){return c.context.with(c.trace.setSpan(c.context.active(),h),()=>n._getSendBatchPatch()(x).apply(this,u).catch(n=>{throw h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),n}))};let w=u.commit;u.commit=function(...u){let p=w.apply(this,u).then(()=>{h.setStatus({code:c.SpanStatusCode.OK})});return n._endSpansOnPromise([h],[],p)};let T=u.abort;u.abort=function(...c){let u=T.apply(this,c);return n._endSpansOnPromise([h],[],u)}}).catch(n=>{h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),h.end()}),x}}_getSendBatchPatch(){let n=this;return c=>function(...u){let p=u[0].topicMessages||[],h=[],x=[];p.forEach(c=>{c.messages.forEach(u=>{h.push(n._startProducerSpan(c.topic,u)),x.push(O(n._sentMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_DESTINATION_NAME]:c.topic,...u.partition===void 0?{}:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(u.partition)}}))})});let T=c.apply(this,u);return n._endSpansOnPromise(h,x,T)}}_getSendPatch(){let n=this;return c=>function(...u){let p=u[0],h=p.messages.map(c=>n._startProducerSpan(p.topic,c)),x=p.messages.map(c=>O(n._sentMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...c.partition===void 0?{}:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(c.partition)}})),T=c.apply(this,u);return n._endSpansOnPromise(h,x,T)}}_endSpansOnPromise(n,u,h){return Promise.resolve(h).then(n=>(u.forEach(n=>n()),n)).catch(h=>{let x,w=p.ERROR_TYPE_VALUE_OTHER;throw typeof h==`string`||h===void 0?x=h:typeof h==`object`&&Object.prototype.hasOwnProperty.call(h,`message`)&&(x=h.message,w=h.constructor.name),u.forEach(n=>n(w)),n.forEach(n=>{n.setAttribute(p.ATTR_ERROR_TYPE,w),n.setStatus({code:c.SpanStatusCode.ERROR,message:x})}),h}).finally(()=>{n.forEach(n=>n.end())})}_startConsumerSpan({topic:n,message:p,operationType:h,ctx:x,link:T,attributes:O}){let A=h===w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?`poll`:h,j=this.tracer.startSpan(`${A} ${n}`,{kind:h===w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?c.SpanKind.CLIENT:c.SpanKind.CONSUMER,attributes:{...O,[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_DESTINATION_NAME]:n,[w.ATTR_MESSAGING_OPERATION_TYPE]:h,[w.ATTR_MESSAGING_OPERATION_NAME]:A,[w.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:p?.key?String(p.key):void 0,[w.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:p?.key&&p.value===null?!0:void 0,[w.ATTR_MESSAGING_KAFKA_OFFSET]:p?.offset},links:T?[T]:[]},x),{consumerHook:N}=this.getConfig();return N&&p&&(0,u.safeExecuteInTheMiddle)(()=>N(j,{topic:n,message:p}),n=>{n&&this._diag.error(`consumerHook error`,n)},!0),j}_startProducerSpan(n,p){let h=this.tracer.startSpan(`send ${n}`,{kind:c.SpanKind.PRODUCER,attributes:{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_DESTINATION_NAME]:n,[w.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:p.key?String(p.key):void 0,[w.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:p.key&&p.value===null?!0:void 0,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:p.partition===void 0?void 0:String(p.partition),[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_OPERATION_TYPE]:w.MESSAGING_OPERATION_TYPE_VALUE_SEND}});p.headers=p.headers??{},c.propagation.inject(c.trace.setSpan(c.context.active(),h),p.headers);let{producerHook:x}=this.getConfig();return x&&(0,u.safeExecuteInTheMiddle)(()=>x(h,{topic:n,message:p}),n=>{n&&this._diag.error(`producerHook error`,n)},!0),h}}})),require_src$42=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KafkaJsInstrumentation=void 0;var c=require_instrumentation$14();Object.defineProperty(n,`KafkaJsInstrumentation`,{enumerable:!0,get:function(){return c.KafkaJsInstrumentation}})})),import_src$29=require_src$42();const INTEGRATION_NAME$18=`Kafka`,instrumentKafka=generateInstrumentOnce(INTEGRATION_NAME$18,()=>new import_src$29.KafkaJsInstrumentation({consumerHook(n){addOriginToSpan(n,`auto.kafkajs.otel.consumer`)},producerHook(n){addOriginToSpan(n,`auto.kafkajs.otel.producer`)}})),_kafkaIntegration=(()=>({name:INTEGRATION_NAME$18,setupOnce(){instrumentKafka()}})),kafkaIntegration=defineIntegration(_kafkaIntegration);var require_version$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.58.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-lru-memoizer`})),require_instrumentation$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LruMemoizerInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_version$23();n.LruMemoizerInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(p.PACKAGE_NAME,p.PACKAGE_VERSION,n)}init(){return[new u.InstrumentationNodeModuleDefinition(`lru-memoizer`,[`>=1.3 <4`],n=>{let u=function(){let u=n.apply(this,arguments);return function(){let n=[...arguments],p=n.pop(),h=typeof p==`function`?c.context.bind(c.context.active(),p):p;return n.push(h),u.apply(this,n)}};return u.sync=n.sync,u},void 0)]}}})),require_src$41=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LruMemoizerInstrumentation=void 0;var c=require_instrumentation$13();Object.defineProperty(n,`LruMemoizerInstrumentation`,{enumerable:!0,get:function(){return c.LruMemoizerInstrumentation}})})),import_src$28=require_src$41();const INTEGRATION_NAME$17=`LruMemoizer`,instrumentLruMemoizer=generateInstrumentOnce(INTEGRATION_NAME$17,()=>new import_src$28.LruMemoizerInstrumentation),_lruMemoizerIntegration=(()=>({name:INTEGRATION_NAME$17,setupOnce(){instrumentLruMemoizer()}})),lruMemoizerIntegration=defineIntegration(_lruMemoizerIntegration);var require_semconv$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=n.DB_SYSTEM_VALUE_MONGODB=n.DB_SYSTEM_NAME_VALUE_MONGODB=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_OPERATION=n.ATTR_DB_NAME=n.ATTR_DB_MONGODB_COLLECTION=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_OPERATION=`db.operation`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`,n.DB_SYSTEM_VALUE_MONGODB=`mongodb`,n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),require_internal_types$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=void 0,(function(n){n.CREATE_INDEXES=`createIndexes`,n.FIND_AND_MODIFY=`findAndModify`,n.IS_MASTER=`isMaster`,n.COUNT=`count`,n.AGGREGATE=`aggregate`,n.UNKNOWN=`unknown`})(n.MongodbCommandType||={})})),require_version$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.67.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mongodb`})),require_instrumentation$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongoDBInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$23(),x=require_internal_types$5(),w=require_version$22(),T={requireParentSpan:!0};n.MongoDBInstrumentation=class n extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,{...T,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...T,...n})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(h.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(n,c,u){this._connectionsUsage?.add(n,{"pool.name":c,state:u})}init(){let{v3PatchConnection:n,v3UnpatchConnection:c}=this._getV3ConnectionPatches(),{v4PatchConnect:p,v4UnpatchConnect:h}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:x,v4PatchConnectionPromise:w,v4UnpatchConnection:T}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:O,v4UnpatchConnectionPool:A}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:j,v4UnpatchSessions:N}=this._getV4SessionsPatches();return[new u.InstrumentationNodeModuleDefinition(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new u.InstrumentationNodeModuleFile(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],n,c)]),new u.InstrumentationNodeModuleDefinition(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],x,T),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],w,T),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],O,A),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connect.js`,[`>=4.0.0 <8`],p,h),new u.InstrumentationNodeModuleFile(`mongodb/lib/sessions.js`,[`>=4.0.0 <8`],j,N)])]}_getV3ConnectionPatches(){return{v3PatchConnection:n=>((0,u.isWrapped)(n.insert)&&this._unwrap(n,`insert`),this._wrap(n,`insert`,this._getV3PatchOperation(`insert`)),(0,u.isWrapped)(n.remove)&&this._unwrap(n,`remove`),this._wrap(n,`remove`,this._getV3PatchOperation(`remove`)),(0,u.isWrapped)(n.update)&&this._unwrap(n,`update`),this._wrap(n,`update`,this._getV3PatchOperation(`update`)),(0,u.isWrapped)(n.command)&&this._unwrap(n,`command`),this._wrap(n,`command`,this._getV3PatchCommand()),(0,u.isWrapped)(n.query)&&this._unwrap(n,`query`),this._wrap(n,`query`,this._getV3PatchFind()),(0,u.isWrapped)(n.getMore)&&this._unwrap(n,`getMore`),this._wrap(n,`getMore`,this._getV3PatchCursor()),n),v3UnpatchConnection:n=>{n!==void 0&&(this._unwrap(n,`insert`),this._unwrap(n,`remove`),this._unwrap(n,`update`),this._unwrap(n,`command`),this._unwrap(n,`query`),this._unwrap(n,`getMore`))}}}_getV4SessionsPatches(){return{v4PatchSessions:n=>((0,u.isWrapped)(n.acquire)&&this._unwrap(n,`acquire`),this._wrap(n.ServerSessionPool.prototype,`acquire`,this._getV4AcquireCommand()),(0,u.isWrapped)(n.release)&&this._unwrap(n,`release`),this._wrap(n.ServerSessionPool.prototype,`release`,this._getV4ReleaseCommand()),n),v4UnpatchSessions:n=>{n!==void 0&&((0,u.isWrapped)(n.acquire)&&this._unwrap(n,`acquire`),(0,u.isWrapped)(n.release)&&this._unwrap(n,`release`))}}}_getV4AcquireCommand(){let n=this;return c=>function(){let u=this.sessions.length,p=c.call(this),h=this.sessions.length;return u===h?n._connCountAdd(1,n._poolName,`used`):u-1===h&&(n._connCountAdd(-1,n._poolName,`idle`),n._connCountAdd(1,n._poolName,`used`)),p}}_getV4ReleaseCommand(){let n=this;return c=>function(u){let p=c.call(this,u);return n._connCountAdd(-1,n._poolName,`used`),n._connCountAdd(1,n._poolName,`idle`),p}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:n=>{let c=n.ConnectionPool.prototype;return(0,u.isWrapped)(c.checkOut)&&this._unwrap(c,`checkOut`),this._wrap(c,`checkOut`,this._getV4ConnectionPoolCheckOut()),n},v4UnpatchConnectionPool:n=>{n!==void 0&&this._unwrap(n.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectPatches(){return{v4PatchConnect:n=>((0,u.isWrapped)(n.connect)&&this._unwrap(n,`connect`),this._wrap(n,`connect`,this._getV4ConnectCommand()),n),v4UnpatchConnect:n=>{n!==void 0&&this._unwrap(n,`connect`)}}}_getV4ConnectionPoolCheckOut(){return n=>function(u){let p=c.context.bind(c.context.active(),u);return n.call(this,p)}}_getV4ConnectCommand(){let n=this;return c=>function(u,p){if(c.length===1){let p=c.call(this,u);return p&&typeof p.then==`function`&&p.then(()=>n.setPoolName(u),()=>void 0),p}return c.call(this,u,function(c,h){if(c||!h){p(c,h);return}n.setPoolName(u),p(c,h)})}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:n=>((0,u.isWrapped)(n.Connection.prototype.command)&&this._unwrap(n.Connection.prototype,`command`),this._wrap(n.Connection.prototype,`command`,this._getV4PatchCommandCallback()),n),v4PatchConnectionPromise:n=>((0,u.isWrapped)(n.Connection.prototype.command)&&this._unwrap(n.Connection.prototype,`command`),this._wrap(n.Connection.prototype,`command`,this._getV4PatchCommandPromise()),n),v4UnpatchConnection:n=>{n!==void 0&&this._unwrap(n.Connection.prototype,`command`)}}}_getV3PatchOperation(n){let u=this;return p=>function(h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=u._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`||typeof w!=`object`)return typeof T==`function`?p.call(this,h,x,w,T):p.call(this,h,x,w,T,O);let I=u._getV3SpanAttributes(x,h,w[0],n),L=u._spanNameFromAttrs(I),z=u.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=u._patchEnd(z,N);return typeof T==`function`?p.call(this,h,x,w,B):p.call(this,h,x,w,T,B)}}_getV3PatchCommand(){let u=this;return p=>function(h,w,T,O,A){let j=c.trace.getSpan(c.context.active()),N=u._checkSkipInstrumentation(j),I=typeof O==`function`?O:A;if(N||typeof I!=`function`||typeof T!=`object`)return typeof O==`function`?p.call(this,h,w,T,O):p.call(this,h,w,T,O,A);let L=n._getCommandType(T),z=L===x.MongodbCommandType.UNKNOWN?void 0:L,B=u._getV3SpanAttributes(w,h,T,z),V=u._spanNameFromAttrs(B),H=u.tracer.startSpan(V,{kind:c.SpanKind.CLIENT,attributes:B}),U=u._patchEnd(H,I);return typeof O==`function`?p.call(this,h,w,T,U):p.call(this,h,w,T,O,U)}}_getV4PatchCommandCallback(){let n=this;return u=>function(p,h,x,w){let T=c.trace.getSpan(c.context.active()),O=n._checkSkipInstrumentation(T),A=w,j=Object.keys(h)[0];if(typeof h!=`object`||h.ismaster||h.hello)return u.call(this,p,h,x,w);let N;if(!O){let u=n._getV4SpanAttributes(this,p,h,j),x=n._spanNameFromAttrs(u);N=n.tracer.startSpan(x,{kind:c.SpanKind.CLIENT,attributes:u})}let I=n._patchEnd(N,A,this.id,j);return u.call(this,p,h,x,I)}}_getV4PatchCommandPromise(){let n=this;return u=>function(...p){let[h,x]=p,w=c.trace.getSpan(c.context.active()),T=n._checkSkipInstrumentation(w),O=Object.keys(x)[0],A=()=>void 0;if(typeof x!=`object`||x.ismaster||x.hello)return u.apply(this,p);let j;if(!T){let u=n._getV4SpanAttributes(this,h,x,O),p=n._spanNameFromAttrs(u);j=n.tracer.startSpan(p,{kind:c.SpanKind.CLIENT,attributes:u})}let N=n._patchEnd(j,A,this.id,O),I=u.apply(this,p);return I.then(n=>N(null,n),n=>N(n)),I}}_getV3PatchFind(){let n=this;return u=>function(p,h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=n._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`||typeof x!=`object`)return typeof T==`function`?u.call(this,p,h,x,w,T):u.call(this,p,h,x,w,T,O);let I=n._getV3SpanAttributes(h,p,x,`find`),L=n._spanNameFromAttrs(I),z=n.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=n._patchEnd(z,N);return typeof T==`function`?u.call(this,p,h,x,w,B):u.call(this,p,h,x,w,T,B)}}_getV3PatchCursor(){let n=this;return u=>function(p,h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=n._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`)return typeof T==`function`?u.call(this,p,h,x,w,T):u.call(this,p,h,x,w,T,O);let I=n._getV3SpanAttributes(h,p,x.cmd,`getMore`),L=n._spanNameFromAttrs(I),z=n.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=n._patchEnd(z,N);return typeof T==`function`?u.call(this,p,h,x,w,B):u.call(this,p,h,x,w,T,B)}}static _getCommandType(n){return n.createIndexes===void 0?n.findandmodify===void 0?n.ismaster===void 0?n.count===void 0?n.aggregate===void 0?x.MongodbCommandType.UNKNOWN:x.MongodbCommandType.AGGREGATE:x.MongodbCommandType.COUNT:x.MongodbCommandType.IS_MASTER:x.MongodbCommandType.FIND_AND_MODIFY:x.MongodbCommandType.CREATE_INDEXES}_getV4SpanAttributes(n,c,u,p){let h,x;if(n){let c=typeof n.address==`string`?n.address.split(`:`):``;c.length===2&&(h=c[0],x=c[1])}let w;return w=u?.documents&&u.documents[0]?u.documents[0]:u?.cursors?u.cursors:u,this._getSpanAttributes(c.db,c.collection,h,x,w,p)}_getV3SpanAttributes(n,c,u,p){let h,x;if(c&&c.s&&(h=c.s.options?.host??c.s.host,x=(c.s.options?.port??c.s.port)?.toString(),h==null||x==null)){let n=c.description?.address;if(n){let c=n.split(`:`);h=c[0],x=c[1]}}let[w,T]=n.toString().split(`.`),O=u?.query??u?.q??u;return this._getSpanAttributes(w,T,h,x,O,p)}_getSpanAttributes(n,c,x,w,T,O){let A={};if(this._dbSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_DB_SYSTEM]=h.DB_SYSTEM_VALUE_MONGODB,A[h.ATTR_DB_NAME]=n,A[h.ATTR_DB_MONGODB_COLLECTION]=c,A[h.ATTR_DB_OPERATION]=O,A[h.ATTR_DB_CONNECTION_STRING]=`mongodb://${x}:${w}/${n}`),this._dbSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_DB_SYSTEM_NAME]=h.DB_SYSTEM_NAME_VALUE_MONGODB,A[p.ATTR_DB_NAMESPACE]=n,A[p.ATTR_DB_OPERATION_NAME]=O,A[p.ATTR_DB_COLLECTION_NAME]=c),x&&w){this._netSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_NET_PEER_NAME]=x),this._netSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_SERVER_ADDRESS]=x);let n=parseInt(w,10);isNaN(n)||(this._netSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_NET_PEER_PORT]=n),this._netSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_SERVER_PORT]=n))}if(T){let{dbStatementSerializer:n}=this.getConfig(),c=typeof n==`function`?n:this._defaultDbStatementSerializer.bind(this);(0,u.safeExecuteInTheMiddle)(()=>{let n=c(T);this._dbSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_DB_STATEMENT]=n),this._dbSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_DB_QUERY_TEXT]=n)},n=>{n&&this._diag.error(`Error running dbStatementSerializer hook`,n)},!0)}return A}_spanNameFromAttrs(n){let c;return c=this._dbSemconvStability&u.SemconvStability.STABLE?[n[p.ATTR_DB_OPERATION_NAME],n[p.ATTR_DB_COLLECTION_NAME]].filter(n=>n).join(` `)||h.DB_SYSTEM_NAME_VALUE_MONGODB:`mongodb.${n[h.ATTR_DB_OPERATION]||`command`}`,c}_getDefaultDbStatementReplacer(){let n=new WeakSet;return(c,u)=>typeof u!=`object`||!u?`?`:n.has(u)?`[Circular]`:(n.add(u),u)}_defaultDbStatementSerializer(n){let{enhancedDatabaseReporting:c}=this.getConfig();return c?JSON.stringify(n):JSON.stringify(n,this._getDefaultDbStatementReplacer())}_handleExecutionResult(n,c){let{responseHook:p}=this.getConfig();typeof p==`function`&&(0,u.safeExecuteInTheMiddle)(()=>{p(n,{data:c})},n=>{n&&this._diag.error(`Error running response hook`,n)},!0)}_patchEnd(n,u,p,h){let x=c.context.active(),w=this,T=!1;return function(...p){if(!T){T=!0;let u=p[0];if(n){if(u instanceof Error)n.setStatus({code:c.SpanStatusCode.ERROR,message:u.message});else{let c=p[1];w._handleExecutionResult(n,c)}n.end()}h===`endSessions`&&w._connCountAdd(-1,w._poolName,`idle`)}return c.context.with(x,()=>u.apply(this,p))}}setPoolName(n){let c=`mongodb://${n.hostAddress?.host}:${n.hostAddress?.port}/${n.dbName}`;this._poolName=c}_checkSkipInstrumentation(n){return this.getConfig().requireParentSpan===!0&&n===void 0}}})),require_types$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=void 0,(function(n){n.CREATE_INDEXES=`createIndexes`,n.FIND_AND_MODIFY=`findAndModify`,n.IS_MASTER=`isMaster`,n.COUNT=`count`,n.UNKNOWN=`unknown`})(n.MongodbCommandType||={})})),require_src$40=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=n.MongoDBInstrumentation=void 0;var c=require_instrumentation$12();Object.defineProperty(n,`MongoDBInstrumentation`,{enumerable:!0,get:function(){return c.MongoDBInstrumentation}});var u=require_types$6();Object.defineProperty(n,`MongodbCommandType`,{enumerable:!0,get:function(){return u.MongodbCommandType}})})),import_src$27=require_src$40();const INTEGRATION_NAME$16=`Mongo`,instrumentMongo=generateInstrumentOnce(INTEGRATION_NAME$16,()=>new import_src$27.MongoDBInstrumentation({dbStatementSerializer:_defaultDbStatementSerializer,responseHook(n){addOriginToSpan(n,`auto.db.otel.mongo`)}}));function _defaultDbStatementSerializer(n){let c=_scrubStatement(n);return JSON.stringify(c)}function _scrubStatement(n){return Array.isArray(n)?n.map(n=>_scrubStatement(n)):isCommandObj(n)?Object.entries(n).map(([n,c])=>[n,_scrubStatement(c)]).reduce((n,c)=>(isCommandEntry(c)&&(n[c[0]]=c[1]),n),{}):`?`}function isCommandObj(n){return typeof n==`object`&&!!n&&!isBuffer(n)}function isBuffer(n){let c=!1;return typeof Buffer<`u`&&(c=Buffer.isBuffer(n)),c}function isCommandEntry(n){return Array.isArray(n)}const _mongoIntegration=(()=>({name:INTEGRATION_NAME$16,setupOnce(){instrumentMongo()}})),mongoIntegration=defineIntegration(_mongoIntegration);var require_suppress_tracing$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$31=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$9();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8(),p=require_constants$9(),h=require_utils$31();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$8().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$21(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$22();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$8();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$9();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$8();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$22();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$22(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$8(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8(),p=require_TraceState$8();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$8(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$8();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$39=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$8();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$8();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$8();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$8();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$8();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$8();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$8();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$8();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$31();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$22();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$8();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$8();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$8();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$8();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$8();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$8();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$8();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$8();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$8();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$8();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$8()._export}})),require_semconv$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_NAME_VALUE_MONGODB=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_OPERATION=n.ATTR_DB_NAME=n.ATTR_DB_MONGODB_COLLECTION=void 0,n.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_OPERATION=`db.operation`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`})),require_utils$30=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.handleCallbackResponse=n.handlePromiseResponse=n.getAttributesFromCollection=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_semconv$21(),h=(init_esm$1(),__toCommonJS(esm_exports$1));function x(n,c,x){let w={};return c&u.SemconvStability.OLD&&(w[p.ATTR_DB_MONGODB_COLLECTION]=n.name,w[p.ATTR_DB_NAME]=n.conn.name,w[p.ATTR_DB_USER]=n.conn.user),c&u.SemconvStability.STABLE&&(w[h.ATTR_DB_COLLECTION_NAME]=n.name,w[h.ATTR_DB_NAMESPACE]=n.conn.name),x&u.SemconvStability.OLD&&(w[p.ATTR_NET_PEER_NAME]=n.conn.host,w[p.ATTR_NET_PEER_PORT]=n.conn.port),x&u.SemconvStability.STABLE&&(w[h.ATTR_SERVER_ADDRESS]=n.conn.host,w[h.ATTR_SERVER_PORT]=n.conn.port),w}n.getAttributesFromCollection=x;function w(n,u={}){n.recordException(u),n.setStatus({code:c.SpanStatusCode.ERROR,message:`${u.message} ${u.code?`\nMongoose Error Code: ${u.code}`:``}`})}function T(n,p,h,x=void 0){h&&(0,u.safeExecuteInTheMiddle)(()=>h(n,{moduleVersion:x,response:p}),n=>{n&&c.diag.error(`mongoose instrumentation: responseHook error`,n)},!0)}function O(n,c,u,p=void 0){return n instanceof Promise?n.then(n=>(T(c,n,u,p),n)).catch(n=>{throw w(c,n),n}).finally(()=>c.end()):(T(c,n,u,p),c.end(),n)}n.handlePromiseResponse=O;function A(n,c,u,p,h,x,O=void 0){let A=0;return h.length===2?A=1:h.length===3&&(A=2),h[A]=(c,u)=>(c?w(p,c):T(p,u,x,O),p.end(),n(c,u)),c.apply(u,h)}n.handleCallbackResponse=A})),require_version$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mongoose`})),require_mongoose=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongooseInstrumentation=n._ALREADY_INSTRUMENTED=n._STORED_PARENT_SPAN=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$39(),p=require_utils$30(),h=require_src$52(),x=require_version$20(),w=require_semconv$21(),T=(init_esm$1(),__toCommonJS(esm_exports$1)),O=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],A=[`remove`,`count`,`findOneAndRemove`,...O],j=[`count`,`findOneAndRemove`,...O],N=[...O];function I(n){return n?n.startsWith(`6.`)||n.startsWith(`5.`)?A:n.startsWith(`7.`)?j:N:O}function L(n){return n&&(n.startsWith(`5.`)||n.startsWith(`6.`))||!1}function z(n){return!n||!n.startsWith(`8.`)?!1:parseInt(n.split(`.`)[1],10)>=21}n._STORED_PARENT_SPAN=Symbol(`stored-parent-span`),n._ALREADY_INSTRUMENTED=Symbol(`already-instrumented`),n.MongooseInstrumentation=class extends h.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(x.PACKAGE_NAME,x.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,h.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,h.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new h.InstrumentationNodeModuleDefinition(`mongoose`,[`>=5.9.7 <10`],this.patch.bind(this),this.unpatch.bind(this))}patch(n,c){let u=n[Symbol.toStringTag]===`Module`?n.default:n;return this._wrap(u.Model.prototype,`save`,this.patchOnModelMethods(`save`,c)),u.Model.prototype.$save=u.Model.prototype.save,L(c)&&this._wrap(u.Model.prototype,`remove`,this.patchOnModelMethods(`remove`,c)),z(c)&&(this._wrap(u.Model.prototype,`updateOne`,this._patchDocumentUpdateMethods(`updateOne`,c)),this._wrap(u.Model.prototype,`deleteOne`,this._patchDocumentUpdateMethods(`deleteOne`,c))),this._wrap(u.Query.prototype,`exec`,this.patchQueryExec(c)),this._wrap(u.Aggregate.prototype,`exec`,this.patchAggregateExec(c)),I(c).forEach(n=>{this._wrap(u.Query.prototype,n,this.patchAndCaptureSpanContext(n))}),this._wrap(u.Model,`aggregate`,this.patchModelAggregate()),this._wrap(u.Model,`insertMany`,this.patchModelStatic(`insertMany`,c)),this._wrap(u.Model,`bulkWrite`,this.patchModelStatic(`bulkWrite`,c)),u}unpatch(n,c){let u=n[Symbol.toStringTag]===`Module`?n.default:n,p=I(c);this._unwrap(u.Model.prototype,`save`),u.Model.prototype.$save=u.Model.prototype.save,L(c)&&this._unwrap(u.Model.prototype,`remove`),z(c)&&(this._unwrap(u.Model.prototype,`updateOne`),this._unwrap(u.Model.prototype,`deleteOne`)),this._unwrap(u.Query.prototype,`exec`),this._unwrap(u.Aggregate.prototype,`exec`),p.forEach(n=>{this._unwrap(u.Query.prototype,n)}),this._unwrap(u.Model,`aggregate`),this._unwrap(u.Model,`insertMany`),this._unwrap(u.Model,`bulkWrite`)}patchAggregateExec(u){let p=this;return x=>function(O){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let A=this[n._STORED_PARENT_SPAN],j={},{dbStatementSerializer:N}=p.getConfig();if(N){let n=N(`aggregate`,{options:this.options,aggregatePipeline:this._pipeline});p._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_STATEMENT]=n),p._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_QUERY_TEXT]=n)}let I=p._startSpan(this._model.collection,this._model?.modelName,`aggregate`,j,A);return p._handleResponse(I,x,this,arguments,O,u)}}patchQueryExec(u){let p=this;return x=>function(O){if(this[n._ALREADY_INSTRUMENTED]||p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let A=this[n._STORED_PARENT_SPAN],j={},{dbStatementSerializer:N}=p.getConfig();if(N){let n=N(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});p._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_STATEMENT]=n),p._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_QUERY_TEXT]=n)}let I=p._startSpan(this.mongooseCollection,this.model.modelName,this.op,j,A);return p._handleResponse(I,x,this,arguments,O,u)}}patchOnModelMethods(n,u){let p=this;return x=>function(O,A){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let j={document:this};O&&!(O instanceof Function)&&(j.options=O);let N={},{dbStatementSerializer:I}=p.getConfig();if(I){let c=I(n,j);p._dbSemconvStability&h.SemconvStability.OLD&&(N[w.ATTR_DB_STATEMENT]=c),p._dbSemconvStability&h.SemconvStability.STABLE&&(N[T.ATTR_DB_QUERY_TEXT]=c)}let L=p._startSpan(this.constructor.collection,this.constructor.modelName,n,N);return O instanceof Function&&(A=O,O=void 0),p._handleResponse(L,x,this,arguments,A,u)}}_patchDocumentUpdateMethods(u,p){let x=this;return O=>function(A,j,N){if(x.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return O.apply(this,arguments);let I=N,L=A,z=j;typeof A==`function`?(I=A,L=void 0,z=void 0):typeof j==`function`&&(I=j,z=void 0);let B={},V=x.getConfig().dbStatementSerializer;if(V){let n=V(u,{condition:{_id:this._id},updates:L,options:z});x._dbSemconvStability&h.SemconvStability.OLD&&(B[w.ATTR_DB_STATEMENT]=n),x._dbSemconvStability&h.SemconvStability.STABLE&&(B[T.ATTR_DB_QUERY_TEXT]=n)}let H=x._startSpan(this.constructor.collection,this.constructor.modelName,u,B),U=x._handleResponse(H,O,this,arguments,I,p);return U&&typeof U==`object`&&(U[n._ALREADY_INSTRUMENTED]=!0),U}}patchModelStatic(n,u){let p=this;return x=>function(O,A,j){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);typeof A==`function`&&(j=A,A=void 0);let N={};switch(n){case`insertMany`:N.documents=O;break;case`bulkWrite`:N.operations=O;break;default:N.document=O;break}A!==void 0&&(N.options=A);let I={},{dbStatementSerializer:L}=p.getConfig();if(L){let c=L(n,N);p._dbSemconvStability&h.SemconvStability.OLD&&(I[w.ATTR_DB_STATEMENT]=c),p._dbSemconvStability&h.SemconvStability.STABLE&&(I[T.ATTR_DB_QUERY_TEXT]=c)}let z=p._startSpan(this.collection,this.modelName,n,I);return p._handleResponse(z,x,this,arguments,j,u)}}patchModelAggregate(){let u=this;return p=>function(){let h=c.trace.getSpan(c.context.active()),x=u._callOriginalFunction(()=>p.apply(this,arguments));return x&&(x[n._STORED_PARENT_SPAN]=h),x}}patchAndCaptureSpanContext(u){let p=this;return u=>function(){return this[n._STORED_PARENT_SPAN]=c.trace.getSpan(c.context.active()),p._callOriginalFunction(()=>u.apply(this,arguments))}}_startSpan(n,u,x,O,A){let j={...O,...(0,p.getAttributesFromCollection)(n,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_OPERATION]=x,j[w.ATTR_DB_SYSTEM]=`mongoose`),this._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_OPERATION_NAME]=x,j[T.ATTR_DB_SYSTEM_NAME]=w.DB_SYSTEM_NAME_VALUE_MONGODB);let N=this._dbSemconvStability&h.SemconvStability.STABLE?`${x} ${n.name}`:`mongoose.${u}.${x}`;return this.tracer.startSpan(N,{kind:c.SpanKind.CLIENT,attributes:j},A?c.trace.setSpan(c.context.active(),A):void 0)}_handleResponse(n,c,u,h,x,w=void 0){let T=this;if(x instanceof Function)return T._callOriginalFunction(()=>(0,p.handleCallbackResponse)(x,c,u,n,h,T.getConfig().responseHook,w));{let x=T._callOriginalFunction(()=>c.apply(u,h));return(0,p.handlePromiseResponse)(x,n,T.getConfig().responseHook,w)}}_callOriginalFunction(n){return this.getConfig().suppressInternalInstrumentation?c.context.with((0,u.suppressTracing)(c.context.active()),n):n()}}})),require_src$38=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongooseInstrumentation=void 0;var c=require_mongoose();Object.defineProperty(n,`MongooseInstrumentation`,{enumerable:!0,get:function(){return c.MongooseInstrumentation}})})),import_src$26=require_src$38();const INTEGRATION_NAME$15=`Mongoose`,instrumentMongoose=generateInstrumentOnce(INTEGRATION_NAME$15,()=>new import_src$26.MongooseInstrumentation({responseHook(n){addOriginToSpan(n,`auto.db.otel.mongoose`)}})),_mongooseIntegration=(()=>({name:INTEGRATION_NAME$15,setupOnce(){instrumentMongoose()}})),mongooseIntegration=defineIntegration(_mongooseIntegration);var require_semconv$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=n.DB_SYSTEM_VALUE_MYSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MYSQL=`mysql`,n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),require_AttributeNames$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.MYSQL_VALUES=`db.mysql.values`})(n.AttributeNames||={})})),require_utils$29=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getPoolNameOld=n.arrayStringifyHelper=n.getSpanName=n.getDbValues=n.getDbQueryText=n.getJDBCString=n.getConfig=void 0;function c(n){let{host:c,port:u,database:p,user:h}=n&&n.connectionConfig||n||{};return{host:c,port:u,database:p,user:h}}n.getConfig=c;function u(n,c,u){let p=`jdbc:mysql://${n||`localhost`}`;return typeof c==`number`&&(p+=`:${c}`),typeof u==`string`&&(p+=`/${u}`),p}n.getJDBCString=u;function p(n){return typeof n==`string`?n:n.sql}n.getDbQueryText=p;function h(n,c){return w(typeof n==`string`?c:c||n.values)}n.getDbValues=h;function x(n){let c=typeof n==`object`?n.sql:n,u=c?.indexOf(` `);return typeof u==`number`&&u!==-1?c?.substring(0,u):c}n.getSpanName=x;function w(n){return n?`[${n.toString()}]`:``}n.arrayStringifyHelper=w;function T(n){let c=n.config.connectionConfig,u=``;return u+=c.host?`host: '${c.host}', `:``,u+=c.port?`port: ${c.port}, `:``,u+=c.database?`database: '${c.database}', `:``,u+=c.user?`user: '${c.user}'`:``,c.user||(u=u.substring(0,u.length-2)),u.trim()}n.getPoolNameOld=T})),require_version$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql`})),require_instrumentation$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQLInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$20(),x=require_AttributeNames$4(),w=require_utils$29(),T=require_version$19();n.MySQLInstrumentation=class extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(h.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(n,c,u){this._connectionsUsageOld?.add(n,{state:u,name:c})}init(){return[new u.InstrumentationNodeModuleDefinition(`mysql`,[`>=2.0.0 <3`],n=>((0,u.isWrapped)(n.createConnection)&&this._unwrap(n,`createConnection`),this._wrap(n,`createConnection`,this._patchCreateConnection()),(0,u.isWrapped)(n.createPool)&&this._unwrap(n,`createPool`),this._wrap(n,`createPool`,this._patchCreatePool()),(0,u.isWrapped)(n.createPoolCluster)&&this._unwrap(n,`createPoolCluster`),this._wrap(n,`createPoolCluster`,this._patchCreatePoolCluster()),n),n=>{n!==void 0&&(this._unwrap(n,`createConnection`),this._unwrap(n,`createPool`),this._unwrap(n,`createPoolCluster`))})]}_patchCreateConnection(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`query`,c._patchQuery(p)),p}}}_patchCreatePool(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`query`,c._patchQuery(p)),c._wrap(p,`getConnection`,c._patchGetConnection(p)),c._wrap(p,`end`,c._patchPoolEnd(p)),c._setPoolCallbacks(p,``),p}}}_patchPoolEnd(n){return c=>{let u=this;return function(p){let h=n._allConnections.length,x=n._freeConnections.length,T=h-x,O=(0,w.getPoolNameOld)(n);u._connCountAdd(-T,O,`used`),u._connCountAdd(-x,O,`idle`),c.apply(n,arguments)}}}_patchCreatePoolCluster(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`getConnection`,c._patchGetConnection(p)),c._wrap(p,`add`,c._patchAdd(p)),p}}}_patchAdd(n){return c=>{let u=this;return function(p,h){if(!u._enabled)return u._unwrap(n,`add`),c.apply(n,arguments);c.apply(n,arguments);let x=n._nodes;if(x){let c=x[typeof p==`object`?`CLUSTER::`+n._lastId:String(p)].pool;u._setPoolCallbacks(c,p)}}}}_patchGetConnection(n){return c=>{let u=this;return function(p,h,x){if(!u._enabled)return u._unwrap(n,`getConnection`),c.apply(n,arguments);if(arguments.length===1&&typeof p==`function`){let h=u._getConnectionCallbackPatchFn(p);return c.call(n,h)}if(arguments.length===2&&typeof h==`function`){let x=u._getConnectionCallbackPatchFn(h);return c.call(n,p,x)}if(arguments.length===3&&typeof x==`function`){let w=u._getConnectionCallbackPatchFn(x);return c.call(n,p,h,w)}return c.apply(n,arguments)}}}_getConnectionCallbackPatchFn(n){let p=this,h=c.context.active();return function(x,w){w&&((0,u.isWrapped)(w.query)||p._wrap(w,`query`,p._patchQuery(w))),typeof n==`function`&&c.context.with(h,n,this,x,w)}}_patchQuery(n){return T=>{let O=this;return function(A,j,N){if(!O._enabled)return O._unwrap(n,`query`),T.apply(n,arguments);let I={},{host:L,port:z,database:B,user:V}=(0,w.getConfig)(n.config),H=parseInt(z,10),U=(0,w.getDbQueryText)(A);O._dbSemconvStability&u.SemconvStability.OLD&&(I[h.ATTR_DB_SYSTEM]=h.DB_SYSTEM_VALUE_MYSQL,I[h.ATTR_DB_CONNECTION_STRING]=(0,w.getJDBCString)(L,z,B),I[h.ATTR_DB_NAME]=B,I[h.ATTR_DB_USER]=V,I[h.ATTR_DB_STATEMENT]=U),O._dbSemconvStability&u.SemconvStability.STABLE&&(I[p.ATTR_DB_SYSTEM_NAME]=p.DB_SYSTEM_NAME_VALUE_MYSQL,I[p.ATTR_DB_NAMESPACE]=B,I[p.ATTR_DB_QUERY_TEXT]=U),O._netSemconvStability&u.SemconvStability.OLD&&(I[h.ATTR_NET_PEER_NAME]=L,isNaN(H)||(I[h.ATTR_NET_PEER_PORT]=H)),O._netSemconvStability&u.SemconvStability.STABLE&&(I[p.ATTR_SERVER_ADDRESS]=L,isNaN(H)||(I[p.ATTR_SERVER_PORT]=H));let W=O.tracer.startSpan((0,w.getSpanName)(A),{kind:c.SpanKind.CLIENT,attributes:I});if(O.getConfig().enhancedDatabaseReporting){let n;Array.isArray(j)?n=j:arguments[2]&&(n=[j]),W.setAttribute(x.AttributeNames.MYSQL_VALUES,(0,w.getDbValues)(A,n))}let G=Array.from(arguments).findIndex(n=>typeof n==`function`),K=c.context.active();if(G===-1){let u=c.context.with(c.trace.setSpan(c.context.active(),W),()=>T.apply(n,arguments));return c.context.bind(K,u),u.on(`error`,n=>W.setStatus({code:c.SpanStatusCode.ERROR,message:n.message})).on(`end`,()=>{W.end()})}else return O._wrap(arguments,G,O._patchCallbackQuery(W,K)),c.context.with(c.trace.setSpan(c.context.active(),W),()=>T.apply(n,arguments))}}}_patchCallbackQuery(n,u){return p=>function(h,x,w){return h&&n.setStatus({code:c.SpanStatusCode.ERROR,message:h.message}),n.end(),c.context.with(u,()=>p(...arguments))}}_setPoolCallbacks(n,c){let u=c||(0,w.getPoolNameOld)(n);n.on(`connection`,n=>{this._connCountAdd(1,u,`idle`)}),n.on(`acquire`,n=>{this._connCountAdd(-1,u,`idle`),this._connCountAdd(1,u,`used`)}),n.on(`release`,n=>{this._connCountAdd(1,u,`idle`),this._connCountAdd(-1,u,`used`)})}}})),require_src$37=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQLInstrumentation=void 0;var c=require_instrumentation$11();Object.defineProperty(n,`MySQLInstrumentation`,{enumerable:!0,get:function(){return c.MySQLInstrumentation}})})),import_src$25=require_src$37();const INTEGRATION_NAME$14=`Mysql`,instrumentMysql=generateInstrumentOnce(INTEGRATION_NAME$14,()=>new import_src$25.MySQLInstrumentation({})),_mysqlIntegration=(()=>({name:INTEGRATION_NAME$14,setupOnce(){instrumentMysql()}})),mysqlIntegration=defineIntegration(_mysqlIntegration);var require_semconv$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_VALUE_MYSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MYSQL=`mysql`})),require_suppress_tracing$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$28=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$8();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7(),p=require_constants$8(),h=require_utils$28();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$7().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$18(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$18();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$7();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$8();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$7();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$21();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$21(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$7(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7(),p=require_TraceState$7();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$7(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$7();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$36=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$7();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$7();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$7();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$7();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$7();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$7();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$7();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$7();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$28();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$21();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$7();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$7();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$7();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$7();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$7();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$7();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$7();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$7();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$7();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$7();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$7()._export}})),require_src$35=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addSqlCommenterComment=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$36();function p(n){let c=n.indexOf(`--`);return c>=0?!0:n.indexOf(`/*`)<0?!1:c<n.indexOf(`*/`)}function h(n){return encodeURIComponent(n).replace(/[!'()*]/g,n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}function x(n,x){if(typeof x!=`string`||x.length===0||p(x))return x;let w=new u.W3CTraceContextPropagator,T={};w.inject(c.trace.setSpan(c.ROOT_CONTEXT,n),T,c.defaultTextMapSetter);let O=Object.keys(T).sort();return O.length===0?x:`${x} /*${O.map(n=>`${n}='${h(T[n])}'`).join(`,`)}*/`}n.addSqlCommenterComment=x})),require_utils$27=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getConnectionPrototypeToInstrument=n.once=n.getSpanName=n.getQueryText=n.getConnectionAttributes=void 0;let c=require_semconv$19(),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1));function h(n,h,T){let{host:O,port:A,database:j,user:N}=x(n),I={};h&u.SemconvStability.OLD&&(I[c.ATTR_DB_CONNECTION_STRING]=w(O,A,j),I[c.ATTR_DB_NAME]=j,I[c.ATTR_DB_USER]=N),h&u.SemconvStability.STABLE&&(I[p.ATTR_DB_NAMESPACE]=j);let L=parseInt(A,10);return T&u.SemconvStability.OLD&&(I[c.ATTR_NET_PEER_NAME]=O,isNaN(L)||(I[c.ATTR_NET_PEER_PORT]=L)),T&u.SemconvStability.STABLE&&(I[p.ATTR_SERVER_ADDRESS]=O,isNaN(L)||(I[p.ATTR_SERVER_PORT]=L)),I}n.getConnectionAttributes=h;function x(n){let{host:c,port:u,database:p,user:h}=n&&n.connectionConfig||n||{};return{host:c,port:u,database:p,user:h}}function w(n,c,u){let p=`jdbc:mysql://${n||`localhost`}`;return typeof c==`number`&&(p+=`:${c}`),typeof u==`string`&&(p+=`/${u}`),p}function T(n,c,u,p=!1,h=O){let[x,w]=typeof n==`string`?[n,u]:[n.sql,A(n)?u||n.values:u];try{return p?h(x):c&&w?c(x,w):x}catch{return`Could not determine the query due to an error in masking or formatting`}}n.getQueryText=T;function O(n){return n.replace(/\b\d+\b/g,`?`).replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,`?`)}function A(n){return`values`in n}function j(n){let c=typeof n==`object`?n.sql:n,u=c?.indexOf(` `);return typeof u==`number`&&u!==-1?c?.substring(0,u):c}n.getSpanName=j,n.once=n=>{let c=!1;return(...u)=>{if(!c)return c=!0,n(...u)}};function N(n){let c=n.prototype,u=Object.getPrototypeOf(c);return typeof u?.query==`function`&&typeof u?.execute==`function`?u:c}n.getConnectionPrototypeToInstrument=N})),require_version$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql2`})),require_instrumentation$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQL2Instrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_semconv$19(),h=require_src$35(),x=require_utils$27(),w=require_version$17(),T=(init_esm$1(),__toCommonJS(esm_exports$1)),O=[`>=1.4.2 <4`];n.MySQL2Instrumentation=class extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let n;function c(c){!n&&c.format&&(n=c.format)}let p=c=>{(0,u.isWrapped)(c.query)&&this._unwrap(c,`query`),this._wrap(c,`query`,this._patchQuery(n,!1)),(0,u.isWrapped)(c.execute)&&this._unwrap(c,`execute`),this._wrap(c,`execute`,this._patchQuery(n,!0))},h=n=>{this._unwrap(n,`query`),this._unwrap(n,`execute`)};return[new u.InstrumentationNodeModuleDefinition(`mysql2`,O,n=>(c(n),n),()=>{},[new u.InstrumentationNodeModuleFile(`mysql2/promise.js`,O,n=>(c(n),n),()=>{}),new u.InstrumentationNodeModuleFile(`mysql2/lib/connection.js`,O,n=>(p((0,x.getConnectionPrototypeToInstrument)(n)),n),n=>{n!==void 0&&h((0,x.getConnectionPrototypeToInstrument)(n))})])]}_patchQuery(n,w){return O=>{let A=this;return function(j,N,I){let L;Array.isArray(N)?L=N:arguments[2]&&(L=[N]);let{maskStatement:z,maskStatementHook:B,responseHook:V}=A.getConfig(),H=(0,x.getConnectionAttributes)(this.config,A._dbSemconvStability,A._netSemconvStability),U=(0,x.getQueryText)(j,n,L,z,B);A._dbSemconvStability&u.SemconvStability.OLD&&(H[p.ATTR_DB_SYSTEM]=p.DB_SYSTEM_VALUE_MYSQL,H[p.ATTR_DB_STATEMENT]=U),A._dbSemconvStability&u.SemconvStability.STABLE&&(H[T.ATTR_DB_SYSTEM_NAME]=T.DB_SYSTEM_NAME_VALUE_MYSQL,H[T.ATTR_DB_QUERY_TEXT]=U);let W=A.tracer.startSpan((0,x.getSpanName)(j),{kind:c.SpanKind.CLIENT,attributes:H});!w&&A.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=j=typeof j==`string`?(0,h.addSqlCommenterComment)(W,j):Object.assign(j,{sql:(0,h.addSqlCommenterComment)(W,j.sql)}));let G=(0,x.once)((n,p)=>{n?W.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}):typeof V==`function`&&(0,u.safeExecuteInTheMiddle)(()=>{V(W,{queryResults:p})},n=>{n&&A._diag.warn(`Failed executing responseHook`,n)},!0),W.end()});if(arguments.length===1){typeof j.onResult==`function`&&A._wrap(j,`onResult`,A._patchCallbackQuery(G));let n=O.apply(this,arguments);return n.once(`error`,n=>{G(n)}).once(`result`,n=>{G(void 0,n)}),n}return typeof arguments[1]==`function`?A._wrap(arguments,1,A._patchCallbackQuery(G)):typeof arguments[2]==`function`&&A._wrap(arguments,2,A._patchCallbackQuery(G)),O.apply(this,arguments)}}}_patchCallbackQuery(n){return c=>function(u,p,h){return n(u,p),c(...arguments)}}}})),require_src$34=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQL2Instrumentation=void 0;var c=require_instrumentation$10();Object.defineProperty(n,`MySQL2Instrumentation`,{enumerable:!0,get:function(){return c.MySQL2Instrumentation}})})),import_src$24=require_src$34();const INTEGRATION_NAME$13=`Mysql2`,instrumentMysql2=generateInstrumentOnce(INTEGRATION_NAME$13,()=>new import_src$24.MySQL2Instrumentation({responseHook(n){addOriginToSpan(n,`auto.db.otel.mysql2`)}})),_mysql2Integration=(()=>({name:INTEGRATION_NAME$13,setupOnce(){instrumentMysql2()}})),mysql2Integration=defineIntegration(_mysql2Integration),SINGLE_ARG_COMMANDS=[`get`,`set`,`setex`],GET_COMMANDS=[`get`,`mget`],SET_COMMANDS=[`set`,`setex`];function isInCommands(n,c){return n.includes(c.toLowerCase())}function getCacheOperation(n){if(isInCommands(GET_COMMANDS,n))return`cache.get`;if(isInCommands(SET_COMMANDS,n))return`cache.put`}function keyHasPrefix(n,c){return c.some(c=>n.startsWith(c))}function getCacheKeySafely(n,c){try{if(c.length===0)return;let u=n=>typeof n==`string`||typeof n==`number`||Buffer.isBuffer(n)?[n.toString()]:Array.isArray(n)?flatten(n.map(n=>u(n))):[`<unknown>`],p=c[0];return isInCommands(SINGLE_ARG_COMMANDS,n)&&p!=null?u(p):flatten(c.map(n=>u(n)))}catch{return}}function shouldConsiderForCache(n,c,u){if(!getCacheOperation(n))return!1;for(let n of c)if(keyHasPrefix(n,u))return!0;return!1}function calculateCacheItemSize(n){let c=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n==`string`?n.length:typeof n==`number`?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(n)?n.reduce((n,u)=>{let p=c(u);return typeof p==`number`?n===void 0?p:n+p:n},0):c(n)}function flatten(n){let c=[],u=n=>{n.forEach(n=>{Array.isArray(n)?u(n):c.push(n)})};return u(n),c}const serializationSubsets=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}],defaultDbStatementSerializer=(n,c)=>{if(Array.isArray(c)&&c.length){let u=serializationSubsets.find(({regex:c})=>c.test(n))?.args??0,p=u>=0?c.slice(0,u):c.slice();return c.length>p.length&&p.push(`[${c.length-u} other arguments]`),`${n} ${p.join(` `)}`}return n},ATTR_DB_CONNECTION_STRING=`db.connection_string`,ATTR_DB_STATEMENT=`db.statement`,ATTR_DB_SYSTEM=`db.system`,ATTR_NET_PEER_NAME=`net.peer.name`,ATTR_NET_PEER_PORT=`net.peer.port`,DB_SYSTEM_NAME_VALUE_REDIS=`redis`,DB_SYSTEM_VALUE_REDIS=`redis`;init_esm$2(),init_esm$1();const PACKAGE_NAME$2=`@opentelemetry/instrumentation-ioredis`,PACKAGE_VERSION$2=`0.62.0`;function endSpan$1(n,c){c&&(n.recordException(c),n.setStatus({code:SpanStatusCode.ERROR,message:c.message})),n.end()}const DEFAULT_CONFIG$1={requireParentSpan:!0};var IORedisInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(PACKAGE_NAME$2,PACKAGE_VERSION$2,{...DEFAULT_CONFIG$1,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,import_src$35.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...DEFAULT_CONFIG$1,...n})}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`ioredis`,[`>=2.0.0 <6`],(n,c)=>{let u=n[Symbol.toStringTag]===`Module`?n.default:n;return(0,import_src$35.isWrapped)(u.prototype.sendCommand)&&this._unwrap(u.prototype,`sendCommand`),this._wrap(u.prototype,`sendCommand`,this._patchSendCommand(c)),(0,import_src$35.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`connect`,this._patchConnection()),n},n=>{if(n===void 0)return;let c=n[Symbol.toStringTag]===`Module`?n.default:n;this._unwrap(c.prototype,`sendCommand`),this._unwrap(c.prototype,`connect`)})]}_patchSendCommand(n){return c=>this._traceSendCommand(c,n)}_patchConnection(){return n=>this._traceConnection(n)}_traceSendCommand(n,c){let u=this;return function(p){if(arguments.length<1||typeof p!=`object`)return n.apply(this,arguments);let h=u.getConfig(),x=h.dbStatementSerializer||defaultDbStatementSerializer,w=trace.getSpan(context$1.active())===void 0;if(h.requireParentSpan===!0&&w)return n.apply(this,arguments);let T={},{host:O,port:A}=this.options,j=x(p.name,p.args);u._dbSemconvStability&import_src$35.SemconvStability.OLD&&(T[ATTR_DB_SYSTEM]=DB_SYSTEM_VALUE_REDIS,T[ATTR_DB_STATEMENT]=j,T[ATTR_DB_CONNECTION_STRING]=`redis://${O}:${A}`),u._dbSemconvStability&import_src$35.SemconvStability.STABLE&&(T[ATTR_DB_SYSTEM_NAME]=DB_SYSTEM_NAME_VALUE_REDIS,T[ATTR_DB_QUERY_TEXT]=j),u._netSemconvStability&import_src$35.SemconvStability.OLD&&(T[ATTR_NET_PEER_NAME]=O,T[ATTR_NET_PEER_PORT]=A),u._netSemconvStability&import_src$35.SemconvStability.STABLE&&(T[ATTR_SERVER_ADDRESS]=O,T[ATTR_SERVER_PORT]=A),T[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let N=u.tracer.startSpan(p.name,{kind:SpanKind.CLIENT,attributes:T}),{requestHook:I}=h;I&&(0,import_src$35.safeExecuteInTheMiddle)(()=>I(N,{moduleVersion:c,cmdName:p.name,cmdArgs:p.args}),n=>{n&&diag.error(`ioredis instrumentation: request hook failed`,n)},!0);try{let c=n.apply(this,arguments),u=p.resolve;p.resolve=function(n){(0,import_src$35.safeExecuteInTheMiddle)(()=>h.responseHook?.(N,p.name,p.args,n),n=>{n&&diag.error(`ioredis instrumentation: response hook failed`,n)},!0),endSpan$1(N,null),u(n)};let x=p.reject;return p.reject=function(n){endSpan$1(N,n),x(n)},c}catch(n){throw endSpan$1(N,n),n}}}_traceConnection(n){let c=this;return function(){let u=trace.getSpan(context$1.active())===void 0;if(c.getConfig().requireParentSpan===!0&&u)return n.apply(this,arguments);let p={},{host:h,port:x}=this.options;c._dbSemconvStability&import_src$35.SemconvStability.OLD&&(p[ATTR_DB_SYSTEM]=DB_SYSTEM_VALUE_REDIS,p[ATTR_DB_STATEMENT]=`connect`,p[ATTR_DB_CONNECTION_STRING]=`redis://${h}:${x}`),c._dbSemconvStability&import_src$35.SemconvStability.STABLE&&(p[ATTR_DB_SYSTEM_NAME]=DB_SYSTEM_NAME_VALUE_REDIS,p[ATTR_DB_QUERY_TEXT]=`connect`),c._netSemconvStability&import_src$35.SemconvStability.OLD&&(p[ATTR_NET_PEER_NAME]=h,p[ATTR_NET_PEER_PORT]=x),c._netSemconvStability&import_src$35.SemconvStability.STABLE&&(p[ATTR_SERVER_ADDRESS]=h,p[ATTR_SERVER_PORT]=x),p[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let w=c.tracer.startSpan(`connect`,{kind:SpanKind.CLIENT,attributes:p});try{let c=n.apply(this,arguments);return typeof c?.then==`function`?c.then(n=>(endSpan$1(w,null),n),n=>(endSpan$1(w,n),Promise.reject(n))):(endSpan$1(w,null),c)}catch(n){throw endSpan$1(w,n),n}}}};init_esm$2(),init_esm$1();const PACKAGE_NAME$1=`@opentelemetry/instrumentation-redis`,PACKAGE_VERSION$1=`0.62.0`,OTEL_OPEN_SPANS=Symbol(`opentelemetry.instrumentation.redis.open_spans`),MULTI_COMMAND_OPTIONS=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function removeCredentialsFromDBConnectionStringAttribute(n,c){if(!(typeof c!=`string`||!c))try{let n=new URL(c);return n.searchParams.delete(`user_pwd`),n.username=``,n.password=``,n.href}catch(c){n.error(`failed to sanitize redis connection url`,c)}}function getClientAttributes(n,c,u){let p={};return u&import_src$35.SemconvStability.OLD&&Object.assign(p,{[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,[ATTR_NET_PEER_NAME]:c?.socket?.host,[ATTR_NET_PEER_PORT]:c?.socket?.port,[ATTR_DB_CONNECTION_STRING]:removeCredentialsFromDBConnectionStringAttribute(n,c?.url)}),u&import_src$35.SemconvStability.STABLE&&Object.assign(p,{[ATTR_DB_SYSTEM_NAME]:DB_SYSTEM_NAME_VALUE_REDIS,[ATTR_SERVER_ADDRESS]:c?.socket?.host,[ATTR_SERVER_PORT]:c?.socket?.port}),p}function endSpanV2(n,c){c&&n.setStatus({code:SpanStatusCode.ERROR,message:c.message}),n.end()}function getTracedCreateClient(n){return function(){let c=n.apply(this,arguments);return context$1.bind(context$1.active(),c)}}function getTracedCreateStreamTrace(n){return function(){return Object.prototype.hasOwnProperty.call(this,`stream`)||Object.defineProperty(this,`stream`,{get(){return this._patched_redis_stream},set(n){context$1.bind(context$1.active(),n),this._patched_redis_stream=n}}),n.apply(this,arguments)}}var RedisInstrumentationV2_V3=class n extends import_src$35.InstrumentationBase{static __initStatic(){this.COMPONENT=`redis`}constructor(n={}){super(PACKAGE_NAME$1,PACKAGE_VERSION$1,n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig(n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`redis`,[`>=2.6.0 <4`],n=>((0,import_src$35.isWrapped)(n.RedisClient.prototype.internal_send_command)&&this._unwrap(n.RedisClient.prototype,`internal_send_command`),this._wrap(n.RedisClient.prototype,`internal_send_command`,this._getPatchInternalSendCommand()),(0,import_src$35.isWrapped)(n.RedisClient.prototype.create_stream)&&this._unwrap(n.RedisClient.prototype,`create_stream`),this._wrap(n.RedisClient.prototype,`create_stream`,this._getPatchCreateStream()),(0,import_src$35.isWrapped)(n.createClient)&&this._unwrap(n,`createClient`),this._wrap(n,`createClient`,this._getPatchCreateClient()),n),n=>{n!==void 0&&(this._unwrap(n.RedisClient.prototype,`internal_send_command`),this._unwrap(n.RedisClient.prototype,`create_stream`),this._unwrap(n,`createClient`))})]}_getPatchInternalSendCommand(){let c=this;return function(u){return function(p){if(arguments.length!==1||typeof p!=`object`)return u.apply(this,arguments);let h=c.getConfig(),x=trace.getSpan(context$1.active())===void 0;if(h.requireParentSpan===!0&&x)return u.apply(this,arguments);let w=h?.dbStatementSerializer||defaultDbStatementSerializer,T={};c._semconvStability&import_src$35.SemconvStability.OLD&&Object.assign(T,{[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,[ATTR_DB_STATEMENT]:w(p.command,p.args)}),c._semconvStability&import_src$35.SemconvStability.STABLE&&Object.assign(T,{[ATTR_DB_SYSTEM_NAME]:DB_SYSTEM_NAME_VALUE_REDIS,[ATTR_DB_OPERATION_NAME]:p.command,[ATTR_DB_QUERY_TEXT]:w(p.command,p.args)}),T[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let O=c.tracer.startSpan(`${n.COMPONENT}-${p.command}`,{kind:SpanKind.CLIENT,attributes:T});if(this.connection_options){let n={};c._semconvStability&import_src$35.SemconvStability.OLD&&Object.assign(n,{[ATTR_NET_PEER_NAME]:this.connection_options.host,[ATTR_NET_PEER_PORT]:this.connection_options.port}),c._semconvStability&import_src$35.SemconvStability.STABLE&&Object.assign(n,{[ATTR_SERVER_ADDRESS]:this.connection_options.host,[ATTR_SERVER_PORT]:this.connection_options.port}),O.setAttributes(n)}this.address&&c._semconvStability&import_src$35.SemconvStability.OLD&&O.setAttribute(ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let A=arguments[0].callback;if(A){let n=context$1.active();arguments[0].callback=function(u,x){if(h?.responseHook){let n=h.responseHook;(0,import_src$35.safeExecuteInTheMiddle)(()=>{n(O,p.command,p.args,x)},n=>{n&&c._diag.error(`Error executing responseHook`,n)},!0)}return endSpanV2(O,u),context$1.with(n,A,this,...arguments)}}try{return u.apply(this,arguments)}catch(n){throw endSpanV2(O,n),n}}}}_getPatchCreateClient(){return function(n){return getTracedCreateClient(n)}}_getPatchCreateStream(){return function(n){return getTracedCreateStreamTrace(n)}}};RedisInstrumentationV2_V3.__initStatic();var RedisInstrumentationV4_V5=class n extends import_src$35.InstrumentationBase{static __initStatic2(){this.COMPONENT=`redis`}constructor(n={}){super(PACKAGE_NAME$1,PACKAGE_VERSION$1,n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig(n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(n){return new import_src$35.InstrumentationNodeModuleDefinition(n,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>n,()=>{},[new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/commander.js`,[`^1.0.0`],(n,c)=>{let u=n.transformCommandArguments;if(!u)return this._diag.error(`internal instrumentation error, missing transformCommandArguments function`),n;let p=c?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return(0,import_src$35.isWrapped)(n?.[p])&&this._unwrap(n,p),this._wrap(n,p,this._getPatchExtendWithCommands(u)),n},n=>{(0,import_src$35.isWrapped)(n?.extendWithCommands)&&this._unwrap(n,`extendWithCommands`),(0,import_src$35.isWrapped)(n?.attachCommands)&&this._unwrap(n,`attachCommands`)}),new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>{let c=n?.default?.prototype;return(0,import_src$35.isWrapped)(c?.exec)&&this._unwrap(c,`exec`),this._wrap(c,`exec`,this._getPatchMultiCommandsExec(!1)),(0,import_src$35.isWrapped)(c?.execAsPipeline)&&this._unwrap(c,`execAsPipeline`),this._wrap(c,`execAsPipeline`,this._getPatchMultiCommandsExec(!0)),(0,import_src$35.isWrapped)(c?.addCommand)&&this._unwrap(c,`addCommand`),this._wrap(c,`addCommand`,this._getPatchMultiCommandsAddCommand()),n},n=>{let c=n?.default?.prototype;(0,import_src$35.isWrapped)(c?.exec)&&this._unwrap(c,`exec`),(0,import_src$35.isWrapped)(c?.execAsPipeline)&&this._unwrap(c,`execAsPipeline`),(0,import_src$35.isWrapped)(c?.addCommand)&&this._unwrap(c,`addCommand`)}),new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>{let c=n?.default?.prototype;return c?.multi&&((0,import_src$35.isWrapped)(c?.multi)&&this._unwrap(c,`multi`),this._wrap(c,`multi`,this._getPatchRedisClientMulti())),c?.MULTI&&((0,import_src$35.isWrapped)(c?.MULTI)&&this._unwrap(c,`MULTI`),this._wrap(c,`MULTI`,this._getPatchRedisClientMulti())),(0,import_src$35.isWrapped)(c?.sendCommand)&&this._unwrap(c,`sendCommand`),this._wrap(c,`sendCommand`,this._getPatchRedisClientSendCommand()),(0,import_src$35.isWrapped)(c?.connect)&&this._unwrap(c,`connect`),this._wrap(c,`connect`,this._getPatchedClientConnect()),n},n=>{let c=n?.default?.prototype;(0,import_src$35.isWrapped)(c?.multi)&&this._unwrap(c,`multi`),(0,import_src$35.isWrapped)(c?.MULTI)&&this._unwrap(c,`MULTI`),(0,import_src$35.isWrapped)(c?.sendCommand)&&this._unwrap(c,`sendCommand`),(0,import_src$35.isWrapped)(c?.connect)&&this._unwrap(c,`connect`)})])}_getPatchExtendWithCommands(n){let c=this;return function(u){return function(p){if(p?.BaseClass?.name!==`RedisClient`)return u.apply(this,arguments);let h=p.executor;return p.executor=function(u,p){let x=n(u,p).args;return c._traceClientCommand(h,this,arguments,x)},u.apply(this,arguments)}}}_getPatchMultiCommandsExec(n){let c=this;return function(u){return function(){let p=u.apply(this,arguments);return typeof p?.then==`function`?p.then(u=>{let p=this[OTEL_OPEN_SPANS];return c._endSpansWithRedisReplies(p,u,n),u}).catch(u=>{let p=this[OTEL_OPEN_SPANS];if(!p)c._diag.error(`cannot find open spans to end for multi/pipeline`);else{let h=u.constructor.name===`MultiErrorReply`?u.replies:Array(p.length).fill(u);c._endSpansWithRedisReplies(p,h,n)}return Promise.reject(u)}):(c._diag.error(`non-promise result when patching exec/execAsPipeline`),p)}}}_getPatchMultiCommandsAddCommand(){let n=this;return function(c){return function(u){return n._traceClientCommand(c,this,arguments,u)}}}_getPatchRedisClientMulti(){return function(n){return function(){let c=n.apply(this,arguments);return c[MULTI_COMMAND_OPTIONS]=this.options,c}}}_getPatchRedisClientSendCommand(){let n=this;return function(c){return function(u){return n._traceClientCommand(c,this,arguments,u)}}}_getPatchedClientConnect(){let c=this;return function(u){return function(){let p=this.options,h=getClientAttributes(c._diag,p,c._semconvStability);h[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let x=c.tracer.startSpan(`${n.COMPONENT}-connect`,{kind:SpanKind.CLIENT,attributes:h});return context$1.with(trace.setSpan(context$1.active(),x),()=>u.apply(this)).then(n=>(x.end(),n)).catch(n=>(x.recordException(n),x.setStatus({code:SpanStatusCode.ERROR,message:n.message}),x.end(),Promise.reject(n)))}}}_traceClientCommand(c,u,p,h){if(trace.getSpan(context$1.active())===void 0&&this.getConfig().requireParentSpan)return c.apply(u,p);let x=u.options||u[MULTI_COMMAND_OPTIONS],w=h[0],T=h.slice(1),O=this.getConfig().dbStatementSerializer||defaultDbStatementSerializer,A=getClientAttributes(this._diag,x,this._semconvStability);this._semconvStability&import_src$35.SemconvStability.STABLE&&(A[ATTR_DB_OPERATION_NAME]=w);try{let n=O(w,T);n!=null&&(this._semconvStability&import_src$35.SemconvStability.OLD&&(A[ATTR_DB_STATEMENT]=n),this._semconvStability&import_src$35.SemconvStability.STABLE&&(A[ATTR_DB_QUERY_TEXT]=n))}catch(n){this._diag.error(`dbStatementSerializer throw an exception`,n,{commandName:w})}A[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let j=this.tracer.startSpan(`${n.COMPONENT}-${w}`,{kind:SpanKind.CLIENT,attributes:A}),N=context$1.with(trace.setSpan(context$1.active(),j),()=>c.apply(u,p));if(typeof N?.then==`function`)N.then(n=>{this._endSpanWithResponse(j,w,T,n,void 0)},n=>{this._endSpanWithResponse(j,w,T,null,n)});else{let n=N;n[OTEL_OPEN_SPANS]=n[OTEL_OPEN_SPANS]||[],n[OTEL_OPEN_SPANS].push({span:j,commandName:w,commandArgs:T})}return N}_endSpansWithRedisReplies(n,c,u=!1){if(!n)return this._diag.error(`cannot find open spans to end for redis multi/pipeline`);if(c.length!==n.length)return this._diag.error(`number of multi command spans does not match response from redis`);let p=n.map(n=>n.commandName),h=p.every(n=>n===p[0])?(u?`PIPELINE `:`MULTI `)+p[0]:u?`PIPELINE`:`MULTI`;for(let u=0;u<n.length;u++){let{span:x,commandArgs:w}=n[u],T=c[u],[O,A]=T instanceof Error?[null,T]:[T,void 0];this._semconvStability&import_src$35.SemconvStability.STABLE&&x.setAttribute(ATTR_DB_OPERATION_NAME,h),this._endSpanWithResponse(x,p[u],w,O,A)}}_endSpanWithResponse(n,c,u,p,h){let{responseHook:x}=this.getConfig();if(!h&&x)try{x(n,c,u,p)}catch(n){this._diag.error(`responseHook throw an exception`,n)}h&&(n.recordException(h),n.setStatus({code:SpanStatusCode.ERROR,message:h?.message})),n.end()}};RedisInstrumentationV4_V5.__initStatic2();const DEFAULT_CONFIG={requireParentSpan:!1};var RedisInstrumentation=class n extends import_src$35.InstrumentationBase{__init(){this.initialized=!1}constructor(c={}){let u={...DEFAULT_CONFIG,...c};super(PACKAGE_NAME$1,PACKAGE_VERSION$1,u),n.prototype.__init.call(this),this.instrumentationV2_V3=new RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(n={}){let c={...DEFAULT_CONFIG,...n};super.setConfig(c),this.initialized&&(this.instrumentationV2_V3.setConfig(c),this.instrumentationV4_V5.setConfig(c))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(n){super.setTracerProvider(n),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(n),this.instrumentationV4_V5.setTracerProvider(n))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};init_esm$2();function tracingChannel$1(n,c){let u=tracingChannel(n),p;try{p=context$1._getContextManager().getAsyncLocalStorageLookup()}catch{}if(!p)return DEBUG_BUILD$1&&warn(`[TracingChannel] Could not access OpenTelemetry AsyncLocalStorage, context propagation will not work.`),u;let h=p.asyncLocalStorage;return u.start.bindStore(h,n=>{let u=c(n);return n._sentrySpan=u,trace.setSpan(context$1.active(),u)}),u}const CHANNEL_COMMAND=`node-redis:command`,CHANNEL_BATCH=`node-redis:batch`,CHANNEL_CONNECT=`node-redis:connect`,ORIGIN=`auto.db.redis.diagnostic_channel`,NOOP=()=>{};let subscribed=!1,currentResponseHook;function subscribeRedisDiagnosticChannels(n){if(currentResponseHook=n,!subscribed)try{setupCommandChannel(),setupBatchChannel(),setupConnectChannel(),subscribed=!0}catch{}}function setupCommandChannel(){tracingChannel$1(CHANNEL_COMMAND,n=>{let c=n.args.slice(1),u=safeSerialize(n.command,c);return startSpanManual$1({name:`redis-${n.command}`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...u==null?{}:{[ATTR_DB_STATEMENT]:u},...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)}).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{let c=n._sentrySpan;!c||n.error||(runResponseHook(c,n.command,n.args.slice(1),n.result),c.end())},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function setupBatchChannel(){tracingChannel$1(CHANNEL_BATCH,n=>startSpanManual$1({name:n.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...n.batchSize==null?{}:{"db.redis.batch_size":n.batchSize},...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{n.error||n._sentrySpan?.end()},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function setupConnectChannel(){tracingChannel$1(CHANNEL_CONNECT,n=>startSpanManual$1({name:`redis-connect`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis.connect`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{n.error||n._sentrySpan?.end()},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function runResponseHook(n,c,u,p){let h=currentResponseHook;if(h)try{h(n,c,u,p)}catch{}}function safeSerialize(n,c){try{return defaultDbStatementSerializer(n,c)}catch{return}}const INTEGRATION_NAME$12=`Redis`;let _redisOptions={};const cacheResponseHook=(n,c,u,p)=>{let h=getCacheKeySafely(c,u),x=getCacheOperation(c);if(!h||!x||!_redisOptions.cachePrefixes||!shouldConsiderForCache(c,h,_redisOptions.cachePrefixes))return;let w=spanToJSON(n).data,T=w[`net.peer.name`]??w[`server.address`],O=w[`net.peer.port`]??w[`server.port`];O&&T&&n.setAttributes({"network.peer.address":T,"network.peer.port":O});let A=calculateCacheItemSize(p);A&&n.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,A),isInCommands(GET_COMMANDS,c)&&A!==void 0&&n.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT,A>0),n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_OP]:x,[SEMANTIC_ATTRIBUTE_CACHE_KEY]:h});let j=h.join(`, `);n.updateName(_redisOptions.maxCacheKeyLength?truncate(j,_redisOptions.maxCacheKeyLength):j)},instrumentIORedis=generateInstrumentOnce(`${INTEGRATION_NAME$12}.IORedis`,()=>new IORedisInstrumentation({responseHook:cacheResponseHook})),instrumentRedisModule=generateInstrumentOnce(`${INTEGRATION_NAME$12}.Redis`,()=>new RedisInstrumentation({responseHook:cacheResponseHook})),instrumentRedis=Object.assign(()=>{instrumentIORedis(),instrumentRedisModule(),Promise.resolve().then(()=>subscribeRedisDiagnosticChannels(cacheResponseHook))},{id:INTEGRATION_NAME$12}),_redisIntegration=((n={})=>({name:INTEGRATION_NAME$12,setupOnce(){_redisOptions=n,instrumentRedis()}})),redisIntegration=defineIntegration(_redisIntegration);var require_internal_types$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EVENT_LISTENERS_SET=void 0,n.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.pg.eventListenersSet`)})),require_AttributeNames$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.PG_VALUES=`db.postgresql.values`,n.PG_PLAN=`db.postgresql.plan`,n.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,n.MAX_CLIENT=`db.postgresql.max.client`})(n.AttributeNames||={})})),require_semconv$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=n.METRIC_DB_CLIENT_CONNECTION_COUNT=n.DB_SYSTEM_VALUE_POSTGRESQL=n.DB_CLIENT_CONNECTION_STATE_VALUE_USED=n.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=n.ATTR_DB_CLIENT_CONNECTION_STATE=n.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0,n.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=`db.client.connection.pool.name`,n.ATTR_DB_CLIENT_CONNECTION_STATE=`db.client.connection.state`,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=`idle`,n.DB_CLIENT_CONNECTION_STATE_VALUE_USED=`used`,n.DB_SYSTEM_VALUE_POSTGRESQL=`postgresql`,n.METRIC_DB_CLIENT_CONNECTION_COUNT=`db.client.connection.count`,n.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=`db.client.connection.pending_requests`})),require_SpanNames=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanNames=void 0,(function(n){n.QUERY_PREFIX=`pg.query`,n.CONNECT=`pg.connect`,n.POOL_CONNECT=`pg-pool.connect`})(n.SpanNames||={})})),require_utils$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.sanitizedErrorMessage=n.isObjectWithTextString=n.getErrorMessage=n.patchClientConnectCallback=n.patchCallbackPGPool=n.updateCounter=n.getPoolName=n.patchCallback=n.handleExecutionResult=n.handleConfigQuery=n.shouldSkipInstrumentation=n.getSemanticAttributesFromPoolConnection=n.getSemanticAttributesFromConnection=n.getConnectionString=n.parseAndMaskConnectionString=n.parseNormalizedOperationName=n.getQuerySpanName=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_AttributeNames$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$17(),x=require_src$52(),w=require_SpanNames();function T(n,c){if(!c)return w.SpanNames.QUERY_PREFIX;let u=typeof c.name==`string`&&c.name?c.name:O(c.text);return`${w.SpanNames.QUERY_PREFIX}:${u}${n?` ${n}`:``}`}n.getQuerySpanName=T;function O(n){let c=n.trim(),u=c.indexOf(` `),p=u===-1?c:c.slice(0,u);return p=p.toUpperCase(),p.endsWith(`;`)?p.slice(0,-1):p}n.parseNormalizedOperationName=O;function A(n){try{let c=new URL(n);return c.username=``,c.password=``,c.toString()}catch{return`postgresql://localhost:5432/`}}n.parseAndMaskConnectionString=A;function j(n){return`connectionString`in n&&n.connectionString?A(n.connectionString):`postgresql://${n.host||`localhost`}:${n.port||5432}/${n.database||``}`}n.getConnectionString=j;function N(n){if(Number.isInteger(n))return n}function I(n,c){let u={};return c&x.SemconvStability.OLD&&(u={...u,[h.ATTR_DB_SYSTEM]:h.DB_SYSTEM_VALUE_POSTGRESQL,[h.ATTR_DB_NAME]:n.database,[h.ATTR_DB_CONNECTION_STRING]:j(n),[h.ATTR_DB_USER]:n.user,[h.ATTR_NET_PEER_NAME]:n.host,[h.ATTR_NET_PEER_PORT]:N(n.port)}),c&x.SemconvStability.STABLE&&(u={...u,[p.ATTR_DB_SYSTEM_NAME]:p.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[p.ATTR_DB_NAMESPACE]:n.namespace,[p.ATTR_SERVER_ADDRESS]:n.host,[p.ATTR_SERVER_PORT]:N(n.port)}),u}n.getSemanticAttributesFromConnection=I;function L(n,c){let w;try{w=n.connectionString?new URL(n.connectionString):void 0}catch{w=void 0}let T={[u.AttributeNames.IDLE_TIMEOUT_MILLIS]:n.idleTimeoutMillis,[u.AttributeNames.MAX_CLIENT]:n.maxClient};return c&x.SemconvStability.OLD&&(T={...T,[h.ATTR_DB_SYSTEM]:h.DB_SYSTEM_VALUE_POSTGRESQL,[h.ATTR_DB_NAME]:w?.pathname.slice(1)??n.database,[h.ATTR_DB_CONNECTION_STRING]:j(n),[h.ATTR_NET_PEER_NAME]:w?.hostname??n.host,[h.ATTR_NET_PEER_PORT]:Number(w?.port)||N(n.port),[h.ATTR_DB_USER]:w?.username??n.user}),c&x.SemconvStability.STABLE&&(T={...T,[p.ATTR_DB_SYSTEM_NAME]:p.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[p.ATTR_DB_NAMESPACE]:n.namespace,[p.ATTR_SERVER_ADDRESS]:w?.hostname??n.host,[p.ATTR_SERVER_PORT]:Number(w?.port)||N(n.port)}),T}n.getSemanticAttributesFromPoolConnection=L;function z(n){return n.requireParentSpan===!0&&c.trace.getSpan(c.context.active())===void 0}n.shouldSkipInstrumentation=z;function B(n,w,O,A){let{connectionParameters:j}=this,N=j.database,L=T(N,A),z=n.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I(j,O)});if(!A)return z;if(A.text&&(O&x.SemconvStability.OLD&&z.setAttribute(h.ATTR_DB_STATEMENT,A.text),O&x.SemconvStability.STABLE&&z.setAttribute(p.ATTR_DB_QUERY_TEXT,A.text)),w.enhancedDatabaseReporting&&Array.isArray(A.values))try{let n=A.values.map(n=>n==null?`null`:n instanceof Buffer?n.toString():typeof n==`object`?typeof n.toPostgres==`function`?n.toPostgres():JSON.stringify(n):n.toString());z.setAttribute(u.AttributeNames.PG_VALUES,n)}catch(n){c.diag.error(`failed to stringify `,A.values,n)}return typeof A.name==`string`&&z.setAttribute(u.AttributeNames.PG_PLAN,A.name),z}n.handleConfigQuery=B;function V(n,u,p){typeof n.responseHook==`function`&&(0,x.safeExecuteInTheMiddle)(()=>{n.responseHook(u,{data:p})},n=>{n&&c.diag.error(`Error running response hook`,n)},!0)}n.handleExecutionResult=V;function H(n,u,h,x,w){return function(T,O){T?(Object.prototype.hasOwnProperty.call(T,`code`)&&(x[p.ATTR_ERROR_TYPE]=T.code),T instanceof Error&&u.recordException(J(T)),u.setStatus({code:c.SpanStatusCode.ERROR,message:T.message})):V(n,u,O),w(),u.end(),h.call(this,T,O)}}n.patchCallback=H;function U(n){let c=``;return c+=(n?.host?`${n.host}`:`unknown_host`)+`:`,c+=(n?.port?`${n.port}`:`unknown_port`)+`/`,c+=n?.database?`${n.database}`:`unknown_database`,c.trim()}n.getPoolName=U;function W(n,c,u,p,x){let w=c.totalCount,T=c.waitingCount,O=c.idleCount,A=w-O;return u.add(A-x.used,{[h.ATTR_DB_CLIENT_CONNECTION_STATE]:h.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),u.add(O-x.idle,{[h.ATTR_DB_CLIENT_CONNECTION_STATE]:h.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),p.add(T-x.pending,{[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),{used:A,idle:O,pending:T}}n.updateCounter=W;function G(n,u){return function(p,h,x){p&&(p instanceof Error&&n.recordException(J(p)),n.setStatus({code:c.SpanStatusCode.ERROR,message:p.message})),n.end(),u.call(this,p,h,x)}}n.patchCallbackPGPool=G;function K(n,u){return function(p){p&&(p instanceof Error&&n.recordException(J(p)),n.setStatus({code:c.SpanStatusCode.ERROR,message:p.message})),n.end(),u.apply(this,arguments)}}n.patchClientConnectCallback=K;function ee(n){return typeof n==`object`&&n&&`message`in n?String(n.message):void 0}n.getErrorMessage=ee;function te(n){return typeof n==`object`&&typeof n?.text==`string`}n.isObjectWithTextString=te;function J(n){return`PostgreSQL error of type '${n?.name??`PostgreSQLError`}' occurred (code: ${n?.code??`UNKNOWN`})`}n.sanitizedErrorMessage=J})),require_version$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.66.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-pg`})),require_instrumentation$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PgInstrumentation=void 0;let c=require_src$52(),u=(init_esm$2(),__toCommonJS(esm_exports$2)),p=require_internal_types$4(),h=require_utils$26(),x=require_src$35(),w=require_version$16(),T=require_SpanNames(),O=require_src$47(),A=(init_esm$1(),__toCommonJS(esm_exports$1)),j=require_semconv$17();function N(n){return n[Symbol.toStringTag]===`Module`?n.default:n}n.PgInstrumentation=class extends c.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,n),this._semconvStability=(0,c.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(A.METRIC_DB_CLIENT_OPERATION_DURATION,{description:`Duration of database client operations.`,unit:`s`,valueType:u.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(j.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`}),this._connectionPendingRequests=this.meter.createUpDownCounter(j.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:`The number of current pending requests for an open connection.`,unit:`{connection}`})}init(){let n=[`>=8.0.3 <9`],u=[`>=2.0.0 <4`],p=new c.InstrumentationNodeModuleFile(`pg/lib/native/client.js`,n,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),h=new c.InstrumentationNodeModuleFile(`pg/lib/client.js`,n,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new c.InstrumentationNodeModuleDefinition(`pg`,n,n=>{let c=N(n);return this._patchPgClient(c.Client),n},n=>{let c=N(n);return this._unpatchPgClient(c.Client),n},[h,p]),new c.InstrumentationNodeModuleDefinition(`pg-pool`,u,n=>{let u=N(n);return(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`connect`,this._getPoolConnectPatch()),u},n=>{let u=N(n);(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`)})]}_patchPgClient(n){if(!n)return;let u=N(n);return(0,c.isWrapped)(u.prototype.query)&&this._unwrap(u.prototype,`query`),(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`query`,this._getClientQueryPatch()),this._wrap(u.prototype,`connect`,this._getClientConnectPatch()),n}_unpatchPgClient(n){let u=N(n);return(0,c.isWrapped)(u.prototype.query)&&this._unwrap(u.prototype,`query`),(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),n}_getClientConnectPatch(){let n=this;return c=>function(p){let x=n.getConfig();if(h.shouldSkipInstrumentation(x)||x.ignoreConnectSpans)return c.call(this,p);let w=n.tracer.startSpan(T.SpanNames.CONNECT,{kind:u.SpanKind.CLIENT,attributes:h.getSemanticAttributesFromConnection(this,n._semconvStability)});if(p){let n=u.trace.getSpan(u.context.active());p=h.patchClientConnectCallback(w,p),n&&(p=u.context.bind(u.context.active(),p))}return I(w,u.context.with(u.trace.setSpan(u.context.active(),w),()=>c.call(this,p)))}}recordOperationDuration(n,u){let p={},h=[A.ATTR_DB_NAMESPACE,A.ATTR_ERROR_TYPE,A.ATTR_SERVER_PORT,A.ATTR_SERVER_ADDRESS,A.ATTR_DB_OPERATION_NAME];this._semconvStability&c.SemconvStability.OLD&&h.push(j.ATTR_DB_SYSTEM),this._semconvStability&c.SemconvStability.STABLE&&h.push(A.ATTR_DB_SYSTEM_NAME),h.forEach(c=>{c in n&&(p[c]=n[c])});let x=(0,O.hrTimeToMilliseconds)((0,O.hrTimeDuration)(u,(0,O.hrTime)()))/1e3;this._operationDuration.record(x,p)}_getClientQueryPatch(){let n=this;return p=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...w){if(h.shouldSkipInstrumentation(n.getConfig()))return p.apply(this,w);let T=(0,O.hrTime)(),N=w[0],I=typeof N==`string`,L=h.isObjectWithTextString(N),z=I?{text:N,values:Array.isArray(w[1])?w[1]:void 0}:L?{...N,name:N.name,text:N.text,values:N.values??(Array.isArray(w[1])?w[1]:void 0)}:void 0,B={[j.ATTR_DB_SYSTEM]:j.DB_SYSTEM_VALUE_POSTGRESQL,[A.ATTR_DB_NAMESPACE]:this.database,[A.ATTR_SERVER_PORT]:this.connectionParameters.port,[A.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};z?.text&&(B[A.ATTR_DB_OPERATION_NAME]=h.parseNormalizedOperationName(z?.text));let V=()=>{n.recordOperationDuration(B,T)},H=n.getConfig(),U=h.handleConfigQuery.call(this,n.tracer,H,n._semconvStability,z);if(H.addSqlCommenterCommentToQueries&&(I?w[0]=(0,x.addSqlCommenterComment)(U,N):L&&!(`name`in N)&&(w[0]={...N,text:(0,x.addSqlCommenterComment)(U,N.text)})),w.length>0){let c=u.trace.getSpan(u.context.active());if(typeof w[w.length-1]==`function`)w[w.length-1]=h.patchCallback(H,U,w[w.length-1],B,V),c&&(w[w.length-1]=u.context.bind(u.context.active(),w[w.length-1]));else if(typeof z?.callback==`function`){let p=h.patchCallback(n.getConfig(),U,z.callback,B,V);c&&(p=u.context.bind(u.context.active(),p)),w[0].callback=p}}let{requestHook:W}=H;typeof W==`function`&&z&&(0,c.safeExecuteInTheMiddle)(()=>{let{database:n,host:c,port:u,user:p}=this.connectionParameters;W(U,{connection:{database:n,host:c,port:u,user:p},query:{text:z.text,values:z.values,name:z.name}})},c=>{c&&n._diag.error(`Error running query hook`,c)},!0);let G;try{G=p.apply(this,w)}catch(n){throw n instanceof Error&&U.recordException(h.sanitizedErrorMessage(n)),U.setStatus({code:u.SpanStatusCode.ERROR,message:h.getErrorMessage(n)}),U.end(),n}return G instanceof Promise?G.then(c=>new Promise(u=>{h.handleExecutionResult(n.getConfig(),U,c),V(),U.end(),u(c)})).catch(n=>new Promise((c,p)=>{n instanceof Error&&U.recordException(h.sanitizedErrorMessage(n)),U.setStatus({code:u.SpanStatusCode.ERROR,message:n.message}),V(),U.end(),p(n)})):G})}_setPoolConnectEventListeners(n){if(n[p.EVENT_LISTENERS_SET])return;let c=h.getPoolName(n.options);n.on(`connect`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`acquire`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`remove`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`release`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n[p.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let n=this;return c=>function(p){let x=n.getConfig();if(h.shouldSkipInstrumentation(x)||(n._setPoolConnectEventListeners(this),x.ignoreConnectSpans))return c.call(this,p);let w=n.tracer.startSpan(T.SpanNames.POOL_CONNECT,{kind:u.SpanKind.CLIENT,attributes:h.getSemanticAttributesFromPoolConnection(this.options,n._semconvStability)});if(p){let n=u.trace.getSpan(u.context.active());p=h.patchCallbackPGPool(w,p),n&&(p=u.context.bind(u.context.active(),p))}return I(w,u.context.with(u.trace.setSpan(u.context.active(),w),()=>c.call(this,p)))}}};function I(n,c){if(!(c instanceof Promise))return c;let p=c;return u.context.bind(u.context.active(),p.then(c=>(n.end(),c)).catch(c=>(c instanceof Error&&n.recordException(h.sanitizedErrorMessage(c)),n.setStatus({code:u.SpanStatusCode.ERROR,message:h.getErrorMessage(c)}),n.end(),Promise.reject(c))))}})),require_src$33=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=n.PgInstrumentation=void 0;var c=require_instrumentation$9();Object.defineProperty(n,`PgInstrumentation`,{enumerable:!0,get:function(){return c.PgInstrumentation}});var u=require_AttributeNames$3();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}})})),import_src$23=require_src$33();const INTEGRATION_NAME$11=`Postgres`,instrumentPostgres=generateInstrumentOnce(INTEGRATION_NAME$11,import_src$23.PgInstrumentation,n=>({requireParentSpan:!0,requestHook(n){addOriginToSpan(n,`auto.db.otel.postgres`)},ignoreConnectSpans:n?.ignoreConnectSpans??!1})),_postgresIntegration=(n=>({name:INTEGRATION_NAME$11,setupOnce(){instrumentPostgres(n)}})),postgresIntegration=defineIntegration(_postgresIntegration);init_esm$2(),init_esm$1();const INTEGRATION_NAME$10=`PostgresJs`,SUPPORTED_VERSIONS$1=[`>=3.0.0 <4`],SQL_OPERATION_REGEX=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,QUERY_FROM_INSTRUMENTED_SQL=Symbol.for(`sentry.query.from.instrumented.sql`),instrumentPostgresJs=generateInstrumentOnce(INTEGRATION_NAME$10,n=>new PostgresJsInstrumentation({requireParentSpan:n?.requireParentSpan??!0,requestHook:n?.requestHook}));var PostgresJsInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n){super(`sentry-postgres-js`,SDK_VERSION,n)}init(){let n=new import_src$35.InstrumentationNodeModuleDefinition(`postgres`,SUPPORTED_VERSIONS$1,n=>{try{return this._patchPostgres(n)}catch(c){return DEBUG_BUILD&&debug.error(`Failed to patch postgres module:`,c),n}},n=>n);return[`src`,`cf/src`,`cjs/src`].forEach(c=>{n.files.push(new import_src$35.InstrumentationNodeModuleFile(`postgres/${c}/query.js`,SUPPORTED_VERSIONS$1,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),n}_patchPostgres(n){let c=typeof n==`function`,u=c?n:n.default;if(typeof u!=`function`)return DEBUG_BUILD&&debug.warn(`postgres module does not export a function. Skipping instrumentation.`),n;let p=this,h=function(...n){let c=Reflect.construct(u,n);if(!c||typeof c!=`function`)return DEBUG_BUILD&&debug.warn(`postgres() did not return a valid instance`),c;let h=p.getConfig();return instrumentPostgresJsSql(c,{requireParentSpan:h.requireParentSpan,requestHook:h.requestHook})};Object.setPrototypeOf(h,u),Object.setPrototypeOf(h.prototype,u.prototype);for(let n of Object.getOwnPropertyNames(u))if(![`length`,`name`,`prototype`].includes(n)){let c=Object.getOwnPropertyDescriptor(u,n);c&&Object.defineProperty(h,n,c)}return c?h:(replaceExports(n,`default`,h),n)}_shouldCreateSpans(){let n=this.getConfig();return trace.getSpan(context$1.active())!==void 0||!n.requireParentSpan}_setOperationName(n,c,u){if(u){n.setAttribute(ATTR_DB_OPERATION_NAME,u);return}let p=c?.match(SQL_OPERATION_REGEX);p?.[1]&&n.setAttribute(ATTR_DB_OPERATION_NAME,p[1].toUpperCase())}_reconstructQuery(n){if(n?.length)return n.length===1?n[0]||void 0:n.reduce((n,c,u)=>u===0?c:`${n}$${u}${c}`,``)}_sanitizeSqlQuery(n){return n?n.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(/(?<!\$)-?\b\d+\b/g,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`):`Unknown SQL Query`}_patchQueryPrototype(n){let c=this,u=n.Query.prototype.handle;return n.Query.prototype.handle=async function(...n){if(this[QUERY_FROM_INSTRUMENTED_SQL]||!c._shouldCreateSpans())return u.apply(this,n);let p=c._reconstructQuery(this.strings),h=c._sanitizeSqlQuery(p);return startSpanManual$1({name:h||`postgresjs.query`,op:`db`},p=>{addOriginToSpan(p,`auto.db.postgresjs`),p.setAttributes({[ATTR_DB_SYSTEM_NAME]:`postgres`,[ATTR_DB_QUERY_TEXT]:h});let{requestHook:x}=c.getConfig();x&&(0,import_src$35.safeExecuteInTheMiddle)(()=>x(p,h,void 0),n=>{n&&(p.setAttribute(`sentry.hook.error`,`requestHook failed`),DEBUG_BUILD&&debug.error(`Error in requestHook for ${INTEGRATION_NAME$10} integration:`,n))},!0);let w=this.resolve;this.resolve=new Proxy(w,{apply:(n,u,x)=>{try{c._setOperationName(p,h,x?.[0]?.command),p.end()}catch(n){DEBUG_BUILD&&debug.error(`Error ending span in resolve callback:`,n)}return Reflect.apply(n,u,x)}});let T=this.reject;this.reject=new Proxy(T,{apply:(n,u,x)=>{try{p.setStatus({code:2,message:x?.[0]?.message||`unknown_error`}),p.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE,x?.[0]?.code||`unknown`),p.setAttribute(ATTR_ERROR_TYPE,x?.[0]?.name||`unknown`),c._setOperationName(p,h),p.end()}catch(n){DEBUG_BUILD&&debug.error(`Error ending span in reject callback:`,n)}return Reflect.apply(n,u,x)}});try{return u.apply(this,n)}catch(n){throw p.setStatus({code:2,message:n instanceof Error?n.message:`unknown_error`}),p.end(),n}})},n.Query.prototype.handle.__sentry_original__=u,n}_unpatchQueryPrototype(n){return n.Query.prototype.handle.__sentry_original__&&(n.Query.prototype.handle=n.Query.prototype.handle.__sentry_original__),n}};const _postgresJsIntegration=(n=>({name:INTEGRATION_NAME$10,setupOnce(){instrumentPostgresJs(n)}})),postgresJsIntegration=defineIntegration(_postgresJsIntegration);var require_LogRecord$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SeverityNumber=void 0,(function(n){n[n.UNSPECIFIED=0]=`UNSPECIFIED`,n[n.TRACE=1]=`TRACE`,n[n.TRACE2=2]=`TRACE2`,n[n.TRACE3=3]=`TRACE3`,n[n.TRACE4=4]=`TRACE4`,n[n.DEBUG=5]=`DEBUG`,n[n.DEBUG2=6]=`DEBUG2`,n[n.DEBUG3=7]=`DEBUG3`,n[n.DEBUG4=8]=`DEBUG4`,n[n.INFO=9]=`INFO`,n[n.INFO2=10]=`INFO2`,n[n.INFO3=11]=`INFO3`,n[n.INFO4=12]=`INFO4`,n[n.WARN=13]=`WARN`,n[n.WARN2=14]=`WARN2`,n[n.WARN3=15]=`WARN3`,n[n.WARN4=16]=`WARN4`,n[n.ERROR=17]=`ERROR`,n[n.ERROR2=18]=`ERROR2`,n[n.ERROR3=19]=`ERROR3`,n[n.ERROR4=20]=`ERROR4`,n[n.FATAL=21]=`FATAL`,n[n.FATAL2=22]=`FATAL2`,n[n.FATAL3=23]=`FATAL3`,n[n.FATAL4=24]=`FATAL4`})(n.SeverityNumber||={})})),require_NoopLogger$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER=n.NoopLogger=void 0;var c=class{emit(n){}};n.NoopLogger=c,n.NOOP_LOGGER=new c})),require_NoopLoggerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER_PROVIDER=n.NoopLoggerProvider=void 0;let c=require_NoopLogger$1();var u=class{getLogger(n,u,p){return new c.NoopLogger}};n.NoopLoggerProvider=u,n.NOOP_LOGGER_PROVIDER=new u})),require_ProxyLogger$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLogger=void 0;let c=require_NoopLogger$1();n.ProxyLogger=class{constructor(n,c,u,p){this._provider=n,this.name=c,this.version=u,this.options=p}emit(n){this._getLogger().emit(n)}_getLogger(){if(this._delegate)return this._delegate;let n=this._provider._getDelegateLogger(this.name,this.version,this.options);return n?(this._delegate=n,this._delegate):c.NOOP_LOGGER}}})),require_ProxyLoggerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLoggerProvider=void 0;let c=require_NoopLoggerProvider$1(),u=require_ProxyLogger$1();n.ProxyLoggerProvider=class{getLogger(n,c,p){var h;return this._getDelegateLogger(n,c,p)??new u.ProxyLogger(this,n,c,p)}_getDelegate(){var n;return this._delegate??c.NOOP_LOGGER_PROVIDER}_setDelegate(n){this._delegate=n}_getDelegateLogger(n,c,u){var p;return this._delegate?.getLogger(n,c,u)}}})),require_globalThis$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=typeof globalThis==`object`?globalThis:global})),require_node$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0;var c=require_globalThis$7();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}})})),require_platform$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0;var c=require_node$20();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}})})),require_global_utils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.API_BACKWARDS_COMPATIBILITY_VERSION=n.makeGetter=n._global=n.GLOBAL_LOGS_API_KEY=void 0;let c=require_platform$20();n.GLOBAL_LOGS_API_KEY=Symbol.for(`io.opentelemetry.js.api.logs`),n._global=c._globalThis;function u(n,c,u){return p=>p===n?c:u}n.makeGetter=u,n.API_BACKWARDS_COMPATIBILITY_VERSION=1})),require_logs$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LogsAPI=void 0;let c=require_global_utils$1(),u=require_NoopLoggerProvider$1(),p=require_ProxyLoggerProvider$1();n.LogsAPI=class n{constructor(){this._proxyLoggerProvider=new p.ProxyLoggerProvider}static getInstance(){return this._instance||=new n,this._instance}setGlobalLoggerProvider(n){return c._global[c.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(c._global[c.GLOBAL_LOGS_API_KEY]=(0,c.makeGetter)(c.API_BACKWARDS_COMPATIBILITY_VERSION,n,u.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(n),n)}getLoggerProvider(){var n,u;return c._global[c.GLOBAL_LOGS_API_KEY]?.call(c._global,c.API_BACKWARDS_COMPATIBILITY_VERSION)??this._proxyLoggerProvider}getLogger(n,c,u){return this.getLoggerProvider().getLogger(n,c,u)}disable(){delete c._global[c.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new p.ProxyLoggerProvider}}})),require_src$32=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.logs=n.ProxyLoggerProvider=n.ProxyLogger=n.NoopLoggerProvider=n.NOOP_LOGGER_PROVIDER=n.NoopLogger=n.NOOP_LOGGER=n.SeverityNumber=void 0;var c=require_LogRecord$1();Object.defineProperty(n,`SeverityNumber`,{enumerable:!0,get:function(){return c.SeverityNumber}});var u=require_NoopLogger$1();Object.defineProperty(n,`NOOP_LOGGER`,{enumerable:!0,get:function(){return u.NOOP_LOGGER}}),Object.defineProperty(n,`NoopLogger`,{enumerable:!0,get:function(){return u.NoopLogger}});var p=require_NoopLoggerProvider$1();Object.defineProperty(n,`NOOP_LOGGER_PROVIDER`,{enumerable:!0,get:function(){return p.NOOP_LOGGER_PROVIDER}}),Object.defineProperty(n,`NoopLoggerProvider`,{enumerable:!0,get:function(){return p.NoopLoggerProvider}});var h=require_ProxyLogger$1();Object.defineProperty(n,`ProxyLogger`,{enumerable:!0,get:function(){return h.ProxyLogger}});var x=require_ProxyLoggerProvider$1();Object.defineProperty(n,`ProxyLoggerProvider`,{enumerable:!0,get:function(){return x.ProxyLoggerProvider}}),n.logs=require_logs$3().LogsAPI.getInstance()})),require_autoLoaderUtils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.disableInstrumentations=n.enableInstrumentations=void 0;function c(n,c,u,p){for(let h=0,x=n.length;h<x;h++){let x=n[h];c&&x.setTracerProvider(c),u&&x.setMeterProvider(u),p&&x.setLoggerProvider&&x.setLoggerProvider(p),x.getConfig().enabled||x.enable()}}n.enableInstrumentations=c;function u(n){n.forEach(n=>n.disable())}n.disableInstrumentations=u})),require_autoLoader$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.registerInstrumentations=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$32(),p=require_autoLoaderUtils$1();function h(n){let h=n.tracerProvider||c.trace.getTracerProvider(),x=n.meterProvider||c.metrics.getMeterProvider(),w=n.loggerProvider||u.logs.getLoggerProvider(),T=n.instrumentations?.flat()??[];return(0,p.enableInstrumentations)(T,h,x,w),()=>{(0,p.disableInstrumentations)(T)}}n.registerInstrumentations=h})),require_semver$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.satisfies=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,p=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function x(n,u,p){if(!w(n))return c.diag.error(`Invalid version: ${n}`),!1;if(!u)return!0;u=u.replace(/([<>=~^]+)\s+/g,`$1`);let h=L(n);if(!h)return!1;let x=[],O=T(h,u,x,p);return O&&!p?.includePrerelease?j(h,x):O}n.satisfies=x;function w(n){return typeof n==`string`&&u.test(n)}function T(n,c,u,p){if(c.includes(`||`)){let h=c.trim().split(`||`);for(let c of h)if(O(n,c,u,p))return!0;return!1}else if(c.includes(` - `))c=ge(c,p);else if(c.includes(` `)){let h=c.trim().replace(/\s{2,}/g,` `).split(` `);for(let c of h)if(!O(n,c,u,p))return!1;return!0}return O(n,c,u,p)}function O(n,c,u,p){if(c=N(c,p),c.includes(` `))return T(n,c,u,p);{let p=z(c);return u.push(p),A(n,p)}}function A(n,c){if(c.invalid)return!1;if(!c.version||B(c.version))return!0;let u=W(n.versionSegments||[],c.versionSegments||[]);if(u===0){let p=n.prereleaseSegments||[],h=c.prereleaseSegments||[];u=!p.length&&!h.length?0:!p.length&&h.length?1:p.length&&!h.length?-1:W(p,h)}return h[c.op]?.includes(u)}function j(n,c){return n.prerelease?c.some(c=>c.prerelease&&c.version===n.version):!0}function N(n,c){return n=n.trim(),n=me(n,c),n=pe(n),n=he(n,c),n=n.trim(),n}function I(n){return!n||n.toLowerCase()===`x`||n===`*`}function L(n){let p=n.match(u);if(!p){c.diag.error(`Invalid version: ${n}`);return}let h=p.groups.version,x=p.groups.prerelease,w=p.groups.build,T=h.split(`.`),O=x?.split(`.`);return{op:void 0,version:h,versionSegments:T,versionSegmentCount:T.length,prerelease:x,prereleaseSegments:O,prereleaseSegmentCount:O?O.length:0,build:w}}function z(n){if(!n)return{};let u=n.match(p);if(!u)return c.diag.error(`Invalid range: ${n}`),{invalid:!0};let h=u.groups.op,x=u.groups.version,w=u.groups.prerelease,T=u.groups.build,O=x.split(`.`),A=w?.split(`.`);return h===`==`&&(h=`=`),{op:h||`=`,version:x,versionSegments:O,versionSegmentCount:O.length,prerelease:w,prereleaseSegments:A,prereleaseSegmentCount:A?A.length:0,build:T}}function B(n){return n===`*`||n===`x`||n===`X`}function V(n){let c=parseInt(n,10);return isNaN(c)?n:c}function H(n,c){if(typeof n==typeof c){if(typeof n==`number`||typeof n==`string`)return[n,c];throw Error(`Version segments can only be strings or numbers`)}else return[String(n),String(c)]}function U(n,c){if(B(n)||B(c))return 0;let[u,p]=H(V(n),V(c));return u>p?1:u<p?-1:0}function W(n,c){for(let u=0;u<Math.max(n.length,c.length);u++){let p=U(n[u]||`0`,c[u]||`0`);if(p!==0)return p}return 0}let G=`[a-zA-Z0-9-]`,K=`0|[1-9]\\d*`,ee=`\\d*[a-zA-Z-]${G}*`,te=`((?:<|>)?=?)`,J=`(?:${K}|${ee})`,Y=`(?:-(${J}(?:\\.${J})*))`,ne=`${G}+`,re=`(?:\\+(${ne}(?:\\.${ne})*))`,X=`${K}|x|X|\\*`,ie=`[v=\\s]*(${X})(?:\\.(${X})(?:\\.(${X})(?:${Y})?${re}?)?)?`,ae=`^((?:<|>)?=?)\\s*${ie}$`,oe=new RegExp(ae),se=`^\\s*(${ie})\\s+-\\s+(${ie})\\s*$`,ce=new RegExp(se),le=`^(?:~>?)${ie}$`,ue=new RegExp(le),de=`^(?:\\^)${ie}$`,fe=new RegExp(de);function pe(n){let c=ue;return n.replace(c,(n,c,u,p,h)=>{let x;return x=I(c)?``:I(u)?`>=${c}.0.0 <${+c+1}.0.0-0`:I(p)?`>=${c}.${u}.0 <${c}.${+u+1}.0-0`:h?`>=${c}.${u}.${p}-${h} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${p} <${c}.${+u+1}.0-0`,x})}function me(n,c){let u=fe,p=c?.includePrerelease?`-0`:``;return n.replace(u,(n,c,u,h,x)=>{let w;return w=I(c)?``:I(u)?`>=${c}.0.0${p} <${+c+1}.0.0-0`:I(h)?c===`0`?`>=${c}.${u}.0${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.0${p} <${+c+1}.0.0-0`:x?c===`0`?u===`0`?`>=${c}.${u}.${h}-${x} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}-${x} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h}-${x} <${+c+1}.0.0-0`:c===`0`?u===`0`?`>=${c}.${u}.${h}${p} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h} <${+c+1}.0.0-0`,w})}function he(n,c){let u=oe;return n.replace(u,(n,u,p,h,x,w)=>{let T=I(p),O=T||I(h),A=O||I(x),j=A;return u===`=`&&j&&(u=``),w=c?.includePrerelease?`-0`:``,T?n=u===`>`||u===`<`?`<0.0.0-0`:`*`:u&&j?(O&&(h=0),x=0,u===`>`?(u=`>=`,O?(p=+p+1,h=0,x=0):(h=+h+1,x=0)):u===`<=`&&(u=`<`,O?p=+p+1:h=+h+1),u===`<`&&(w=`-0`),n=`${u+p}.${h}.${x}${w}`):O?n=`>=${p}.0.0${w} <${+p+1}.0.0-0`:A&&(n=`>=${p}.${h}.0${w} <${p}.${+h+1}.0-0`),n})}function ge(n,c){let u=ce;return n.replace(u,(n,u,p,h,x,w,T,O,A,j,N,L)=>(u=I(p)?``:I(h)?`>=${p}.0.0${c?.includePrerelease?`-0`:``}`:I(x)?`>=${p}.${h}.0${c?.includePrerelease?`-0`:``}`:w?`>=${u}`:`>=${u}${c?.includePrerelease?`-0`:``}`,O=I(A)?``:I(j)?`<${+A+1}.0.0-0`:I(N)?`<${A}.${+j+1}.0-0`:L?`<=${A}.${j}.${N}-${L}`:c?.includePrerelease?`<${A}.${j}.${+N+1}-0`:`<=${O}`,`${u} ${O}`.trim()))}})),require_shimmer$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.massUnwrap=n.unwrap=n.massWrap=n.wrap=void 0;let c=console.error.bind(console);function u(n,c,u){let p=!!n[c]&&Object.prototype.propertyIsEnumerable.call(n,c);Object.defineProperty(n,c,{configurable:!0,enumerable:p,writable:!0,value:u})}n.wrap=(n,p,h)=>{if(!n||!n[p]){c(`no original function `+String(p)+` to wrap`);return}if(!h){c(`no wrapper function`),c(Error().stack);return}let x=n[p];if(typeof x!=`function`||typeof h!=`function`){c(`original object and wrapper must be functions`);return}let w=h(x,p);return u(w,`__original`,x),u(w,`__unwrap`,()=>{n[p]===w&&u(n,p,x)}),u(w,`__wrapped`,!0),u(n,p,w),w},n.massWrap=(u,p,h)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to wrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.wrap)(c,u,h)})})},n.unwrap=(n,u)=>{if(!n||!n[u]){c(`no function to unwrap.`),c(Error().stack);return}let p=n[u];if(!p.__unwrap)c(`no original to unwrap to -- has `+String(u)+` already been unwrapped?`);else{p.__unwrap();return}},n.massUnwrap=(u,p)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to unwrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.unwrap)(c,u)})})};function p(n){n&&n.logger&&(typeof n.logger==`function`?c=n.logger:c(`new logger isn't a function, not replacing`))}n.default=p,p.wrap=n.wrap,p.massWrap=n.massWrap,p.unwrap=n.unwrap,p.massUnwrap=n.massUnwrap})),require_instrumentation$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationAbstract=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$32(),p=require_shimmer$1();n.InstrumentationAbstract=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(n,p,h){this.instrumentationName=n,this.instrumentationVersion=p,this.setConfig(h),this._diag=c.diag.createComponentLogger({namespace:n}),this._tracer=c.trace.getTracer(n,p),this._meter=c.metrics.getMeter(n,p),this._logger=u.logs.getLogger(n,p),this._updateMetricInstruments()}_wrap=p.wrap;_unwrap=p.unwrap;_massWrap=p.massWrap;_massUnwrap=p.massUnwrap;get meter(){return this._meter}setMeterProvider(n){this._meter=n.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(n){this._logger=n.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let n=this.init()??[];return Array.isArray(n)?n:[n]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(n){this._config={enabled:!0,...n}}setTracerProvider(n){this._tracer=n.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(n,c,u,p){if(n)try{n(u,p)}catch(n){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:c},n)}}}})),require_ModuleNameTrie$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ModuleNameTrie=n.ModuleNameSeparator=void 0,n.ModuleNameSeparator=`/`;var c=class{hooks=[];children=new Map};n.ModuleNameTrie=class{_trie=new c;_counter=0;insert(u){let p=this._trie;for(let h of u.moduleName.split(n.ModuleNameSeparator)){let n=p.children.get(h);n||(n=new c,p.children.set(h,n)),p=n}p.hooks.push({hook:u,insertedId:this._counter++})}search(c,{maintainInsertionOrder:u,fullOnly:p}={}){let h=this._trie,x=[],w=!0;for(let u of c.split(n.ModuleNameSeparator)){let n=h.children.get(u);if(!n){w=!1;break}p||x.push(...n.hooks),h=n}return p&&w&&x.push(...h.hooks),x.length===0?[]:x.length===1?[x[0].hook]:(u&&x.sort((n,c)=>n.insertedId-c.insertedId),x.map(({hook:n})=>n))}}})),require_RequireInTheMiddleSingleton$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RequireInTheMiddleSingleton=void 0;let c=require_require_in_the_middle(),u=__require(`path`),p=require_ModuleNameTrie$1(),h=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(n=>typeof global[n]==`function`);n.RequireInTheMiddleSingleton=class n{_moduleNameTrie=new p.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new c.Hook(null,{internals:!0},(n,c,u)=>{let p=x(c),h=this._moduleNameTrie.search(p,{maintainInsertionOrder:!0,fullOnly:u===void 0});for(let{onRequire:p}of h)n=p(n,c,u);return n})}register(n,c){let u={moduleName:n,onRequire:c};return this._moduleNameTrie.insert(u),u}static getInstance(){return h?new n:this._instance=this._instance??new n}};function x(n){return u.sep===p.ModuleNameSeparator?n:n.split(u.sep).join(p.ModuleNameSeparator)}})),require_register=__commonJSMin$1((n=>{let c=[],u=new WeakMap,p=new WeakMap,h=new Map,x=[],w={set(n,c,p){let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p):!0},get(n,c){if(c===Symbol.toStringTag)return`Module`;let u=p.get(n)[c];if(typeof u==`function`)return u()},defineProperty(n,c,p){if(!(`value`in p))throw Error(`Getters/setters are not supported for exports property descriptors.`);let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p.value):!0}};function T(n,T,O,A,j){h.set(n,j),u.set(T,O),p.set(T,A);let N=new Proxy(T,w);c.forEach(c=>c(n,N,j)),x.push([n,N,j])}n.register=T,n.importHooks=c,n.specifiers=h,n.toHook=x})),require_import_in_the_middle=__commonJSMin$1(((n,c)=>{let u=__require(`path`),p=require_module_details_from_path(),{fileURLToPath:h}=__require(`url`),{MessageChannel:x}=__require(`worker_threads`),{isBuiltin:w}=__require(`module`);w||=()=>!0;let{importHooks:T,specifiers:O,toHook:A}=require_register();function j(n){T.push(n),A.forEach(([c,u,p])=>n(c,u,p))}function N(n){let c=T.indexOf(n);c>-1&&T.splice(c,1)}function I(n,c,u,p){let h=n(c,u,p);h&&h!==c&&`default`in c&&(c.default=h)}let L;function z(){let{port1:n,port2:c}=new x,u=0,p;L=c=>{u++,n.postMessage(c)},n.on(`message`,()=>{u--,p&&u<=0&&p()}).unref();function h(){let n=setInterval(()=>{},1e3),c=new Promise(n=>{p=n}).then(()=>{clearInterval(n)});return u===0&&p(),c}let w=c;return{registerOptions:{data:{addHookMessagePort:w,include:[]},transferList:[w]},addHookMessagePort:w,waitForAllMessagesAcknowledged:h}}function B(n,c,x){if(!(this instanceof B))return new B(n,c,x);typeof n==`function`?(x=n,n=null,c=null):typeof c==`function`&&(x=c,c=null);let T=c?c.internals===!0:!1;L&&Array.isArray(n)&&L(n),this._iitmHook=(c,A,j)=>{let N=c,L=N.startsWith(`node:`),z,B;if(L){let n=c.slice(5);w(n)&&(c=n)}else if(N.startsWith(`file://`)){let n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{z=h(c),c=z}catch{}if(Error.stackTraceLimit=n,z){let n=p(z);n&&(c=n.name,B=n.basedir)}}if(n)for(let p of n)if(z&&p===z)I(x,A,z,void 0);else if(p===c){if(!B)I(x,A,c,B);else if(B.endsWith(O.get(N)))I(x,A,c,B);else if(T){let n=c+u.sep+u.relative(B,z);I(x,A,n,B)}}else p===j&&I(x,A,j,B);else I(x,A,c,B)},j(this._iitmHook)}B.prototype.unhook=function(){N(this._iitmHook)},c.exports=B,c.exports.Hook=B,c.exports.addHook=j,c.exports.removeHook=N,c.exports.createAddHookMessageChannel=z})),require_utils$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isWrapped=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=void 0;function c(n,c,u){let p,h;try{h=n()}catch(n){p=n}finally{if(c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddle=c;async function u(n,c,u){let p,h;try{h=await n()}catch(n){p=n}finally{if(c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddleAsync=u;function p(n){return typeof n==`function`&&typeof n.__original==`function`&&typeof n.__unwrap==`function`&&n.__wrapped===!0}n.isWrapped=p})),require_instrumentation$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationBase=void 0;let c=__require(`path`),u=__require(`util`),p=require_semver$1(),h=require_shimmer$1(),x=require_instrumentation$8(),w=require_RequireInTheMiddleSingleton$1(),T=require_import_in_the_middle(),O=(init_esm$2(),__toCommonJS(esm_exports$2)),A=require_require_in_the_middle(),j=__require(`fs`),N=require_utils$25();n.InstrumentationBase=class extends x.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=w.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(n,c,u){super(n,c,u);let p=this.init();p&&!Array.isArray(p)&&(p=[p]),this._modules=p||[],this._config.enabled&&this.enable()}_wrap=(n,c,p)=>{if((0,N.isWrapped)(n[c])&&this._unwrap(n,c),u.types.isProxy(n)){let u=(0,h.wrap)(Object.assign({},n),c,p);return Object.defineProperty(n,c,{value:u}),u}else return(0,h.wrap)(n,c,p)};_unwrap=(n,c)=>u.types.isProxy(n)?Object.defineProperty(n,c,{value:n[c]}):(0,h.unwrap)(n,c);_massWrap=(n,c,u)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._wrap(n,c,u)})})};_massUnwrap=(n,c)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._unwrap(n,c)})})};_warnOnPreloadedModules(){this._modules.forEach(n=>{let{name:c}=n;try{let n=__require.resolve(c);__require.cache[n]&&this._diag.warn(`Module ${c} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${c}`)}catch{}})}_extractPackageVersion(n){try{let u=(0,j.readFileSync)(c.join(n,`package.json`),{encoding:`utf8`}),p=JSON.parse(u).version;return typeof p==`string`?p:void 0}catch{O.diag.warn(`Failed extracting version`,n)}}_onRequire(n,u,p,h){if(!h)return typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:n.name}),n.patch(u)):u;let x=this._extractPackageVersion(h);if(n.moduleVersion=x,n.name===p)return I(n.supportedVersions,x,n.includePrerelease)&&typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:n.name,version:n.moduleVersion,baseDir:h}),n.patch(u,n.moduleVersion)):u;let w=n.files??[],T=c.normalize(p);return w.filter(n=>n.name===T).filter(c=>I(c.supportedVersions,x,n.includePrerelease)).reduce((c,u)=>(u.moduleExports=c,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:n.name,version:n.moduleVersion,fileName:u.name,baseDir:h}),u.patch(c,n.moduleVersion)):c),u)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let n of this._modules){typeof n.patch==`function`&&n.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:n.name,version:n.moduleVersion}),n.patch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.patch(c.moduleExports,n.moduleVersion))}return}this._warnOnPreloadedModules();for(let n of this._modules){let u=(u,p,h)=>{if(!h&&c.isAbsolute(p)){let n=c.parse(p);p=n.name,h=n.dir}return this._onRequire(n,u,p,h)},p=(c,u,p)=>this._onRequire(n,c,u,p),h=c.isAbsolute(n.name)?new A.Hook([n.name],{internals:!0},p):this._requireInTheMiddleSingleton.register(n.name,p);this._hooks.push(h);let x=new T.Hook([n.name],{internals:!1},u);this._hooks.push(x)}}}disable(){if(this._enabled){this._enabled=!1;for(let n of this._modules){typeof n.unpatch==`function`&&n.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:n.name,version:n.moduleVersion}),n.unpatch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.unpatch(c.moduleExports,n.moduleVersion))}}}isEnabled(){return this._enabled}};function I(n,c,u){return c===void 0?n.includes(`*`):n.some(n=>(0,p.satisfies)(c,n,{includePrerelease:u}))}})),require_normalize$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=void 0;var c=__require(`path`);Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_node$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_instrumentation$7();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}});var u=require_normalize$1();Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return u.normalize}})})),require_platform$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_node$19();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}}),Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_instrumentationNodeModuleDefinition$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleDefinition=void 0,n.InstrumentationNodeModuleDefinition=class{name;supportedVersions;patch;unpatch;files;constructor(n,c,u,p,h){this.name=n,this.supportedVersions=c,this.patch=u,this.unpatch=p,this.files=h||[]}}})),require_instrumentationNodeModuleFile$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleFile=void 0;let c=require_platform$19();n.InstrumentationNodeModuleFile=class{supportedVersions;patch;unpatch;name;constructor(n,u,p,h){this.supportedVersions=u,this.patch=p,this.unpatch=h,this.name=(0,c.normalize)(n)}}})),require_semconvStability$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=void 0;var c;(function(n){n[n.STABLE=1]=`STABLE`,n[n.OLD=2]=`OLD`,n[n.DUPLICATE=3]=`DUPLICATE`})(c=n.SemconvStability||={});function u(n,u){let p=c.OLD,h=u?.split(`,`).map(n=>n.trim()).filter(n=>n!==``);for(let u of h??[])if(u.toLowerCase()===n+`/dup`){p=c.DUPLICATE;break}else u.toLowerCase()===n&&(p=c.STABLE);return p}n.semconvStabilityFromStr=u})),require_src$31=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=n.isWrapped=n.InstrumentationNodeModuleFile=n.InstrumentationNodeModuleDefinition=n.InstrumentationBase=n.registerInstrumentations=void 0;var c=require_autoLoader$1();Object.defineProperty(n,`registerInstrumentations`,{enumerable:!0,get:function(){return c.registerInstrumentations}});var u=require_platform$19();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return u.InstrumentationBase}});var p=require_instrumentationNodeModuleDefinition$1();Object.defineProperty(n,`InstrumentationNodeModuleDefinition`,{enumerable:!0,get:function(){return p.InstrumentationNodeModuleDefinition}});var h=require_instrumentationNodeModuleFile$1();Object.defineProperty(n,`InstrumentationNodeModuleFile`,{enumerable:!0,get:function(){return h.InstrumentationNodeModuleFile}});var x=require_utils$25();Object.defineProperty(n,`isWrapped`,{enumerable:!0,get:function(){return x.isWrapped}}),Object.defineProperty(n,`safeExecuteInTheMiddle`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddle}}),Object.defineProperty(n,`safeExecuteInTheMiddleAsync`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddleAsync}});var w=require_semconvStability$1();Object.defineProperty(n,`SemconvStability`,{enumerable:!0,get:function(){return w.SemconvStability}}),Object.defineProperty(n,`semconvStabilityFromStr`,{enumerable:!0,get:function(){return w.semconvStabilityFromStr}})}));init_esm$2();var import_src$22=require_src$31(),majorVersion={name:`@prisma/instrumentation-contract`,version:`7.6.0`,description:`Shared types and utilities for Prisma instrumentation`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.mts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation-contract`},bugs:`https://github.com/prisma/prisma/issues`,scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},files:[`dist`],sideEffects:!1,devDependencies:{"@opentelemetry/api":`1.9.0`},peerDependencies:{"@opentelemetry/api":`^1.8`}}.version.split(`.`)[0],GLOBAL_INSTRUMENTATION_KEY=`PRISMA_INSTRUMENTATION`,GLOBAL_VERSIONED_INSTRUMENTATION_KEY=`V${majorVersion}_PRISMA_INSTRUMENTATION`,globalThisWithPrismaInstrumentation=globalThis;function getGlobalTracingHelper(){let n=globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];return n?.helper?n.helper:globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]?.helper}function setGlobalTracingHelper(n){let c={helper:n};globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY]=c,globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]=c}function clearGlobalTracingHelper(){delete globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY],delete globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]}var showAllTraces=process.env.PRISMA_SHOW_ALL_TRACES===`true`,nonSampledTraceParent=`00-10-10-00`;function engineSpanKindToOtelSpanKind(n){switch(n){case`client`:return SpanKind.CLIENT;default:return SpanKind.INTERNAL}}var ActiveTracingHelper=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:n,ignoreSpanTypes:c}){this.tracerProvider=n,this.ignoreSpanTypes=c}isEnabled(){return!0}getTraceParent(n){let c=trace.getSpanContext(n??context$1.active());return c?`00-${c.traceId}-${c.spanId}-0${c.traceFlags}`:nonSampledTraceParent}dispatchEngineSpans(n){let c=this.tracerProvider.getTracer(`prisma`),u=new Map,p=n.filter(n=>n.parentId===null);for(let h of p)dispatchEngineSpan(c,h,n,u,this.ignoreSpanTypes)}getActiveContext(){return context$1.active()}runInChildSpan(n,c){if(typeof n==`string`&&(n={name:n}),n.internal&&!showAllTraces)return c();let u=this.tracerProvider.getTracer(`prisma`),p=n.context??this.getActiveContext(),h=`prisma:client:${n.name}`;if(shouldIgnoreSpan(h,this.ignoreSpanTypes))return c();if(n.active===!1){let x=u.startSpan(h,n,p);return endSpan(x,c(x,p))}return u.startActiveSpan(h,n,n=>endSpan(n,c(n,p)))}};function dispatchEngineSpan(n,c,u,p,h){if(shouldIgnoreSpan(c.name,h))return;let x={attributes:c.attributes,kind:engineSpanKindToOtelSpanKind(c.kind),startTime:c.startTime};n.startActiveSpan(c.name,x,x=>{p.set(c.id,x.spanContext().spanId),c.links&&x.addLinks(c.links.flatMap(n=>{let c=p.get(n);return c?{context:{spanId:c,traceId:x.spanContext().traceId,traceFlags:x.spanContext().traceFlags}}:[]}));let w=u.filter(n=>n.parentId===c.id);for(let c of w)dispatchEngineSpan(n,c,u,p,h);x.end(c.endTime)})}function endSpan(n,c){return isPromiseLike(c)?c.then(c=>(n.end(),c),c=>{throw n.end(),c}):(n.end(),c)}function isPromiseLike(n){return n!=null&&typeof n.then==`function`}function shouldIgnoreSpan(n,c){return c.some(c=>typeof c==`string`?c===n:c.test(n))}var package_default2={name:`@prisma/instrumentation`,version:`7.6.0`,description:`OpenTelemetry compliant instrumentation for Prisma Client`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.ts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation`},bugs:`https://github.com/prisma/prisma/issues`,devDependencies:{"@opentelemetry/api":`1.9.0`,"@prisma/instrumentation-contract":`workspace:*`,"@types/node":`~20.19.24`,typescript:`5.4.5`},dependencies:{"@opentelemetry/instrumentation":`^0.207.0`},peerDependencies:{"@opentelemetry/api":`^1.8`},files:[`dist`],keywords:[`prisma`,`instrumentation`,`opentelemetry`,`otel`],scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},sideEffects:!1},VERSION$1=package_default2.version,NAME=package_default2.name,MODULE_NAME=`@prisma/client`,PrismaInstrumentation=class extends import_src$22.InstrumentationBase{tracerProvider;constructor(n={}){super(NAME,VERSION$1,n)}setTracerProvider(n){this.tracerProvider=n}init(){return[new import_src$22.InstrumentationNodeModuleDefinition(MODULE_NAME,[VERSION$1])]}enable(){let n=this._config;setGlobalTracingHelper(new ActiveTracingHelper({tracerProvider:this.tracerProvider??trace.getTracerProvider(),ignoreSpanTypes:n.ignoreSpanTypes??[]}))}disable(){clearGlobalTracingHelper()}isEnabled(){return getGlobalTracingHelper()!==void 0}};init_esm$2();const INTEGRATION_NAME$9=`Prisma`;function isPrismaV6TracingHelper(n){return!!n&&typeof n==`object`&&`dispatchEngineSpans`in n}function getPrismaTracingHelper(){let n=globalThis.PRISMA_INSTRUMENTATION;return n&&typeof n==`object`&&`helper`in n?n.helper:void 0}var SentryPrismaInteropInstrumentation=class extends PrismaInstrumentation{constructor(n){super(n?.instrumentationConfig)}enable(){super.enable();let n=getPrismaTracingHelper();isPrismaV6TracingHelper(n)&&(n.createEngineSpan=n=>{let c=trace.getTracer(`prismaV5Compatibility`),u=c._idGenerator;if(!u){consoleSandbox(()=>{console.warn(`[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!`)});return}try{n.spans.forEach(n=>{let p=engineSpanKindToOTELSpanKind(n.kind),h=n.parent_span_id,x=n.span_id,w=n.trace_id,T=n.links?.map(n=>({context:{traceId:n.trace_id,spanId:n.span_id,traceFlags:TraceFlags.SAMPLED}})),O=trace.setSpanContext(context$1.active(),{traceId:w,spanId:h,traceFlags:TraceFlags.SAMPLED});context$1.with(O,()=>{c._idGenerator={generateTraceId:()=>w,generateSpanId:()=>x},c.startSpan(n.name,{kind:p,links:T,startTime:n.start_time,attributes:n.attributes}).end(n.end_time),c._idGenerator=u})})}finally{c._idGenerator=u}})}};function engineSpanKindToOTELSpanKind(n){switch(n){case`client`:return SpanKind.CLIENT;default:return SpanKind.INTERNAL}}const instrumentPrisma=generateInstrumentOnce(INTEGRATION_NAME$9,n=>new SentryPrismaInteropInstrumentation(n)),prismaIntegration=defineIntegration(n=>({name:INTEGRATION_NAME$9,setupOnce(){instrumentPrisma(n)},setup(n){getPrismaTracingHelper()&&n.on(`spanStart`,n=>{let c=spanToJSON(n);c.description?.startsWith(`prisma:`)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.prisma`),(c.description===`prisma:engine:db_query`||c.description===`prisma:client:db_query`)&&c.data[`db.query.text`]&&n.updateName(c.data[`db.query.text`]),c.description===`prisma:engine:db_query`&&!c.data[`db.system`]&&n.setAttribute(`db.system`,`prisma`)})}}));var require_suppress_tracing$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$7();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6(),p=require_constants$7(),h=require_utils$24();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$6().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$15(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$16();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$6();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$6();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$6();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$18();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$18(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$6(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6(),p=require_TraceState$6();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$6(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$6();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$30=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$6();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$6();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$6();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$6();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$6();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$6();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$6();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$6();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$24();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$18();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$6();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$6();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$6();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$6();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$6();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$6();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$6();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$6();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$6();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$6();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$6()._export}})),require_version$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-hapi`})),require_internal_types$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.HapiLifecycleMethodNames=n.HapiLayerType=n.handlerPatched=n.HapiComponentName=void 0,n.HapiComponentName=`@hapi/hapi`,n.handlerPatched=Symbol(`hapi-handler-patched`),n.HapiLayerType={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},n.HapiLifecycleMethodNames=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`])})),require_semconv$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_HTTP_METHOD=void 0,n.ATTR_HTTP_METHOD=`http.method`})),require_AttributeNames$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.HAPI_TYPE=`hapi.type`,n.PLUGIN_NAME=`hapi.plugin.name`,n.EXT_TYPE=`server.ext.type`})(n.AttributeNames||={})})),require_utils$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getPluginFromInput=n.getExtMetadata=n.getRouteMetadata=n.isPatchableExtMethod=n.isDirectExtInput=n.isLifecycleExtEventObj=n.isLifecycleExtType=n.getPluginName=void 0;let c=(init_esm$1(),__toCommonJS(esm_exports$1)),u=require_semconv$15(),p=require_internal_types$3(),h=require_AttributeNames$2(),x=require_src$52();function w(n){return n.name?n.name:n.pkg.name}n.getPluginName=w,n.isLifecycleExtType=n=>typeof n==`string`&&p.HapiLifecycleMethodNames.has(n),n.isLifecycleExtEventObj=c=>{let u=c?.type;return u!==void 0&&(0,n.isLifecycleExtType)(u)},n.isDirectExtInput=c=>Array.isArray(c)&&c.length<=3&&(0,n.isLifecycleExtType)(c[0])&&typeof c[1]==`function`,n.isPatchableExtMethod=n=>!Array.isArray(n),n.getRouteMetadata=(n,w,T)=>{let O={[c.ATTR_HTTP_ROUTE]:n.path};w&x.SemconvStability.OLD&&(O[u.ATTR_HTTP_METHOD]=n.method),w&x.SemconvStability.STABLE&&(O[c.ATTR_HTTP_REQUEST_METHOD]=n.method);let A;return T?(O[h.AttributeNames.HAPI_TYPE]=p.HapiLayerType.PLUGIN,O[h.AttributeNames.PLUGIN_NAME]=T,A=`${T}: route - ${n.path}`):(O[h.AttributeNames.HAPI_TYPE]=p.HapiLayerType.ROUTER,A=`route - ${n.path}`),{attributes:O,name:A}},n.getExtMetadata=(n,c,u)=>{let x=`ext - ${n}`;return u&&u!==`method`&&(x=`ext - ${n} - ${u}`),c?{attributes:{[h.AttributeNames.EXT_TYPE]:n,[h.AttributeNames.HAPI_TYPE]:p.HapiLayerType.EXT,[h.AttributeNames.PLUGIN_NAME]:c},name:`${c}: ${x}`}:{attributes:{[h.AttributeNames.EXT_TYPE]:n,[h.AttributeNames.HAPI_TYPE]:p.HapiLayerType.EXT},name:x}},n.getPluginFromInput=n=>`plugin`in n?`plugin`in n.plugin?n.plugin.plugin:n.plugin:n})),require_instrumentation$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.HapiInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$30(),p=require_src$52(),h=require_version$14(),x=require_internal_types$3(),w=require_utils$23();n.HapiInstrumentation=class extends p.InstrumentationBase{_semconvStability;constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n),this._semconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new p.InstrumentationNodeModuleDefinition(x.HapiComponentName,[`>=17.0.0 <22`],n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;return(0,p.isWrapped)(c.server)||this._wrap(c,`server`,this._getServerPatch.bind(this)),(0,p.isWrapped)(c.Server)||this._wrap(c,`Server`,this._getServerPatch.bind(this)),c},n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;this._massUnwrap([c],[`server`,`Server`])})}_getServerPatch(n){let c=this,u=this;return function(p){let h=n.apply(this,[p]);return u._wrap(h,`route`,n=>c._getServerRoutePatch.bind(c)(n)),u._wrap(h,`ext`,n=>c._getServerExtPatch.bind(c)(n)),u._wrap(h,`register`,c._getServerRegisterPatch.bind(c)),h}}_getServerRegisterPatch(n){let c=this;return function(u,p){if(Array.isArray(u))for(let n of u){let u=(0,w.getPluginFromInput)(n);c._wrapRegisterHandler(u)}else{let n=(0,w.getPluginFromInput)(u);c._wrapRegisterHandler(n)}return n.apply(this,[u,p])}}_getServerExtPatch(n,c){let u=this;return function(...p){if(Array.isArray(p[0])){let h=p[0];for(let n=0;n<h.length;n++){let p=h[n];if((0,w.isLifecycleExtType)(p.type)){let x=p;x.method=u._wrapExtMethods(x.method,p.type,c),h[n]=x}}return n.apply(this,p)}else if((0,w.isDirectExtInput)(p)){let h=p,x=h[1],w=u._wrapExtMethods(x,h[0],c);return n.apply(this,[h[0],w,h[2]])}else if((0,w.isLifecycleExtEventObj)(p[0])){let h=p[0];return h.method=u._wrapExtMethods(h.method,h.type,c),n.call(this,h)}return n.apply(this,p)}}_getServerRoutePatch(n,c){let u=this;return function(p){if(Array.isArray(p))for(let n=0;n<p.length;n++){let h=u._wrapRouteHandler.call(u,p[n],c);p[n]=h}else p=u._wrapRouteHandler.call(u,p,c);return n.apply(this,[p])}}_wrapRegisterHandler(n){let c=this,u=(0,w.getPluginName)(n),p=n.register,h=this;n.register=function(n,x){return h._wrap(n,`route`,n=>c._getServerRoutePatch.bind(c)(n,u)),h._wrap(n,`ext`,n=>c._getServerExtPatch.bind(c)(n,u)),p.call(this,n,x)}}_wrapExtMethods(n,u,p){let h=this;if(n instanceof Array){for(let c=0;c<n.length;c++)n[c]=h._wrapExtMethods(n[c],u);return n}else if((0,w.isPatchableExtMethod)(n))return n[x.handlerPatched]===!0?n:(n[x.handlerPatched]=!0,async function(...x){if(c.trace.getSpan(c.context.active())===void 0)return await n.apply(this,x);let T=(0,w.getExtMetadata)(u,p,n.name),O=h.tracer.startSpan(T.name,{attributes:T.attributes});try{return await c.context.with(c.trace.setSpan(c.context.active(),O),n,void 0,...x)}catch(n){throw O.recordException(n),O.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),n}finally{O.end()}});return n}_wrapRouteHandler(n,p){let h=this;if(n[x.handlerPatched]===!0)return n;n[x.handlerPatched]=!0;let T=x=>async function(...T){if(c.trace.getSpan(c.context.active())===void 0)return await x.call(this,...T);let O=(0,u.getRPCMetadata)(c.context.active());O?.type===u.RPCType.HTTP&&(O.route=n.path);let A=(0,w.getRouteMetadata)(n,h._semconvStability,p),j=h.tracer.startSpan(A.name,{attributes:A.attributes});try{return await c.context.with(c.trace.setSpan(c.context.active(),j),()=>x.call(this,...T))}catch(n){throw j.recordException(n),j.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),n}finally{j.end()}};if(typeof n.handler==`function`)n.handler=T(n.handler);else if(typeof n.options==`function`){let c=n.options;n.options=function(n){let u=c(n);return typeof u.handler==`function`&&(u.handler=T(u.handler)),u}}else typeof n.options?.handler==`function`&&(n.options.handler=T(n.options.handler));return n}}})),require_src$29=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=n.HapiInstrumentation=void 0;var c=require_instrumentation$6();Object.defineProperty(n,`HapiInstrumentation`,{enumerable:!0,get:function(){return c.HapiInstrumentation}});var u=require_AttributeNames$2();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}})})),import_src$21=require_src$29();const INTEGRATION_NAME$8=`Hapi`,instrumentHapi=generateInstrumentOnce(INTEGRATION_NAME$8,()=>new import_src$21.HapiInstrumentation),_hapiIntegration=(()=>({name:INTEGRATION_NAME$8,setupOnce(){instrumentHapi()}})),hapiIntegration=defineIntegration(_hapiIntegration),AttributeNames={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},HonoTypes={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};init_esm$2();const PACKAGE_NAME=`@sentry/instrumentation-hono`,PACKAGE_VERSION=`0.0.1`;var HonoInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(PACKAGE_NAME,PACKAGE_VERSION,n)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`hono`,[`>=4.0.0 <5`],n=>this._patch(n))]}_patch(n){let c=this;class u extends n.Hono{constructor(...n){super(...n),c._wrap(this,`get`,c._patchHandler()),c._wrap(this,`post`,c._patchHandler()),c._wrap(this,`put`,c._patchHandler()),c._wrap(this,`delete`,c._patchHandler()),c._wrap(this,`options`,c._patchHandler()),c._wrap(this,`patch`,c._patchHandler()),c._wrap(this,`all`,c._patchHandler()),c._wrap(this,`on`,c._patchOnHandler()),c._wrap(this,`use`,c._patchMiddlewareHandler())}}try{n.Hono=u}catch{return{...n,Hono:u}}return n}_patchHandler(){let n=this;return function(c){return function(...u){if(typeof u[0]==`string`){let p=u[0];if(u.length===1)return c.apply(this,[p]);let h=u.slice(1);return c.apply(this,[p,...h.map(c=>n._wrapHandler(c))])}return c.apply(this,u.map(c=>n._wrapHandler(c)))}}}_patchOnHandler(){let n=this;return function(c){return function(...u){let p=u.slice(2);return c.apply(this,[...u.slice(0,2),...p.map(c=>n._wrapHandler(c))])}}}_patchMiddlewareHandler(){let n=this;return function(c){return function(...u){if(typeof u[0]==`string`){let p=u[0];if(u.length===1)return c.apply(this,[p]);let h=u.slice(1);return c.apply(this,[p,...h.map(c=>n._wrapHandler(c))])}return c.apply(this,u.map(c=>n._wrapHandler(c)))}}}_wrapHandler(n){let c=this;return function(u,p){if(!c.isEnabled())return n.apply(this,[u,p]);let h=u.req.path,x=c.tracer.startSpan(h);return context$1.with(trace.setSpan(context$1.active(),x),()=>c._safeExecute(()=>{let w=n.apply(this,[u,p]);if(isThenable(w))return w.then(u=>{let p=c._determineHandlerType(u);return x.setAttributes({[AttributeNames.HONO_TYPE]:p,[AttributeNames.HONO_NAME]:p===HonoTypes.REQUEST_HANDLER?h:n.name||`anonymous`}),c.getConfig().responseHook?.(x),u});{let u=c._determineHandlerType(w);return x.setAttributes({[AttributeNames.HONO_TYPE]:u,[AttributeNames.HONO_NAME]:u===HonoTypes.REQUEST_HANDLER?h:n.name||`anonymous`}),c.getConfig().responseHook?.(x),w}},()=>x.end(),n=>{c._handleError(x,n),x.end()}))}}_safeExecute(n,c,u){try{let p=n();return isThenable(p)?p.then(()=>c(),n=>u(n)):c(),p}catch(n){throw u(n),n}}_determineHandlerType(n){return n===void 0?HonoTypes.MIDDLEWARE:HonoTypes.REQUEST_HANDLER}_handleError(n,c){c instanceof Error&&(n.setStatus({code:SpanStatusCode.ERROR,message:c.message}),n.recordException(c))}};init_esm$1();const INTEGRATION_NAME$7=`Hono`;function addHonoSpanAttributes(n){let c=spanToJSON(n).data,u=c[AttributeNames.HONO_TYPE];if(c[`sentry.op`]||!u)return;n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.hono`,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`${u}.hono`});let p=c[AttributeNames.HONO_NAME];if(typeof p==`string`&&n.updateName(p),getIsolationScope()===getDefaultIsolationScope()){DEBUG_BUILD&&debug.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let h=c[ATTR_HTTP_ROUTE],x=c[ATTR_HTTP_REQUEST_METHOD];typeof h==`string`&&typeof x==`string`&&getIsolationScope().setTransactionName(`${x} ${h}`)}const instrumentHono=generateInstrumentOnce(INTEGRATION_NAME$7,()=>new HonoInstrumentation({responseHook:n=>{addHonoSpanAttributes(n)}})),_honoIntegration=(()=>({name:INTEGRATION_NAME$7,setupOnce(){instrumentHono()}})),honoIntegration=defineIntegration(_honoIntegration);var require_types$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaLayerType=void 0,(function(n){n.ROUTER=`router`,n.MIDDLEWARE=`middleware`})(n.KoaLayerType||={})})),require_version$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.62.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-koa`})),require_AttributeNames$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.KOA_TYPE=`koa.type`,n.KOA_NAME=`koa.name`})(n.AttributeNames||={})})),require_utils$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isLayerIgnored=n.getMiddlewareMetadata=void 0;let c=require_types$5(),u=require_AttributeNames$1(),p=(init_esm$1(),__toCommonJS(esm_exports$1));n.getMiddlewareMetadata=(n,h,x,w)=>x?{attributes:{[u.AttributeNames.KOA_NAME]:w?.toString(),[u.AttributeNames.KOA_TYPE]:c.KoaLayerType.ROUTER,[p.ATTR_HTTP_ROUTE]:w?.toString()},name:n._matchedRouteName||`router - ${w}`}:{attributes:{[u.AttributeNames.KOA_NAME]:h.name??`middleware`,[u.AttributeNames.KOA_TYPE]:c.KoaLayerType.MIDDLEWARE},name:`middleware - ${h.name}`},n.isLayerIgnored=(n,c)=>!!(Array.isArray(c?.ignoreLayersType)&&c?.ignoreLayersType?.includes(n))})),require_suppress_tracing$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$6();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5(),p=require_constants$6(),h=require_utils$21();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$5().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$12(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$14();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$5();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$5();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$5();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$17();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$17(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$5(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5(),p=require_TraceState$5();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$5(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$5();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$28=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$5();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$5();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$5();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$5();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$5();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$5();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$5();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$5();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$21();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$17();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$5();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$5();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$5();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$5();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$5();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$5();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$5();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$5();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$5();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$5();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$5()._export}})),require_internal_types$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.kLayerPatched=void 0,n.kLayerPatched=Symbol(`koa-layer-patched`)})),require_instrumentation$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_types$5(),h=require_version$13(),x=require_utils$22(),w=require_src$28(),T=require_internal_types$2();n.KoaInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n)}init(){return new u.InstrumentationNodeModuleDefinition(`koa`,[`>=2.0.0 <4`],n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;return c==null?c:((0,u.isWrapped)(c.prototype.use)&&this._unwrap(c.prototype,`use`),this._wrap(c.prototype,`use`,this._getKoaUsePatch.bind(this)),n)},n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;(0,u.isWrapped)(c.prototype.use)&&this._unwrap(c.prototype,`use`)})}_getKoaUsePatch(n){let c=this;return function(u){let p;return p=u.router?c._patchRouterDispatch(u):c._patchLayer(u,!1),n.apply(this,[p])}}_patchRouterDispatch(n){c.diag.debug(`Patching @koa/router dispatch`);let u=n.router?.stack??[];for(let n of u){let c=n.path,u=n.stack;for(let n=0;n<u.length;n++){let p=u[n];u[n]=this._patchLayer(p,!0,c)}}return n}_patchLayer(n,h,O){let A=h?p.KoaLayerType.ROUTER:p.KoaLayerType.MIDDLEWARE;return n[T.kLayerPatched]===!0||(0,x.isLayerIgnored)(A,this.getConfig())?n:n.constructor.name===`GeneratorFunction`||n.constructor.name===`AsyncGeneratorFunction`?(c.diag.debug(`ignoring generator-based Koa middleware layer`),n):(n[T.kLayerPatched]=!0,c.diag.debug(`patching Koa middleware layer`),async(p,T)=>{if(c.trace.getSpan(c.context.active())===void 0)return n(p,T);let j=(0,x.getMiddlewareMetadata)(p,n,h,O),N=this.tracer.startSpan(j.name,{attributes:j.attributes}),I=(0,w.getRPCMetadata)(c.context.active());I?.type===w.RPCType.HTTP&&p._matchedRoute&&(I.route=p._matchedRoute.toString());let{requestHook:L}=this.getConfig();L&&(0,u.safeExecuteInTheMiddle)(()=>L(N,{context:p,middlewareLayer:n,layerType:A}),n=>{n&&c.diag.error(`koa instrumentation: request hook failed`,n)},!0);let z=c.trace.setSpan(c.context.active(),N);return c.context.with(z,async()=>{try{return await n(p,T)}catch(n){throw N.recordException(n),n}finally{N.end()}})})}}})),require_src$27=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaLayerType=n.AttributeNames=n.KoaInstrumentation=void 0;var c=require_instrumentation$5();Object.defineProperty(n,`KoaInstrumentation`,{enumerable:!0,get:function(){return c.KoaInstrumentation}});var u=require_AttributeNames$1();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}});var p=require_types$5();Object.defineProperty(n,`KoaLayerType`,{enumerable:!0,get:function(){return p.KoaLayerType}})})),import_src$20=require_src$27();init_esm$1();const INTEGRATION_NAME$6=`Koa`,instrumentKoa=generateInstrumentOnce(INTEGRATION_NAME$6,import_src$20.KoaInstrumentation,(n={})=>({ignoreLayersType:n.ignoreLayersType,requestHook(n,c){addOriginToSpan(n,`auto.http.otel.koa`);let u=spanToJSON(n).data,p=u[`koa.type`];p&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`${p}.koa`);let h=u[`koa.name`];if(typeof h==`string`&&n.updateName(h||`< unknown >`),getIsolationScope()===getDefaultIsolationScope()){DEBUG_BUILD&&debug.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let x=u[ATTR_HTTP_ROUTE],w=c.context?.request?.method?.toUpperCase()||`GET`;x&&getIsolationScope().setTransactionName(`${w} ${x}`)}})),_koaIntegration=((n={})=>({name:INTEGRATION_NAME$6,setupOnce(){instrumentKoa(n)}})),koaIntegration=defineIntegration(_koaIntegration);var require_suppress_tracing$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$5();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4(),p=require_constants$5(),h=require_utils$20();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$4().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$11(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$13();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$4();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$4();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$4();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$16();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$16(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$4(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4(),p=require_TraceState$4();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$4(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$4();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$4();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$4();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$4();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$4();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$4();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$4();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$4();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$4();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$20();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$16();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$4();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$4();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$4();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$4();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$4();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$4();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$4();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$4();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$4();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$4();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$4()._export}})),require_AttributeNames=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectNames=n.ConnectTypes=n.AttributeNames=void 0,(function(n){n.CONNECT_TYPE=`connect.type`,n.CONNECT_NAME=`connect.name`})(n.AttributeNames||={}),(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request_handler`})(n.ConnectTypes||={}),(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request handler`})(n.ConnectNames||={})})),require_version$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.57.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-connect`})),require_internal_types$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._LAYERS_STORE_PROPERTY=void 0,n._LAYERS_STORE_PROPERTY=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`)})),require_utils$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.generateRoute=n.replaceCurrentStackRoute=n.addNewStackLayer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_internal_types$1();n.addNewStackLayer=n=>{Array.isArray(n[u._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(n,u._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),n[u._LAYERS_STORE_PROPERTY].push(`/`);let p=n[u._LAYERS_STORE_PROPERTY].length;return()=>{p===n[u._LAYERS_STORE_PROPERTY].length?n[u._LAYERS_STORE_PROPERTY].pop():c.diag.warn(`Connect: Trying to pop the stack multiple time`)}},n.replaceCurrentStackRoute=(n,c)=>{c&&n[u._LAYERS_STORE_PROPERTY].splice(-1,1,c)},n.generateRoute=n=>n[u._LAYERS_STORE_PROPERTY].reduce((n,c)=>n.replace(/\/+$/,``)+c)})),require_instrumentation$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectInstrumentation=n.ANONYMOUS_NAME=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$26(),p=require_AttributeNames(),h=require_version$10(),x=require_src$52(),w=(init_esm$1(),__toCommonJS(esm_exports$1)),T=require_utils$19();n.ANONYMOUS_NAME=`anonymous`,n.ConnectInstrumentation=class extends x.InstrumentationBase{constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n)}init(){return[new x.InstrumentationNodeModuleDefinition(`connect`,[`>=3.0.0 <4`],n=>this._patchConstructor(n))]}_patchApp(n){(0,x.isWrapped)(n.use)||this._wrap(n,`use`,this._patchUse.bind(this)),(0,x.isWrapped)(n.handle)||this._wrap(n,`handle`,this._patchHandle.bind(this))}_patchConstructor(n){let c=this;return function(...u){let p=n.apply(this,u);return c._patchApp(p),p}}_patchNext(n,c){return function(u){let p=n.apply(this,[u]);return c(),p}}_startSpan(c,u){let h,x,T;c?(h=p.ConnectTypes.REQUEST_HANDLER,T=p.ConnectNames.REQUEST_HANDLER,x=c):(h=p.ConnectTypes.MIDDLEWARE,T=p.ConnectNames.MIDDLEWARE,x=u.name||n.ANONYMOUS_NAME);let O=`${T} - ${x}`,A={attributes:{[w.ATTR_HTTP_ROUTE]:c.length>0?c:`/`,[p.AttributeNames.CONNECT_TYPE]:h,[p.AttributeNames.CONNECT_NAME]:x}};return this.tracer.startSpan(O,A)}_patchMiddleware(p,h){let x=this,w=h.length===4;function O(){if(!x.isEnabled())return h.apply(this,arguments);let[O,A,j]=w?[1,2,3]:[0,1,2],N=arguments[O],I=arguments[A],L=arguments[j];(0,T.replaceCurrentStackRoute)(N,p);let z=(0,u.getRPCMetadata)(c.context.active());p&&z?.type===u.RPCType.HTTP&&(z.route=(0,T.generateRoute)(N));let B=``;B=p?`request handler - ${p}`:`middleware - ${h.name||n.ANONYMOUS_NAME}`;let V=x._startSpan(p,h);x._diag.debug(`start span`,B);let H=!1;function U(){H?x._diag.debug(`span ${V.name} - already finished`):(H=!0,x._diag.debug(`finishing span ${V.name}`),V.end()),I.removeListener(`close`,U)}return I.addListener(`close`,U),arguments[j]=x._patchNext(L,U),h.apply(this,arguments)}return Object.defineProperty(O,`length`,{value:h.length,writable:!1,configurable:!0}),O}_patchUse(n){let c=this;return function(...u){let p=u[u.length-1],h=u[u.length-2]||``;return u[u.length-1]=c._patchMiddleware(h,p),n.apply(this,u)}}_patchHandle(n){let c=this;return function(){let[u,p]=[0,2],h=arguments[u],x=arguments[p],w=(0,T.addNewStackLayer)(h);return typeof x==`function`&&(arguments[p]=c._patchOut(x,w)),n.apply(this,arguments)}}_patchOut(n,c){return function(...u){return c(),Reflect.apply(n,this,u)}}}})),require_src$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectTypes=n.ConnectNames=n.AttributeNames=n.ANONYMOUS_NAME=n.ConnectInstrumentation=void 0;var c=require_instrumentation$4();Object.defineProperty(n,`ConnectInstrumentation`,{enumerable:!0,get:function(){return c.ConnectInstrumentation}}),Object.defineProperty(n,`ANONYMOUS_NAME`,{enumerable:!0,get:function(){return c.ANONYMOUS_NAME}});var u=require_AttributeNames();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}}),Object.defineProperty(n,`ConnectNames`,{enumerable:!0,get:function(){return u.ConnectNames}}),Object.defineProperty(n,`ConnectTypes`,{enumerable:!0,get:function(){return u.ConnectTypes}})})),import_src$19=require_src$25();const INTEGRATION_NAME$5=`Connect`,instrumentConnect=generateInstrumentOnce(INTEGRATION_NAME$5,()=>new import_src$19.ConnectInstrumentation),_connectIntegration=(()=>({name:INTEGRATION_NAME$5,setupOnce(){instrumentConnect()}})),connectIntegration=defineIntegration(_connectIntegration);var require_semconv$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_VALUE_MSSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_SQL_TABLE=n.ATTR_DB_NAME=void 0,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_SQL_TABLE=`db.sql.table`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MSSQL=`mssql`})),require_utils$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.once=n.getSpanName=void 0;function c(n,c,u,p){return n===`execBulkLoad`&&p&&c?`${n} ${p} ${c}`:n===`callProcedure`?c?`${n} ${u} ${c}`:`${n} ${u}`:c?`${n} ${c}`:`${n}`}n.getSpanName=c,n.once=n=>{let c=!1;return(...u)=>{if(!c)return c=!0,n(...u)}}})),require_version$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.33.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-tedious`})),require_instrumentation$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TediousInstrumentation=n.INJECTED_CTX=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`events`),p=require_src$52(),h=(init_esm$1(),__toCommonJS(esm_exports$1)),x=require_semconv$12(),w=require_utils$18(),T=require_version$9(),O=Symbol(`opentelemetry.instrumentation-tedious.current-database`);n.INJECTED_CTX=Symbol(`opentelemetry.instrumentation-tedious.context-info-injected`);let A=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function j(n){Object.defineProperty(this,O,{value:n,writable:!0})}n.TediousInstrumentation=class N extends p.InstrumentationBase{static COMPONENT=`tedious`;_netSemconvStability;_dbSemconvStability;constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,p.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new p.InstrumentationNodeModuleDefinition(N.COMPONENT,[`>=1.11.0 <20`],n=>{let c=n.Connection.prototype;for(let u of A)(0,p.isWrapped)(c[u])&&this._unwrap(c,u),this._wrap(c,u,this._patchQuery(u,n));return(0,p.isWrapped)(c.connect)&&this._unwrap(c,`connect`),this._wrap(c,`connect`,this._patchConnect),n},n=>{if(n===void 0)return;let c=n.Connection.prototype;for(let n of A)this._unwrap(c,n);this._unwrap(c,`connect`)})]}_patchConnect(n){return function(){return j.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,j),this.on(`databaseChange`,j),this.once(`end`,()=>{this.removeListener(`databaseChange`,j)}),n.apply(this,arguments)}}_buildTraceparent(n){let u=n.spanContext();return`00-${u.traceId}-${u.spanId}-0${Number(u.traceFlags||c.TraceFlags.NONE).toString(16)}`}_injectContextInfo(c,u,p){return new Promise(h=>{try{let x=new u.Request(`set context_info @opentelemetry_traceparent`,n=>{h()});Object.defineProperty(x,n.INJECTED_CTX,{value:!0});let w=Buffer.from(p,`utf8`);x.addParameter(`opentelemetry_traceparent`,u.TYPES.VarBinary,w,{length:w.length}),c.execSql(x)}catch{h()}})}_shouldInjectFor(n){return n===`execSql`||n===`execSqlBatch`||n===`callProcedure`||n===`execute`}_patchQuery(T,A){return j=>{let N=this;function I(I){if(I?.[n.INJECTED_CTX])return j.apply(this,arguments);if(!(I instanceof u.EventEmitter))return N._diag.warn(`Unexpected invocation of patched ${T} method. Span not recorded`),j.apply(this,arguments);let L=0,z=0,B=()=>z++,V=()=>L++,H=this[O],U=(n=>n.sqlTextOrProcedure===`sp_prepare`&&n.parametersByName?.stmt?.value?n.parametersByName.stmt.value:n.sqlTextOrProcedure)(I),W={};N._dbSemconvStability&p.SemconvStability.OLD&&(W[x.ATTR_DB_SYSTEM]=x.DB_SYSTEM_VALUE_MSSQL,W[x.ATTR_DB_NAME]=H,W[x.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,W[x.ATTR_DB_STATEMENT]=U,W[x.ATTR_DB_SQL_TABLE]=I.table),N._dbSemconvStability&p.SemconvStability.STABLE&&(W[h.ATTR_DB_NAMESPACE]=H,W[h.ATTR_DB_SYSTEM_NAME]=h.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,W[h.ATTR_DB_QUERY_TEXT]=U,W[h.ATTR_DB_COLLECTION_NAME]=I.table),N._netSemconvStability&p.SemconvStability.OLD&&(W[x.ATTR_NET_PEER_NAME]=this.config?.server,W[x.ATTR_NET_PEER_PORT]=this.config?.options?.port),N._netSemconvStability&p.SemconvStability.STABLE&&(W[h.ATTR_SERVER_ADDRESS]=this.config?.server,W[h.ATTR_SERVER_PORT]=this.config?.options?.port);let G=N.tracer.startSpan((0,w.getSpanName)(T,H,U,I.table),{kind:c.SpanKind.CLIENT,attributes:W}),K=(0,w.once)(n=>{I.removeListener(`done`,B),I.removeListener(`doneInProc`,B),I.removeListener(`doneProc`,V),I.removeListener(`error`,K),this.removeListener(`end`,K),G.setAttribute(`tedious.procedure_count`,L),G.setAttribute(`tedious.statement_count`,z),n&&G.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),G.end()});I.on(`done`,B),I.on(`doneInProc`,B),I.on(`doneProc`,V),I.once(`error`,K),this.on(`end`,K),typeof I.callback==`function`?N._wrap(I,`callback`,N._patchCallbackQuery(K)):N._diag.error(`Expected request.callback to be a function`);let ee=()=>c.context.with(c.trace.setSpan(c.context.active(),G),j,this,...arguments);if(!(N.getConfig().enableTraceContextPropagation&&N._shouldInjectFor(T)))return ee();let te=N._buildTraceparent(G);N._injectContextInfo(this,A,te).finally(ee)}return Object.defineProperty(I,`length`,{value:j.length,writable:!1}),I}}_patchCallbackQuery(n){return c=>function(u,p,h){return n(u),c.apply(this,arguments)}}}})),require_src$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TediousInstrumentation=void 0;var c=require_instrumentation$3();Object.defineProperty(n,`TediousInstrumentation`,{enumerable:!0,get:function(){return c.TediousInstrumentation}})})),import_src$18=require_src$24();const TEDIUS_INSTRUMENTED_METHODS=new Set([`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`]),INTEGRATION_NAME$4=`Tedious`,instrumentTedious=generateInstrumentOnce(INTEGRATION_NAME$4,()=>new import_src$18.TediousInstrumentation({})),_tediousIntegration=(()=>{let n;return{name:INTEGRATION_NAME$4,setupOnce(){n=instrumentWhenWrapped(instrumentTedious())},setup(c){n?.(()=>c.on(`spanStart`,n=>{let{description:c,data:u}=spanToJSON(n);if(!c||u[`db.system`]!==`mssql`)return;let p=c.split(` `)[0]||``;TEDIUS_INSTRUMENTED_METHODS.has(p)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.tedious`)}))}}}),tediousIntegration=defineIntegration(_tediousIntegration);var require_version$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.57.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-generic-pool`})),require_instrumentation$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GenericPoolInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_version$8(),h=`generic-pool`;n.GenericPoolInstrumentation=class extends u.InstrumentationBase{_isDisabled=!1;constructor(n={}){super(p.PACKAGE_NAME,p.PACKAGE_VERSION,n)}init(){return[new u.InstrumentationNodeModuleDefinition(h,[`>=3.0.0 <4`],n=>{let c=n.Pool;return(0,u.isWrapped)(c.prototype.acquire)&&this._unwrap(c.prototype,`acquire`),this._wrap(c.prototype,`acquire`,this._acquirePatcher.bind(this)),n},n=>{let c=n.Pool;return this._unwrap(c.prototype,`acquire`),n}),new u.InstrumentationNodeModuleDefinition(h,[`>=2.4.0 <3`],n=>{let c=n.Pool;return(0,u.isWrapped)(c.prototype.acquire)&&this._unwrap(c.prototype,`acquire`),this._wrap(c.prototype,`acquire`,this._acquireWithCallbacksPatcher.bind(this)),n},n=>{let c=n.Pool;return this._unwrap(c.prototype,`acquire`),n}),new u.InstrumentationNodeModuleDefinition(h,[`>=2.0.0 <2.4`],n=>(this._isDisabled=!1,(0,u.isWrapped)(n.Pool)&&this._unwrap(n,`Pool`),this._wrap(n,`Pool`,this._poolWrapper.bind(this)),n),n=>(this._isDisabled=!0,n))]}_acquirePatcher(n){let u=this;return function(...p){let h=c.context.active(),x=u.tracer.startSpan(`generic-pool.acquire`,{},h);return c.context.with(c.trace.setSpan(h,x),()=>n.call(this,...p).then(n=>(x.end(),n),n=>{throw x.recordException(n),x.end(),n}))}}_poolWrapper(n){let c=this;return function(){let u=n.apply(this,arguments);return c._wrap(u,`acquire`,c._acquireWithCallbacksPatcher.bind(c)),u}}_acquireWithCallbacksPatcher(n){let u=this;return function(p,h){if(u._isDisabled)return n.call(this,p,h);let x=c.context.active(),w=u.tracer.startSpan(`generic-pool.acquire`,{},x);return c.context.with(c.trace.setSpan(x,w),()=>{n.call(this,(n,c)=>{if(w.end(),p)return p(n,c)},h)})}}}})),require_src$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GenericPoolInstrumentation=void 0;var c=require_instrumentation$2();Object.defineProperty(n,`GenericPoolInstrumentation`,{enumerable:!0,get:function(){return c.GenericPoolInstrumentation}})})),import_src$17=require_src$23();const INTEGRATION_NAME$3=`GenericPool`,instrumentGenericPool=generateInstrumentOnce(INTEGRATION_NAME$3,()=>new import_src$17.GenericPoolInstrumentation({})),_genericPoolIntegration=(()=>{let n;return{name:INTEGRATION_NAME$3,setupOnce(){n=instrumentWhenWrapped(instrumentGenericPool())},setup(c){n?.(()=>c.on(`spanStart`,n=>{let c=spanToJSON(n).description;(c===`generic-pool.aquire`||c===`generic-pool.acquire`)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.generic_pool`)}))}}}),genericPoolIntegration=defineIntegration(_genericPoolIntegration);var require_suppress_tracing$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$4();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3(),p=require_constants$4(),h=require_utils$17();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$3().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$7(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$11();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$3();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$3();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$3();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$15();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$15(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$3(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3(),p=require_TraceState$3();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$3(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$3();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$3();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$3();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$3();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$3();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$3();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$3();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$3();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$3();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$17();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$15();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$3();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$3();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$3();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$3();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$3();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$3();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$3();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$3();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$3();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$3();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$3()._export}})),require_semconv$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_MESSAGING_SYSTEM=n.ATTR_MESSAGING_OPERATION=void 0,n.ATTR_MESSAGING_OPERATION=`messaging.operation`,n.ATTR_MESSAGING_SYSTEM=`messaging.system`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`})),require_semconv_obsolete=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_MESSAGING_CONVERSATION_ID=n.OLD_ATTR_MESSAGING_MESSAGE_ID=n.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=n.ATTR_MESSAGING_URL=n.ATTR_MESSAGING_PROTOCOL_VERSION=n.ATTR_MESSAGING_PROTOCOL=n.MESSAGING_OPERATION_VALUE_PROCESS=n.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=n.ATTR_MESSAGING_DESTINATION_KIND=n.ATTR_MESSAGING_DESTINATION=void 0,n.ATTR_MESSAGING_DESTINATION=`messaging.destination`,n.ATTR_MESSAGING_DESTINATION_KIND=`messaging.destination_kind`,n.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=`messaging.rabbitmq.routing_key`,n.MESSAGING_OPERATION_VALUE_PROCESS=`process`,n.ATTR_MESSAGING_PROTOCOL=`messaging.protocol`,n.ATTR_MESSAGING_PROTOCOL_VERSION=`messaging.protocol_version`,n.ATTR_MESSAGING_URL=`messaging.url`,n.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=`topic`,n.OLD_ATTR_MESSAGING_MESSAGE_ID=`messaging.message_id`,n.ATTR_MESSAGING_CONVERSATION_ID=`messaging.conversation_id`})),require_types$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DEFAULT_CONFIG=n.EndOperation=void 0,(function(n){n.AutoAck=`auto ack`,n.Ack=`ack`,n.AckAll=`ackAll`,n.Reject=`reject`,n.Nack=`nack`,n.NackAll=`nackAll`,n.ChannelClosed=`channel closed`,n.ChannelError=`channel error`,n.InstrumentationTimeout=`instrumentation timeout`})(n.EndOperation||={}),n.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}})),require_utils$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isConfirmChannelTracing=n.unmarkConfirmChannelTracing=n.markConfirmChannelTracing=n.getConnectionAttributesFromUrl=n.getConnectionAttributesFromServer=n.normalizeExchange=n.CONNECTION_ATTRIBUTES=n.CHANNEL_CONSUME_TIMEOUT_TIMER=n.CHANNEL_SPANS_NOT_ENDED=n.MESSAGE_STORED_SPAN=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$10(),x=require_semconv_obsolete();n.MESSAGE_STORED_SPAN=Symbol(`opentelemetry.amqplib.message.stored-span`),n.CHANNEL_SPANS_NOT_ENDED=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),n.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),n.CONNECTION_ATTRIBUTES=Symbol(`opentelemetry.amqplib.connection.attributes`);let w=(0,c.createContextKey)(`opentelemetry.amqplib.channel.is-confirm-channel`);n.normalizeExchange=n=>n===``?`<default>`:n;let T=n=>n.replace(/:[^:@/]*@/,`:***@`),O=(n,c)=>n||(c===`AMQP`?5672:5671),A=n=>{let c=n||`amqp`;return(c.endsWith(`:`)?c.substring(0,c.length-1):c).toUpperCase()},j=n=>n||`localhost`,N=(n,u,p,h)=>p?{[u]:p}:(c.diag.error(`amqplib instrumentation: could not extract connection attribute ${h} from user supplied url`,{url:n}),{});n.getConnectionAttributesFromServer=n=>{let c=n.serverProperties.product?.toLowerCase?.();return c?{[h.ATTR_MESSAGING_SYSTEM]:c}:{}},n.getConnectionAttributesFromUrl=(n,w)=>{let I={[x.ATTR_MESSAGING_PROTOCOL_VERSION]:`0.9.1`};if(n||=`amqp://localhost`,typeof n==`object`){let c=n,T=A(c?.protocol);Object.assign(I,{...N(n,x.ATTR_MESSAGING_PROTOCOL,T,`protocol`)});let L=j(c?.hostname);w&u.SemconvStability.OLD&&Object.assign(I,{...N(n,h.ATTR_NET_PEER_NAME,L,`hostname`)}),w&u.SemconvStability.STABLE&&Object.assign(I,{...N(n,p.ATTR_SERVER_ADDRESS,L,`hostname`)});let z=O(c.port,T);w&u.SemconvStability.OLD&&Object.assign(I,N(n,h.ATTR_NET_PEER_PORT,z,`port`)),w&u.SemconvStability.STABLE&&Object.assign(I,N(n,p.ATTR_SERVER_PORT,z,`port`))}else{let L=T(n);I[x.ATTR_MESSAGING_URL]=L;try{let n=new URL(L),c=A(n.protocol);Object.assign(I,{...N(L,x.ATTR_MESSAGING_PROTOCOL,c,`protocol`)});let T=j(n.hostname);w&u.SemconvStability.OLD&&Object.assign(I,{...N(L,h.ATTR_NET_PEER_NAME,T,`hostname`)}),w&u.SemconvStability.STABLE&&Object.assign(I,{...N(L,p.ATTR_SERVER_ADDRESS,T,`hostname`)});let z=O(n.port?parseInt(n.port):void 0,c);w&u.SemconvStability.OLD&&Object.assign(I,N(L,h.ATTR_NET_PEER_PORT,z,`port`)),w&u.SemconvStability.STABLE&&Object.assign(I,N(L,p.ATTR_SERVER_PORT,z,`port`))}catch(n){c.diag.error(`amqplib instrumentation: error while extracting connection details from connection url`,{censoredUrl:L,err:n})}}return I},n.markConfirmChannelTracing=n=>n.setValue(w,!0),n.unmarkConfirmChannelTracing=n=>n.deleteValue(w),n.isConfirmChannelTracing=n=>n.getValue(w)===!0})),require_version$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.61.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-amqplib`})),require_amqplib=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AmqplibInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$22(),p=require_src$52(),h=require_semconv$10(),x=require_semconv_obsolete(),w=require_types$4(),T=require_utils$16(),O=require_version$6(),A=[`>=0.5.5 <1`];n.AmqplibInstrumentation=class extends p.InstrumentationBase{_netSemconvStability;constructor(n={}){super(O.PACKAGE_NAME,O.PACKAGE_VERSION,{...w.DEFAULT_CONFIG,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...w.DEFAULT_CONFIG,...n})}init(){let n=new p.InstrumentationNodeModuleFile(`amqplib/lib/channel_model.js`,A,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),c=new p.InstrumentationNodeModuleFile(`amqplib/lib/callback_model.js`,A,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),u=new p.InstrumentationNodeModuleFile(`amqplib/lib/connect.js`,A,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new p.InstrumentationNodeModuleDefinition(`amqplib`,A,void 0,void 0,[n,u,c])}patchConnect(n){return n=this.unpatchConnect(n),(0,p.isWrapped)(n.connect)||this._wrap(n,`connect`,this.getConnectPatch.bind(this)),n}unpatchConnect(n){return(0,p.isWrapped)(n.connect)&&this._unwrap(n,`connect`),n}patchChannelModel(n,c){return(0,p.isWrapped)(n.Channel.prototype.publish)||this._wrap(n.Channel.prototype,`publish`,this.getPublishPatch.bind(this,c)),(0,p.isWrapped)(n.Channel.prototype.consume)||this._wrap(n.Channel.prototype,`consume`,this.getConsumePatch.bind(this,c)),(0,p.isWrapped)(n.Channel.prototype.ack)||this._wrap(n.Channel.prototype,`ack`,this.getAckPatch.bind(this,!1,w.EndOperation.Ack)),(0,p.isWrapped)(n.Channel.prototype.nack)||this._wrap(n.Channel.prototype,`nack`,this.getAckPatch.bind(this,!0,w.EndOperation.Nack)),(0,p.isWrapped)(n.Channel.prototype.reject)||this._wrap(n.Channel.prototype,`reject`,this.getAckPatch.bind(this,!0,w.EndOperation.Reject)),(0,p.isWrapped)(n.Channel.prototype.ackAll)||this._wrap(n.Channel.prototype,`ackAll`,this.getAckAllPatch.bind(this,!1,w.EndOperation.AckAll)),(0,p.isWrapped)(n.Channel.prototype.nackAll)||this._wrap(n.Channel.prototype,`nackAll`,this.getAckAllPatch.bind(this,!0,w.EndOperation.NackAll)),(0,p.isWrapped)(n.Channel.prototype.emit)||this._wrap(n.Channel.prototype,`emit`,this.getChannelEmitPatch.bind(this)),(0,p.isWrapped)(n.ConfirmChannel.prototype.publish)||this._wrap(n.ConfirmChannel.prototype,`publish`,this.getConfirmedPublishPatch.bind(this,c)),n}unpatchChannelModel(n){return(0,p.isWrapped)(n.Channel.prototype.publish)&&this._unwrap(n.Channel.prototype,`publish`),(0,p.isWrapped)(n.Channel.prototype.consume)&&this._unwrap(n.Channel.prototype,`consume`),(0,p.isWrapped)(n.Channel.prototype.ack)&&this._unwrap(n.Channel.prototype,`ack`),(0,p.isWrapped)(n.Channel.prototype.nack)&&this._unwrap(n.Channel.prototype,`nack`),(0,p.isWrapped)(n.Channel.prototype.reject)&&this._unwrap(n.Channel.prototype,`reject`),(0,p.isWrapped)(n.Channel.prototype.ackAll)&&this._unwrap(n.Channel.prototype,`ackAll`),(0,p.isWrapped)(n.Channel.prototype.nackAll)&&this._unwrap(n.Channel.prototype,`nackAll`),(0,p.isWrapped)(n.Channel.prototype.emit)&&this._unwrap(n.Channel.prototype,`emit`),(0,p.isWrapped)(n.ConfirmChannel.prototype.publish)&&this._unwrap(n.ConfirmChannel.prototype,`publish`),n}getConnectPatch(n){let c=this;return function(u,p,h){return n.call(this,u,p,function(n,p){if(n==null){let n=(0,T.getConnectionAttributesFromUrl)(u,c._netSemconvStability),h=(0,T.getConnectionAttributesFromServer)(p);p[T.CONNECTION_ATTRIBUTES]={...n,...h}}h.apply(this,arguments)})}}getChannelEmitPatch(n){let c=this;return function(u){if(u===`close`){c.endAllSpansOnChannel(this,!0,w.EndOperation.ChannelClosed,void 0);let n=this[T.CHANNEL_CONSUME_TIMEOUT_TIMER];n&&clearInterval(n),this[T.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else u===`error`&&c.endAllSpansOnChannel(this,!0,w.EndOperation.ChannelError,void 0);return n.apply(this,arguments)}}getAckAllPatch(n,c,u){let p=this;return function(h){return p.endAllSpansOnChannel(this,n,c,h),u.apply(this,arguments)}}getAckPatch(n,c,u){let p=this;return function(h,x,O){let A=this,j=c===w.EndOperation.Reject?x:O,N=A[T.CHANNEL_SPANS_NOT_ENDED]??[],I=N.findIndex(n=>n.msg===h);if(I<0)p.endConsumerSpan(h,n,c,j);else if(c!==w.EndOperation.Reject&&x){for(let u=0;u<=I;u++)p.endConsumerSpan(N[u].msg,n,c,j);N.splice(0,I+1)}else p.endConsumerSpan(h,n,c,j),N.splice(I,1);return u.apply(this,arguments)}}getConsumePatch(n,O){let A=this;return function(j,N,I){let L=this;if(!Object.prototype.hasOwnProperty.call(L,T.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:n}=A.getConfig();if(n){let c=setInterval(()=>{A.checkConsumeTimeoutOnChannel(L)},n);c.unref(),L[T.CHANNEL_CONSUME_TIMEOUT_TIMER]=c}L[T.CHANNEL_SPANS_NOT_ENDED]=[]}let z=function(O){if(!O)return N.call(this,O);let z=O.properties.headers??{},B=c.propagation.extract(c.ROOT_CONTEXT,z),V=O.fields?.exchange,H;if(A._config.useLinksForConsume){let n=B?c.trace.getSpan(B)?.spanContext():void 0;B=void 0,n&&(H=[{context:n}])}let U=A.tracer.startSpan(`${j} process`,{kind:c.SpanKind.CONSUMER,attributes:{...L?.connection?.[T.CONNECTION_ATTRIBUTES],[x.ATTR_MESSAGING_DESTINATION]:V,[x.ATTR_MESSAGING_DESTINATION_KIND]:x.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[x.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:O.fields?.routingKey,[h.ATTR_MESSAGING_OPERATION]:x.MESSAGING_OPERATION_VALUE_PROCESS,[x.OLD_ATTR_MESSAGING_MESSAGE_ID]:O?.properties.messageId,[x.ATTR_MESSAGING_CONVERSATION_ID]:O?.properties.correlationId},links:H},B),{consumeHook:W}=A.getConfig();W&&(0,p.safeExecuteInTheMiddle)(()=>W(U,{moduleVersion:n,msg:O}),n=>{n&&c.diag.error(`amqplib instrumentation: consumerHook error`,n)},!0),I?.noAck||(L[T.CHANNEL_SPANS_NOT_ENDED].push({msg:O,timeOfConsume:(0,u.hrTime)()}),O[T.MESSAGE_STORED_SPAN]=U);let G=B||c.ROOT_CONTEXT;c.context.with(c.trace.setSpan(G,U),()=>{N.call(this,O)}),I?.noAck&&(A.callConsumeEndHook(U,O,!1,w.EndOperation.AutoAck),U.end())};return arguments[1]=z,O.apply(this,arguments)}}getConfirmedPublishPatch(n,u){let h=this;return function(x,w,O,A,j){let N=this,{span:I,modifiedOptions:L}=h.createPublishSpan(h,x,w,N,A),{publishHook:z}=h.getConfig();z&&(0,p.safeExecuteInTheMiddle)(()=>z(I,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:L,isConfirmChannel:!0}),n=>{n&&c.diag.error(`amqplib instrumentation: publishHook error`,n)},!0);let B=function(u,T){try{j?.call(this,u,T)}finally{let{publishConfirmHook:T}=h.getConfig();T&&(0,p.safeExecuteInTheMiddle)(()=>T(I,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:A,isConfirmChannel:!0,confirmError:u}),n=>{n&&c.diag.error(`amqplib instrumentation: publishConfirmHook error`,n)},!0),u&&I.setStatus({code:c.SpanStatusCode.ERROR,message:`message confirmation has been nack'ed`}),I.end()}},V=(0,T.markConfirmChannelTracing)(c.context.active()),H=[...arguments];return H[3]=L,H[4]=c.context.bind((0,T.unmarkConfirmChannelTracing)(c.trace.setSpan(V,I)),B),c.context.with(V,u.bind(this,...H))}}getPublishPatch(n,u){let h=this;return function(x,w,O,A){if((0,T.isConfirmChannelTracing)(c.context.active()))return u.apply(this,arguments);{let T=this,{span:j,modifiedOptions:N}=h.createPublishSpan(h,x,w,T,A),{publishHook:I}=h.getConfig();I&&(0,p.safeExecuteInTheMiddle)(()=>I(j,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:N,isConfirmChannel:!1}),n=>{n&&c.diag.error(`amqplib instrumentation: publishHook error`,n)},!0);let L=[...arguments];L[3]=N;let z=u.apply(this,L);return j.end(),z}}}createPublishSpan(n,u,p,h,w){let O=(0,T.normalizeExchange)(u),A=n.tracer.startSpan(`publish ${O}`,{kind:c.SpanKind.PRODUCER,attributes:{...h.connection[T.CONNECTION_ATTRIBUTES],[x.ATTR_MESSAGING_DESTINATION]:u,[x.ATTR_MESSAGING_DESTINATION_KIND]:x.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[x.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p,[x.OLD_ATTR_MESSAGING_MESSAGE_ID]:w?.messageId,[x.ATTR_MESSAGING_CONVERSATION_ID]:w?.correlationId}}),j=w??{};return j.headers=j.headers??{},c.propagation.inject(c.trace.setSpan(c.context.active(),A),j.headers),{span:A,modifiedOptions:j}}endConsumerSpan(n,u,p,h){let x=n[T.MESSAGE_STORED_SPAN];x&&(u!==!1&&x.setStatus({code:c.SpanStatusCode.ERROR,message:p!==w.EndOperation.ChannelClosed&&p!==w.EndOperation.ChannelError?`${p} called on message${h===!0?` with requeue`:h===!1?` without requeue`:``}`:p}),this.callConsumeEndHook(x,n,u,p),x.end(),n[T.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(n,c,u,p){(n[T.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(n=>{this.endConsumerSpan(n.msg,c,u,p)}),n[T.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(n,u,h,x){let{consumeEndHook:w}=this.getConfig();w&&(0,p.safeExecuteInTheMiddle)(()=>w(n,{msg:u,rejected:h,endOperation:x}),n=>{n&&c.diag.error(`amqplib instrumentation: consumerEndHook error`,n)},!0)}checkConsumeTimeoutOnChannel(n){let c=(0,u.hrTime)(),p=n[T.CHANNEL_SPANS_NOT_ENDED]??[],h,{consumeTimeoutMs:x}=this.getConfig();for(h=0;h<p.length;h++){let n=p[h],T=(0,u.hrTimeDuration)(n.timeOfConsume,c);if((0,u.hrTimeToMilliseconds)(T)<x)break;this.endConsumerSpan(n.msg,null,w.EndOperation.InstrumentationTimeout,!0)}p.splice(0,h)}}})),require_src$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EndOperation=n.DEFAULT_CONFIG=n.AmqplibInstrumentation=void 0;var c=require_amqplib();Object.defineProperty(n,`AmqplibInstrumentation`,{enumerable:!0,get:function(){return c.AmqplibInstrumentation}});var u=require_types$4();Object.defineProperty(n,`DEFAULT_CONFIG`,{enumerable:!0,get:function(){return u.DEFAULT_CONFIG}}),Object.defineProperty(n,`EndOperation`,{enumerable:!0,get:function(){return u.EndOperation}})})),import_src$16=require_src$21();const INTEGRATION_NAME$2=`Amqplib`,config$1={consumeEndHook:n=>{addOriginToSpan(n,`auto.amqplib.otel.consumer`)},publishHook:n=>{addOriginToSpan(n,`auto.amqplib.otel.publisher`)}},instrumentAmqplib=generateInstrumentOnce(INTEGRATION_NAME$2,()=>new import_src$16.AmqplibInstrumentation(config$1)),_amqplibIntegration=(()=>({name:INTEGRATION_NAME$2,setupOnce(){instrumentAmqplib()}})),amqplibIntegration=defineIntegration(_amqplibIntegration),INTEGRATION_NAME$1=`VercelAI`,SUPPORTED_VERSIONS=[`>=3.0.0 <7`],INSTRUMENTED_METHODS=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function isToolError(n){if(typeof n!=`object`||!n)return!1;let c=n;return`type`in c&&`error`in c&&`toolName`in c&&`toolCallId`in c&&c.type===`tool-error`&&c.error instanceof Error}function processToolCallResults(n){if(typeof n!=`object`||!n||!(`content`in n))return;let c=n;Array.isArray(c.content)&&(captureToolErrors(c.content),cleanupToolCallSpanContexts(c.content))}function captureToolErrors(n){for(let c of n){if(!isToolError(c))continue;let n=_INTERNAL_getSpanContextForToolCallId(c.toolCallId);withScope(n?u=>{u.setContext(`trace`,{trace_id:n.traceId,span_id:n.spanId}),u.setTag(`vercel.ai.tool.name`,c.toolName),u.setTag(`vercel.ai.tool.callId`,c.toolCallId),u.setLevel(`error`),captureException(c.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})}:n=>{n.setTag(`vercel.ai.tool.name`,c.toolName),n.setTag(`vercel.ai.tool.callId`,c.toolCallId),n.setLevel(`error`),captureException(c.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function cleanupToolCallSpanContexts(n){for(let c of n)typeof c==`object`&&c&&`toolCallId`in c&&typeof c.toolCallId==`string`&&_INTERNAL_cleanupToolCallSpanContext(c.toolCallId)}function determineRecordingSettings(n,c,u,p){return{recordInputs:n?.recordInputs===void 0?c.recordInputs===void 0?u===!0?!0:p:c.recordInputs:n.recordInputs,recordOutputs:n?.recordOutputs===void 0?c.recordOutputs===void 0?u===!0?!0:p:c.recordOutputs:n.recordOutputs}}var SentryVercelAiInstrumentation=class n extends import_src$35.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(c={}){super(`@sentry/instrumentation-vercel-ai`,SDK_VERSION,c),n.prototype.__init.call(this),n.prototype.__init2.call(this)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`ai`,SUPPORTED_VERSIONS,this._patch.bind(this))}callWhenPatched(n){this._isPatched?n():this._callbacks.push(n)}_patch(n){this._isPatched=!0,this._callbacks.forEach(n=>n()),this._callbacks=[];let c=n=>new Proxy(n,{apply:(n,c,u)=>{let p=u[0].experimental_telemetry||{},h=p.isEnabled,x=getClient(),w=x?.getIntegrationByName(INTEGRATION_NAME$1),T=w?.options,{recordInputs:O,recordOutputs:A}=determineRecordingSettings(T,p,h,w?!!x?.getOptions().sendDefaultPii:!1);return u[0].experimental_telemetry={...p,isEnabled:h===void 0?!0:h,recordInputs:O,recordOutputs:A},handleCallbackErrors(()=>Reflect.apply(n,c,u),n=>{n&&typeof n==`object`&&addNonEnumerableProperty(n,`_sentry_active_span`,getActiveSpan$1())},()=>{},n=>{processToolCallResults(n)})}});if(Object.prototype.toString.call(n)===`[object Module]`){for(let u of INSTRUMENTED_METHODS)n[u]!=null&&(n[u]=c(n[u]));return n}else{let u=INSTRUMENTED_METHODS.reduce((u,p)=>(n[p]!=null&&(u[p]=c(n[p])),u),{});return{...n,...u}}}};const instrumentVercelAi=generateInstrumentOnce(INTEGRATION_NAME$1,()=>new SentryVercelAiInstrumentation({}));function shouldForceIntegration(n){return!!n.getIntegrationByName(`Modules`)?.getModules?.()?.ai}const _vercelAIIntegration=((n={})=>{let c;return{name:INTEGRATION_NAME$1,options:n,setupOnce(){c=instrumentVercelAi()},afterAllSetup(u){n.force??shouldForceIntegration(u)?addVercelAiProcessors(u):c?.callWhenPatched(()=>addVercelAiProcessors(u))}}}),vercelAIIntegration=defineIntegration(_vercelAIIntegration),supportedVersions$4=[`>=4.0.0 <7`];var SentryOpenAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-openai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`openai`,supportedVersions$4,this._patch.bind(this))}_patch(n){let c=n;return c=this._patchClient(c,`OpenAI`),c=this._patchClient(c,`AzureOpenAI`),c}_patchClient(n,c){let u=n[c];if(!u)return n;let p=this.getConfig(),h=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`OpenAI`)?Reflect.construct(u,n):instrumentOpenAiClient(Reflect.construct(u,n),p)};Object.setPrototypeOf(h,u),Object.setPrototypeOf(h.prototype,u.prototype);for(let n of Object.getOwnPropertyNames(u))if(![`length`,`name`,`prototype`].includes(n)){let c=Object.getOwnPropertyDescriptor(u,n);c&&Object.defineProperty(h,n,c)}try{n[c]=h}catch{Object.defineProperty(n,c,{value:h,writable:!0,configurable:!0,enumerable:!0})}if(n.default===u)try{n.default=h}catch{Object.defineProperty(n,`default`,{value:h,writable:!0,configurable:!0,enumerable:!0})}return n}};const instrumentOpenAi=generateInstrumentOnce(OPENAI_INTEGRATION_NAME,n=>new SentryOpenAiInstrumentation(n)),_openAiIntegration=((n={})=>({name:OPENAI_INTEGRATION_NAME,setupOnce(){instrumentOpenAi(n)}})),openAIIntegration=defineIntegration(_openAiIntegration),supportedVersions$3=[`>=0.19.2 <1.0.0`];var SentryAnthropicAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-anthropic-ai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`@anthropic-ai/sdk`,supportedVersions$3,this._patch.bind(this))}_patch(n){let c=n.Anthropic,u=this.getConfig(),p=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`Anthropic_AI`)?Reflect.construct(c,n):instrumentAnthropicAiClient(Reflect.construct(c,n),u)};Object.setPrototypeOf(p,c),Object.setPrototypeOf(p.prototype,c.prototype);for(let n of Object.getOwnPropertyNames(c))if(![`length`,`name`,`prototype`].includes(n)){let u=Object.getOwnPropertyDescriptor(c,n);u&&Object.defineProperty(p,n,u)}try{n.Anthropic=p}catch{Object.defineProperty(n,`Anthropic`,{value:p,writable:!0,configurable:!0,enumerable:!0})}if(n.default===c)try{n.default=p}catch{Object.defineProperty(n,`default`,{value:p,writable:!0,configurable:!0,enumerable:!0})}return n}};const instrumentAnthropicAi=generateInstrumentOnce(ANTHROPIC_AI_INTEGRATION_NAME,n=>new SentryAnthropicAiInstrumentation(n)),_anthropicAIIntegration=((n={})=>({name:ANTHROPIC_AI_INTEGRATION_NAME,options:n,setupOnce(){instrumentAnthropicAi(n)}})),anthropicAIIntegration=defineIntegration(_anthropicAIIntegration),supportedVersions$2=[`>=0.10.0 <2`];var SentryGoogleGenAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-google-genai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`@google/genai`,supportedVersions$2,n=>this._patch(n),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@google/genai/dist/node/index.cjs`,supportedVersions$2,n=>this._patch(n),n=>n)])}_patch(n){let c=n.GoogleGenAI,u=this.getConfig();if(typeof c!=`function`)return n;let p=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`Google_GenAI`)?Reflect.construct(c,n):instrumentGoogleGenAIClient(Reflect.construct(c,n),u)};Object.setPrototypeOf(p,c),Object.setPrototypeOf(p.prototype,c.prototype);for(let n of Object.getOwnPropertyNames(c))if(![`length`,`name`,`prototype`].includes(n)){let u=Object.getOwnPropertyDescriptor(c,n);u&&Object.defineProperty(p,n,u)}return replaceExports(n,`GoogleGenAI`,p),n}};const instrumentGoogleGenAI=generateInstrumentOnce(GOOGLE_GENAI_INTEGRATION_NAME,n=>new SentryGoogleGenAiInstrumentation(n)),_googleGenAIIntegration=((n={})=>({name:GOOGLE_GENAI_INTEGRATION_NAME,setupOnce(){instrumentGoogleGenAI(n)}})),googleGenAIIntegration=defineIntegration(_googleGenAIIntegration),supportedVersions$1=[`>=0.1.0 <2.0.0`];function augmentCallbackHandlers(n,c){return n?Array.isArray(n)?n.includes(c)?n:[...n,c]:typeof n==`object`?[n,c]:n:[c]}function wrapRunnableMethod(n,c,u){return new Proxy(n,{apply(n,u,p){let h=1,x=p[1];(!x||typeof x!=`object`||Array.isArray(x))&&(x={},p[1]=x);let w=x.callbacks,T=augmentCallbackHandlers(w,c);return x.callbacks=T,Reflect.apply(n,u,p)}})}var SentryLangChainInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-langchain`,SDK_VERSION,n)}init(){let n=[];for(let c of[`@langchain/anthropic`,`@langchain/openai`,`@langchain/google-genai`,`@langchain/mistralai`,`@langchain/google-vertexai`,`@langchain/groq`])n.push(new import_src$35.InstrumentationNodeModuleDefinition(c,supportedVersions$1,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`${c}/dist/index.cjs`,supportedVersions$1,this._patch.bind(this),n=>n)]));return n.push(new import_src$35.InstrumentationNodeModuleDefinition(`langchain`,supportedVersions$1,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`langchain/dist/chat_models/universal.cjs`,supportedVersions$1,this._patch.bind(this),n=>n)])),n}_patch(n){_INTERNAL_skipAiProviderWrapping([OPENAI_INTEGRATION_NAME,ANTHROPIC_AI_INTEGRATION_NAME,GOOGLE_GENAI_INTEGRATION_NAME]);let c=this.getConfig(),u=createLangChainCallbackHandler(c);return this._patchRunnableMethods(n,u),this._patchEmbeddingsMethods(n,c),n}_patchRunnableMethods(n,c){let u=[`ChatAnthropic`,`ChatOpenAI`,`ChatGoogleGenerativeAI`,`ChatMistralAI`,`ChatVertexAI`,`ChatGroq`,`ConfigurableModel`],p=n.universal_exports??n,h=Object.values(p).find(n=>typeof n==`function`&&u.includes(n.name));if(!h)return;let x=h.prototype;if(!x.__sentry_patched__){x.__sentry_patched__=!0;for(let n of[`invoke`,`stream`,`batch`]){let u=x[n];typeof u==`function`&&(x[n]=wrapRunnableMethod(u,c))}}}_patchEmbeddingsMethods(n,c){let u=n.universal_exports??n;for(let n of Object.values(u)){if(typeof n!=`function`||!n.prototype)continue;let u=n.prototype;typeof u.embedQuery!=`function`||typeof u.embedDocuments!=`function`||u.__sentry_patched__||(u.__sentry_patched__=!0,instrumentLangChainEmbeddings(u,c))}}};const instrumentLangChain=generateInstrumentOnce(LANGCHAIN_INTEGRATION_NAME,n=>new SentryLangChainInstrumentation(n)),_langChainIntegration=((n={})=>({name:LANGCHAIN_INTEGRATION_NAME,setupOnce(){instrumentLangChain(n)}})),langChainIntegration=defineIntegration(_langChainIntegration),supportedVersions=[`>=0.0.0 <2.0.0`];var SentryLangGraphInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-langgraph`,SDK_VERSION,n)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`@langchain/langgraph`,supportedVersions,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/index.cjs`,supportedVersions,this._patch.bind(this),n=>n),new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/prebuilt/index.cjs`,supportedVersions,this._patch.bind(this),n=>n)]),new import_src$35.InstrumentationNodeModuleDefinition(`@langchain/langgraph/prebuilt`,supportedVersions,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/prebuilt/index.cjs`,supportedVersions,this._patch.bind(this),n=>n)])]}_patch(n){let c=getClient(),u={...this.getConfig(),recordInputs:this.getConfig().recordInputs??c?.getOptions().sendDefaultPii,recordOutputs:this.getConfig().recordOutputs??c?.getOptions().sendDefaultPii};if(n.StateGraph&&typeof n.StateGraph==`function`&&instrumentLangGraph$1(n.StateGraph.prototype,u),n.createReactAgent&&typeof n.createReactAgent==`function`){let c=n.createReactAgent;Object.defineProperty(n,`createReactAgent`,{value:instrumentCreateReactAgent(c,u),writable:!0,enumerable:!0,configurable:!0})}return n}};const instrumentLangGraph=generateInstrumentOnce(LANGGRAPH_INTEGRATION_NAME,n=>new SentryLangGraphInstrumentation(n)),_langGraphIntegration=((n={})=>({name:LANGGRAPH_INTEGRATION_NAME,setupOnce(){instrumentLangGraph(n)}})),langGraphIntegration=defineIntegration(_langGraphIntegration);init_esm$2(),init_esm$1();function patchFirestore(n,c,u,p,h){let x=()=>{},w=h.firestoreSpanCreationHook;typeof w==`function`&&(x=n=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>w(n),n=>{n&&diag.error(n?.message)},!0)});let T=new import_src$35.InstrumentationNodeModuleDefinition(`@firebase/firestore`,c,c=>wrapMethods(c,u,p,n,x));for(let h of[`@firebase/firestore/dist/lite/index.node.cjs.js`,`@firebase/firestore/dist/lite/index.node.mjs.js`,`@firebase/firestore/dist/lite/index.rn.esm2017.js`,`@firebase/firestore/dist/lite/index.cjs.js`])T.files.push(new import_src$35.InstrumentationNodeModuleFile(h,c,c=>wrapMethods(c,u,p,n,x),n=>unwrapMethods(n,p)));return T}function wrapMethods(n,c,u,p,h){return unwrapMethods(n,u),c(n,`addDoc`,patchAddDoc(p,h)),c(n,`getDocs`,patchGetDocs(p,h)),c(n,`setDoc`,patchSetDoc(p,h)),c(n,`deleteDoc`,patchDeleteDoc(p,h)),n}function unwrapMethods(n,c){for(let u of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])(0,import_src$35.isWrapped)(n[u])&&c(n,u);return n}function patchAddDoc(n,c){return function(u){return function(p,h){let x=startDBSpan(n,`addDoc`,p);return c(x),executeContextWithSpan(x,()=>u(p,h))}}}function patchDeleteDoc(n,c){return function(u){return function(p){let h=startDBSpan(n,`deleteDoc`,p.parent||p);return c(h),executeContextWithSpan(h,()=>u(p))}}}function patchGetDocs(n,c){return function(u){return function(p){let h=startDBSpan(n,`getDocs`,p);return c(h),executeContextWithSpan(h,()=>u(p))}}}function patchSetDoc(n,c){return function(u){return function(p,h,x){let w=startDBSpan(n,`setDoc`,p.parent||p);return c(w),executeContextWithSpan(w,()=>x===void 0?u(p,h):u(p,h,x))}}}function executeContextWithSpan(n,c){return context$1.with(trace.setSpan(context$1.active(),n),()=>(0,import_src$35.safeExecuteInTheMiddle)(()=>c(),c=>{c&&n.recordException(c),n.end()},!0))}function startDBSpan(n,c,u){let p=n.startSpan(`${c} ${u.path}`,{kind:SpanKind.CLIENT});return addAttributes(p,u),p.setAttribute(ATTR_DB_OPERATION_NAME,c),p}function getPortAndAddress(n){let c,u;if(typeof n.host==`string`)if(n.host.startsWith(`[`)){if(n.host.endsWith(`]`))c=n.host.replace(/^\[|\]$/g,``);else if(n.host.includes(`]:`)){let p=n.host.lastIndexOf(`:`);p!==-1&&(c=n.host.slice(1,p).replace(/^\[|\]$/g,``),u=n.host.slice(p+1))}}else if(net.isIPv6(n.host))c=n.host;else{let p=n.host.lastIndexOf(`:`);p===-1?c=n.host:(c=n.host.slice(0,p),u=n.host.slice(p+1))}return{address:c,port:u?parseInt(u,10):void 0}}function addAttributes(n,c){let u=c.firestore.app,p=u.options,h=(c.firestore.toJSON()||{}).settings||{},x={[ATTR_DB_COLLECTION_NAME]:c.path,[ATTR_DB_NAMESPACE]:u.name,[ATTR_DB_SYSTEM_NAME]:`firebase.firestore`,"firebase.firestore.type":c.type,"firebase.firestore.options.projectId":p.projectId,"firebase.firestore.options.appId":p.appId,"firebase.firestore.options.messagingSenderId":p.messagingSenderId,"firebase.firestore.options.storageBucket":p.storageBucket},{address:w,port:T}=getPortAndAddress(h);w&&(x[ATTR_SERVER_ADDRESS]=w),T&&(x[ATTR_SERVER_PORT]=T),n.setAttributes(x)}init_esm$2();function patchFunctions(n,c,u,p,h){let x=()=>{},w=()=>{},T=h.functions?.errorHook,O=h.functions?.requestHook,A=h.functions?.responseHook;typeof A==`function`&&(w=(n,c)=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>A(n,c),n=>{n&&diag.error(n?.message)},!0)}),typeof O==`function`&&(x=n=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>O(n),n=>{n&&diag.error(n?.message)},!0)});let j=new import_src$35.InstrumentationNodeModuleDefinition(`firebase-functions`,c);return[{name:`firebase-functions/lib/v2/providers/https.js`,triggerType:`function`},{name:`firebase-functions/lib/v2/providers/firestore.js`,triggerType:`firestore`},{name:`firebase-functions/lib/v2/providers/scheduler.js`,triggerType:`scheduler`},{name:`firebase-functions/lib/v2/storage.js`,triggerType:`storage`}].forEach(({name:h,triggerType:O})=>{j.files.push(new import_src$35.InstrumentationNodeModuleFile(h,c,c=>wrapCommonFunctions(c,u,p,n,{requestHook:x,responseHook:w,errorHook:T},O),n=>unwrapCommonFunctions(n,p)))}),j}function patchV2Functions(n,c,u){return function(p){return function(...h){let x=typeof h[0]==`function`?h[0]:h[1],w=typeof h[0]==`function`?void 0:h[0];if(!x)return p.call(this,...h);let T=async function(...p){let h=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,w=n.startSpan(`firebase.function.${u}`,{kind:SpanKind.SERVER}),T={"faas.name":h,"faas.trigger":u,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(T[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(T[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),w.setAttributes(T),c?.requestHook?.(w),context$1.with(trace.setSpan(context$1.active(),w),async()=>{let n,u;try{u=await x.apply(this,p)}catch(c){n=c}if(c?.responseHook?.(w,n),n&&w.recordException(n),w.end(),n)throw await c?.errorHook?.(w,n),n;return u})};return w?p.call(this,w,T):p.call(this,T)}}}function wrapCommonFunctions(n,c,u,p,h,x){switch(unwrapCommonFunctions(n,u),x){case`function`:c(n,`onRequest`,patchV2Functions(p,h,`http.request`)),c(n,`onCall`,patchV2Functions(p,h,`http.call`));break;case`firestore`:c(n,`onDocumentCreated`,patchV2Functions(p,h,`firestore.document.created`)),c(n,`onDocumentUpdated`,patchV2Functions(p,h,`firestore.document.updated`)),c(n,`onDocumentDeleted`,patchV2Functions(p,h,`firestore.document.deleted`)),c(n,`onDocumentWritten`,patchV2Functions(p,h,`firestore.document.written`)),c(n,`onDocumentCreatedWithAuthContext`,patchV2Functions(p,h,`firestore.document.created`)),c(n,`onDocumentUpdatedWithAuthContext`,patchV2Functions(p,h,`firestore.document.updated`)),c(n,`onDocumentDeletedWithAuthContext`,patchV2Functions(p,h,`firestore.document.deleted`)),c(n,`onDocumentWrittenWithAuthContext`,patchV2Functions(p,h,`firestore.document.written`));break;case`scheduler`:c(n,`onSchedule`,patchV2Functions(p,h,`scheduler.scheduled`));break;case`storage`:c(n,`onObjectFinalized`,patchV2Functions(p,h,`storage.object.finalized`)),c(n,`onObjectArchived`,patchV2Functions(p,h,`storage.object.archived`)),c(n,`onObjectDeleted`,patchV2Functions(p,h,`storage.object.deleted`)),c(n,`onObjectMetadataUpdated`,patchV2Functions(p,h,`storage.object.metadataUpdated`));break}return n}function unwrapCommonFunctions(n,c){for(let u of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])(0,import_src$35.isWrapped)(n[u])&&c(n,u);return n}const DefaultFirebaseInstrumentationConfig={},firestoreSupportedVersions=[`>=3.0.0 <5`],functionsSupportedVersions=[`>=6.0.0 <7`];var FirebaseInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n=DefaultFirebaseInstrumentationConfig){super(`@sentry/instrumentation-firebase`,SDK_VERSION,n)}setConfig(n={}){super.setConfig({...DefaultFirebaseInstrumentationConfig,...n})}init(){let n=[];return n.push(patchFirestore(this.tracer,firestoreSupportedVersions,this._wrap,this._unwrap,this.getConfig())),n.push(patchFunctions(this.tracer,functionsSupportedVersions,this._wrap,this._unwrap,this.getConfig())),n}};const INTEGRATION_NAME=`Firebase`,config={firestoreSpanCreationHook:n=>{addOriginToSpan(n,`auto.firebase.otel.firestore`),n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`db.query`)},functions:{requestHook:n=>{addOriginToSpan(n,`auto.firebase.otel.functions`),n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`http.request`)},errorHook:async(n,c)=>{c&&(captureException(c,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),await flush(2e3))}}},instrumentFirebase=generateInstrumentOnce(INTEGRATION_NAME,()=>new FirebaseInstrumentation(config)),_firebaseIntegration=(()=>({name:INTEGRATION_NAME,setupOnce(){instrumentFirebase()}})),firebaseIntegration=defineIntegration(_firebaseIntegration);function getAutoPerformanceIntegrations(){return[expressIntegration(),fastifyIntegration(),graphqlIntegration(),honoIntegration(),mongoIntegration(),mongooseIntegration(),mysqlIntegration(),mysql2Integration(),redisIntegration(),postgresIntegration(),prismaIntegration(),hapiIntegration(),koaIntegration(),connectIntegration(),tediousIntegration(),genericPoolIntegration(),kafkaIntegration(),amqplibIntegration(),lruMemoizerIntegration(),langChainIntegration(),langGraphIntegration(),vercelAIIntegration(),openAIIntegration(),anthropicAIIntegration(),googleGenAIIntegration(),postgresJsIntegration(),firebaseIntegration()]}var require_default_service_name$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._clearDefaultServiceNameCache=n.defaultServiceName=void 0;let c;function u(){if(c===void 0)try{let n=globalThis.process.argv0;c=n?`unknown_service:${n}`:`unknown_service`}catch{c=`unknown_service`}return c}n.defaultServiceName=u;function p(){c=void 0}n._clearDefaultServiceNameCache=p})),require_utils$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPromiseLike=void 0,n.isPromiseLike=n=>typeof n==`object`&&!!n&&typeof n.then==`function`})),require_ResourceImpl$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultResource=n.emptyResource=n.resourceFromDetectedResource=n.resourceFromAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_default_service_name$3(),x=require_utils$15();var w=class n{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(c,u){let p=new n({},u);return p._rawAttributes=N(c),p._asyncAttributesPending=c.filter(([n,c])=>(0,x.isPromiseLike)(c)).length>0,p}constructor(n,c){let u=n.attributes??{};this._rawAttributes=Object.entries(u).map(([n,c])=>((0,x.isPromiseLike)(c)&&(this._asyncAttributesPending=!0),[n,c])),this._rawAttributes=N(this._rawAttributes),this._schemaUrl=I(c?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let n=0;n<this._rawAttributes.length;n++){let[c,u]=this._rawAttributes[n];this._rawAttributes[n]=[c,(0,x.isPromiseLike)(u)?await u:u]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&c.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let n={};for(let[u,p]of this._rawAttributes){if((0,x.isPromiseLike)(p)){c.diag.debug(`Unsettled resource attribute ${u} skipped`);continue}p!=null&&(n[u]??=p)}return this._asyncAttributesPending||(this._memoizedAttributes=n),n}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(c){if(c==null)return this;let u=L(this,c),p=u?{schemaUrl:u}:void 0;return n.FromAttributeList([...c.getRawAttributes(),...this.getRawAttributes()],p)}};function T(n,c){return w.FromAttributeList(Object.entries(n),c)}n.resourceFromAttributes=T;function O(n,c){return new w(n,c)}n.resourceFromDetectedResource=O;function A(){return T({})}n.emptyResource=A;function j(){return T({[p.ATTR_SERVICE_NAME]:(0,h.defaultServiceName)(),[p.ATTR_TELEMETRY_SDK_LANGUAGE]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_LANGUAGE],[p.ATTR_TELEMETRY_SDK_NAME]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_NAME],[p.ATTR_TELEMETRY_SDK_VERSION]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_VERSION]})}n.defaultResource=j;function N(n){return n.map(([n,u])=>(0,x.isPromiseLike)(u)?[n,u.catch(u=>{c.diag.debug(`promise rejection for resource attribute: %s - %s`,n,u)})]:[n,u])}function I(n){if(typeof n==`string`||n===void 0)return n;c.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,n)}function L(n,u){let p=n?.schemaUrl,h=u?.schemaUrl,x=p===void 0||p===``,w=h===void 0||h===``;if(x)return h;if(w||p===h)return p;c.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,p,h)}})),require_detect_resources$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.detectResources=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_ResourceImpl$3();n.detectResources=(n={})=>(n.detectors||[]).map(p=>{try{let h=(0,u.resourceFromDetectedResource)(p.detect(n));return c.diag.debug(`${p.constructor.name} found resource.`,h),h}catch(n){return c.diag.debug(`${p.constructor.name} failed: ${n.message}`),(0,u.emptyResource)()}}).reduce((n,c)=>n.merge(c),(0,u.emptyResource)())})),require_EnvDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.envDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_src$47();n.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(n){let h={},x=(0,p.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),w=(0,p.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(x)try{let n=this._parseResourceAttributes(x);Object.assign(h,n)}catch(n){c.diag.debug(`EnvDetector failed: ${n instanceof Error?n.message:n}`)}return w&&(h[u.ATTR_SERVICE_NAME]=w),{attributes:h}}_parseResourceAttributes(n){if(!n)return{};let c={},u=n.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!==``);for(let n of u){let u=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(u.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[p,h]=u,x=p.trim(),w=h.trim();if(x.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let T,O;try{T=decodeURIComponent(x),O=decodeURIComponent(w)}catch(c){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${c instanceof Error?c.message:c}`)}if(T.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${T}".`);if(O.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${T}".`);c[T]=O}return c}}})),require_semconv$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_WEBENGINE_VERSION=n.ATTR_WEBENGINE_NAME=n.ATTR_WEBENGINE_DESCRIPTION=n.ATTR_SERVICE_NAMESPACE=n.ATTR_SERVICE_INSTANCE_ID=n.ATTR_PROCESS_RUNTIME_VERSION=n.ATTR_PROCESS_RUNTIME_NAME=n.ATTR_PROCESS_RUNTIME_DESCRIPTION=n.ATTR_PROCESS_PID=n.ATTR_PROCESS_OWNER=n.ATTR_PROCESS_EXECUTABLE_PATH=n.ATTR_PROCESS_EXECUTABLE_NAME=n.ATTR_PROCESS_COMMAND_ARGS=n.ATTR_PROCESS_COMMAND=n.ATTR_OS_VERSION=n.ATTR_OS_TYPE=n.ATTR_K8S_POD_NAME=n.ATTR_K8S_NAMESPACE_NAME=n.ATTR_K8S_DEPLOYMENT_NAME=n.ATTR_K8S_CLUSTER_NAME=n.ATTR_HOST_TYPE=n.ATTR_HOST_NAME=n.ATTR_HOST_IMAGE_VERSION=n.ATTR_HOST_IMAGE_NAME=n.ATTR_HOST_IMAGE_ID=n.ATTR_HOST_ID=n.ATTR_HOST_ARCH=n.ATTR_CONTAINER_NAME=n.ATTR_CONTAINER_IMAGE_TAGS=n.ATTR_CONTAINER_IMAGE_NAME=n.ATTR_CONTAINER_ID=n.ATTR_CLOUD_REGION=n.ATTR_CLOUD_PROVIDER=n.ATTR_CLOUD_AVAILABILITY_ZONE=n.ATTR_CLOUD_ACCOUNT_ID=void 0,n.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,n.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,n.ATTR_CLOUD_PROVIDER=`cloud.provider`,n.ATTR_CLOUD_REGION=`cloud.region`,n.ATTR_CONTAINER_ID=`container.id`,n.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,n.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,n.ATTR_CONTAINER_NAME=`container.name`,n.ATTR_HOST_ARCH=`host.arch`,n.ATTR_HOST_ID=`host.id`,n.ATTR_HOST_IMAGE_ID=`host.image.id`,n.ATTR_HOST_IMAGE_NAME=`host.image.name`,n.ATTR_HOST_IMAGE_VERSION=`host.image.version`,n.ATTR_HOST_NAME=`host.name`,n.ATTR_HOST_TYPE=`host.type`,n.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,n.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,n.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,n.ATTR_K8S_POD_NAME=`k8s.pod.name`,n.ATTR_OS_TYPE=`os.type`,n.ATTR_OS_VERSION=`os.version`,n.ATTR_PROCESS_COMMAND=`process.command`,n.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,n.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,n.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,n.ATTR_PROCESS_OWNER=`process.owner`,n.ATTR_PROCESS_PID=`process.pid`,n.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,n.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,n.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,n.ATTR_SERVICE_NAMESPACE=`service.namespace`,n.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,n.ATTR_WEBENGINE_NAME=`webengine.name`,n.ATTR_WEBENGINE_VERSION=`webengine.version`})),require_getMachineId$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getMachineId=void 0;let c=__require(`process`),u;async function p(){if(!u)switch(c.platform){case`darwin`:u=(await import(`./getMachineId-darwin-Bh0FW8Yj.js`).then(n=>__toESM(n.default))).getMachineId;break;case`linux`:u=(await import(`./getMachineId-linux-BNh9bxS-.js`).then(n=>__toESM(n.default))).getMachineId;break;case`freebsd`:u=(await import(`./getMachineId-bsd-BrlN6PEO.js`).then(n=>__toESM(n.default))).getMachineId;break;case`win32`:u=(await import(`./getMachineId-win-IRvYdsh7.js`).then(n=>__toESM(n.default))).getMachineId;break;default:u=(await import(`./getMachineId-unsupported-BynWzgul.js`).then(n=>__toESM(n.default))).getMachineId;break}return u()}n.getMachineId=p})),require_utils$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalizeType=n.normalizeArch=void 0,n.normalizeArch=n=>{switch(n){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return n}},n.normalizeType=n=>{switch(n){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return n}}})),require_HostDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.hostDetector=void 0;let c=require_semconv$9(),u=__require(`os`),p=require_getMachineId$3(),h=require_utils$14();n.hostDetector=new class{detect(n){return{attributes:{[c.ATTR_HOST_NAME]:(0,u.hostname)(),[c.ATTR_HOST_ARCH]:(0,h.normalizeArch)((0,u.arch)()),[c.ATTR_HOST_ID]:(0,p.getMachineId)()}}}}})),require_OSDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.osDetector=void 0;let c=require_semconv$9(),u=__require(`os`),p=require_utils$14();n.osDetector=new class{detect(n){return{attributes:{[c.ATTR_OS_TYPE]:(0,p.normalizeType)((0,u.platform)()),[c.ATTR_OS_VERSION]:(0,u.release)()}}}}})),require_ProcessDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_semconv$9(),p=__require(`os`);n.processDetector=new class{detect(n){let h={[u.ATTR_PROCESS_PID]:process.pid,[u.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[u.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[u.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[u.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[u.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[u.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(h[u.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=p.userInfo();h[u.ATTR_PROCESS_OWNER]=n.username}catch(n){c.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:h}}}})),require_ServiceInstanceIdDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=void 0;let c=require_semconv$9(),u=__require(`crypto`);n.serviceInstanceIdDetector=new class{detect(n){return{attributes:{[c.ATTR_SERVICE_INSTANCE_ID]:(0,u.randomUUID)()}}}}})),require_node$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_HostDetector$3();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}});var u=require_OSDetector$3();Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}});var p=require_ProcessDetector$3();Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return p.processDetector}});var h=require_ServiceInstanceIdDetector$3();Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return h.serviceInstanceIdDetector}})})),require_platform$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_node$14();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return c.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return c.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return c.serviceInstanceIdDetector}})})),require_NoopDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.NoopDetector=void 0;var c=class{detect(){return{attributes:{}}}};n.NoopDetector=c,n.noopDetector=new c})),require_detectors$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=void 0;var c=require_EnvDetector$3();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return c.envDetector}});var u=require_platform$14();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_NoopDetector$3();Object.defineProperty(n,`noopDetector`,{enumerable:!0,get:function(){return p.noopDetector}})})),require_src$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultServiceName=n.emptyResource=n.defaultResource=n.resourceFromAttributes=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=n.detectResources=void 0;var c=require_detect_resources$3();Object.defineProperty(n,`detectResources`,{enumerable:!0,get:function(){return c.detectResources}});var u=require_detectors$3();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return u.envDetector}}),Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_ResourceImpl$3();Object.defineProperty(n,`resourceFromAttributes`,{enumerable:!0,get:function(){return p.resourceFromAttributes}}),Object.defineProperty(n,`defaultResource`,{enumerable:!0,get:function(){return p.defaultResource}}),Object.defineProperty(n,`emptyResource`,{enumerable:!0,get:function(){return p.emptyResource}});var h=require_default_service_name$3();Object.defineProperty(n,`defaultServiceName`,{enumerable:!0,get:function(){return h.defaultServiceName}})})),require_enums$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums$2();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler$2();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler$2();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_AlwaysOffSampler$2(),h=require_AlwaysOnSampler$2();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler$2();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_AlwaysOffSampler$2(),h=require_AlwaysOnSampler$2(),x=require_ParentBasedSampler$2(),w=require_TraceIdRatioBasedSampler$2();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config$2(),u=require_src$47();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase$2();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor$2();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator$2();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node$13();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler$2(),u=require_semconv$8();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_Span$2(),h=require_utility$2(),x=require_platform$13(),w=require_TracerMetrics$2(),T=require_version$5();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$47();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$47(),u=require_src$20(),p=require_Tracer$2(),h=require_config$2(),x=require_MultiSpanProcessor$2(),w=require_utility$2();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$47();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$47();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider$2();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform$13();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter$2();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter$2();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor$2();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor$2();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler$2();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler$2();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler$2();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler$2();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler$2();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})}));init_esm$2();var import_src$15=require_src$19();const MAX_MAX_SPAN_WAIT_DURATION=1e6;function initOpenTelemetry(n,c={}){n.getOptions().debug&&setupOpenTelemetryLogger();let[u,p]=setupOtel(n,c);n.traceProvider=u,n.asyncLocalStorageLookup=p}function setupOtel(n,c={}){let u=new import_src$15.BasicTracerProvider({sampler:new SentrySampler(n),resource:getSentryResource(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new SentrySpanProcessor({timeout:_clampSpanProcessorTimeout(n.getOptions().maxSpanWaitDuration)}),...c.spanProcessors||[]]});trace.setGlobalTracerProvider(u),propagation.setGlobalPropagator(new SentryPropagator);let p=new SentryContextManager;return context$1.setGlobalContextManager(p),[u,p.getAsyncLocalStorageLookup()]}function _clampSpanProcessorTimeout(n){if(n!=null){if(n>MAX_MAX_SPAN_WAIT_DURATION)return DEBUG_BUILD&&debug.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${MAX_MAX_SPAN_WAIT_DURATION}`),MAX_MAX_SPAN_WAIT_DURATION;if(n<=0||Number.isNaN(n)){DEBUG_BUILD&&debug.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return n}}function getDefaultIntegrationsWithoutPerformance(){return getDefaultIntegrations$1().filter(n=>n.name!==`Http`&&n.name!==`NodeFetch`).concat(httpIntegration(),nativeNodeFetchIntegration())}function getDefaultIntegrations(n){return[...getDefaultIntegrationsWithoutPerformance(),...hasSpansEnabled(n)?getAutoPerformanceIntegrations():[]]}function init(n={}){return _init(n,getDefaultIntegrations)}function _init(n={},c){applySdkMetadata(n,`node`);let u=init$1({...n,defaultIntegrations:n.defaultIntegrations??c(n)});return u&&!n.skipOpenTelemetrySetup&&(initOpenTelemetry(u,{spanProcessors:n.openTelemetrySpanProcessors}),validateOpenTelemetrySetup()),u}const createNodeSentrySink=n=>initSentryAndCreateSink({config:n,dsn:n.dsn,sentry:{addBreadcrumb:n=>addBreadcrumb(n),captureException:n=>captureException(n),flush:n=>flush(n),init:n=>init(n),startInactiveSpan:n=>startInactiveSpan$1(toSentrySpanOptions(n)),withScope:n=>withScope(n)}}),parseBoolean$1=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`};let cachedRuntime=null,cliScopeSnapshot={};const supportedCliNodeSinkNames=new Set([ObservabilitySinkName.NOOP,ObservabilitySinkName.SENTRY]),parseCliNodeSinkNames=()=>{let n=process.env.OBSERVABILITY_ADAPTERS_CLI?.trim();if(!n)return{names:[]};let{invalidNames:c,names:u}=parseObservabilitySinkNames(n),p=u.filter(n=>!supportedCliNodeSinkNames.has(n));return c.length>0&&console.warn(`[observability] Ignoring unsupported CLI sinks: ${c.join(`, `)}`),p.length>0&&console.warn(`[observability] Ignoring unsupported CLI sinks: ${p.join(`, `)}`),{names:u.filter(n=>supportedCliNodeSinkNames.has(n))}},buildCliSink=n=>{let{names:c}=parseCliNodeSinkNames(),u=[];for(let p of c)try{switch(p){case ObservabilitySinkName.NOOP:u.push(createNoopSink());break;case ObservabilitySinkName.SENTRY:u.push(createNodeSentrySink({appVersion:resolveAppVersionFromRelease(n),clientApp:`echo-cli`,dsn:process.env.SENTRY_DSN_CLI,enabled:parseBoolean$1(process.env.OBSERVABILITY_ENABLED),environment:process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV||`development`,release:n,runtime:`cli`}));break}}catch(n){console.warn(`[observability] Failed to create CLI sink: ${p}`,n)}return createCompositeSink(u.length>0?u:[createNoopSink()])},resolveCliNodeObservabilityBackendName=()=>{let{names:n}=parseCliNodeSinkNames();return n.includes(ObservabilitySinkName.SENTRY)?`sentry`:n.length>0?`none`:parseBoolean$1(process.env.OTEL_ENABLED)?`otel`:`none`},getCliObservability=()=>{let n=process.env.OBSERVABILITY_RELEASE?.trim();return cachedRuntime??=createFrontendObservabilityRuntime({appVersion:resolveAppVersionFromRelease(n),clientApp:`echo-cli`,enabled:parseBoolean$1(process.env.OBSERVABILITY_ENABLED),environment:process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV||`development`,release:n,runtime:`cli`},buildCliSink(n)),cachedRuntime},syncCliScopeSnapshot=n=>{cliScopeSnapshot={...cliScopeSnapshot,...n},applyClientScopeSnapshot(getCliObservability(),cliScopeSnapshot)},createCliObservedFetch=n=>createObservedFetch({kind:n,observability:getCliObservability().createHttpPort()}),setCliPipelineScope=n=>{syncCliScopeSnapshot({pipelineId:n})},bindCliAuthObservabilityScope=n=>{let c=()=>{let c=n.useConnectionUIStore.getState(),u=c.status;syncCliScopeSnapshot({authPhase:u,userId:u===ConnectionUIStatus.SIGNED_OUT?null:c.user.userId||null})};return c(),n.useConnectionUIStore.subscribe(c)},runLogoutCommand=async()=>{let n=await loadBackendConfig();if(!n)throw Error(`No stored auth session found.`);let c=deriveCliEndpoints(n),u=await loadAuthSession(c);if(!u)throw Error(`No stored auth session found.`);await revokeCliSession(c.apiBaseUrl,{token:u.token},{fetchImpl:createCliObservedFetch(`cli.auth.logout`)}).catch(()=>{}),await clearAuthSession(c)},EXTERNAL_AUTH_KIND_CONFIG={oauth:{kind:`oauth`,label:`OAuth`},sso:{kind:`sso`,label:`SSO`}},EXTERNAL_AUTH_PROVIDER_CONFIG={github:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`github`,label:`GitHub`},google:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`google`,label:`Google`},slack:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`slack`,label:`Slack`},"google-workspace":{kind:EXTERNAL_AUTH_KIND_CONFIG.sso.kind,provider:`google-workspace`,label:`Google Workspace`}},PUBLIC_AUTH_PROVIDERS=[EXTERNAL_AUTH_PROVIDER_CONFIG.github.provider,EXTERNAL_AUTH_PROVIDER_CONFIG.google.provider],CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER={github:`github`,google:`google`,slack:`slack`,"google-workspace":`googleWorkspace`},LOGIN_METHOD_LABELS={github:`GitHub`,google:`Google`,slack:`Slack`,googleWorkspace:`Google Workspace`},isCliSupportedExternalAuthProvider=n=>n in CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER,readCliLoginMethod=n=>{if(!isCliSupportedExternalAuthProvider(n))throw Error(`CLI login does not support configured auth provider: ${n}`);return CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER[n]},LOGIN_METHODS=PUBLIC_AUTH_PROVIDERS.map(readCliLoginMethod);if(LOGIN_METHODS.length===0)throw Error(`CLI login requires at least one configured customer-facing auth provider`);const DEFAULT_LOGIN_METHOD=LOGIN_METHODS[0],LOGIN_METHOD_OPTIONS_TEXT=LOGIN_METHODS.join(`|`),LOGIN_METHOD_GRID_COLUMN_COUNT=LOGIN_METHODS.length>1?2:1,getLoginMethodLabel=n=>LOGIN_METHOD_LABELS[n],isLoginMethod=n=>LOGIN_METHODS.includes(n),moveLoginMethodSelection=(n,c)=>{let u=Math.floor(n/LOGIN_METHOD_GRID_COLUMN_COUNT),p=n%LOGIN_METHOD_GRID_COLUMN_COUNT;switch(c){case`left`:return u*LOGIN_METHOD_GRID_COLUMN_COUNT+Math.max(p-1,0);case`right`:return Math.min(u*LOGIN_METHOD_GRID_COLUMN_COUNT+Math.min(p+1,LOGIN_METHOD_GRID_COLUMN_COUNT-1),LOGIN_METHODS.length-1);case`up`:return Math.max(n-LOGIN_METHOD_GRID_COLUMN_COUNT,0);case`down`:return Math.min(n+LOGIN_METHOD_GRID_COLUMN_COUNT,LOGIN_METHODS.length-1)}},LINE_BREAK_REGEX=/\r?\n/;function resolveExecutablePath(n){let c=n.configuredPath?.trim()||readExecutablePathFromEnv(n.envKeys??[]);return c?(assertExecutablePath(c),n.validate?.(c),c):findExecutablePath(n)}function assertExecutablePath(n){try{accessSync(n,constants.X_OK)}catch(c){throw Error(`Executable is not runnable at ${n}: ${c instanceof Error?c.message:String(c)}`)}}function readExecutablePathFromEnv(n){for(let c of n){let n=process.env[c]?.trim();if(n)return n}return null}function findExecutablePath(n){let c=new Set;for(let u of listPathEnvCandidates(n))if(!c.has(u)&&(c.add(u),isSupportedExecutablePath(u,n.validate)))return u;for(let u of listWhichCandidates(n.command))if(!c.has(u)&&(c.add(u),isSupportedExecutablePath(u,n.validate)))return u;return null}function listPathEnvCandidates(n){let c=process.platform===`win32`?n.windowsExecutableNames??[`${n.command}.cmd`,`${n.command}.exe`,`${n.command}.bat`,n.command]:[n.command],u=[];for(let n of(process.env.PATH??``).split(delimiter)){let p=normalizePathDirectory(n);if(p)for(let n of c)u.push(join(p,n))}return u}function listWhichCandidates(n){let c=process.platform===`win32`?`where`:`which`,u=process.platform===`win32`?[n]:[`-a`,n];try{return execFileSync(c,u,{encoding:`utf8`,timeout:2e3,stdio:[`ignore`,`pipe`,`ignore`]}).split(LINE_BREAK_REGEX).map(n=>n.trim()).filter(Boolean)}catch{return[]}}function normalizePathDirectory(n){let c=n.trim();return c?c.startsWith(`"`)&&c.endsWith(`"`)?c.slice(1,-1):c:null}function isSupportedExecutablePath(n,c){try{return assertExecutablePath(n),c?.(n),!0}catch{return!1}}const COMMAND_TOKEN_PATTERN=/^(?:"([^"]+)"|'([^']+)'|(\S+))/,LINE_BREAK_PATTERN=/\r?\n/;function probeExecutableCommand(n,c={}){let u=readExecutableCommand(n);if(!u)throw Error(`Executable command is required`);let p=readConfiguredPath(c);if(p)return assertExecutablePath(p),c.validate?.(p),{available:!0,command:u,path:p};let h=findExecutableCommandPath(u,c);return{available:h!==null,command:u,path:h}}function readExecutableCommand(n){let c=n.trim(),u=COMMAND_TOKEN_PATTERN.exec(c);return u?u[1]??u[2]??u[3]??``:``}function readConfiguredPath(n){let c=n.configuredPath?.trim();if(c)return c;for(let c of n.envKeys??[]){let n=process.env[c]?.trim();if(n)return n}return null}function findExecutableCommandPath(n,c){for(let u of listExecutableCommandPaths(n))try{return assertExecutablePath(u),c.validate?.(u),u}catch{continue}return null}function listExecutableCommandPaths(n){try{if(process.platform===`win32`){let c=new Set;try{let u=execFileSync(`where`,[n],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]});for(let n of u.split(LINE_BREAK_PATTERN).map(n=>n.trim()).filter(Boolean))c.add(n)}catch{return[]}return[...c]}return execFileSync(`/bin/sh`,[`-lc`,`command -v -- "$0"`,n],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).split(LINE_BREAK_PATTERN).map(n=>n.trim()).filter(Boolean)}catch{return[]}}const WS_RPC_DEVICES_CHANNELS={DEVICES_LIST:`devices.list`,DEVICES_RENAME:`devices.rename`,DEVICE_AGENT_SESSIONS_LIST:`device.agent.sessions.list`,DEVICE_AGENT_SESSION_METADATA:`device.agent.session.metadata`,DEVICE_AGENT_SESSION_CONFIG_GET:`device.agent.session.config.get`,DEVICE_AGENT_SESSION_CONFIG_SET:`device.agent.session.config.set`,DEVICE_AGENT_SESSION_MESSAGES:`device.agent.session.messages`,DEVICE_AGENT_SESSION_RENAME:`device.agent.session.rename`,DEVICE_AGENT_SESSION_RESUME:`device.agent.session.resume`,DEVICE_AGENT_SESSION_SNAPSHOT:`device.agent.session.snapshot`,DEVICE_AGENT_SESSION_SPAWN:`device.agent.session.spawn`,DEVICE_AGENT_RUN_INTERRUPT:`device.agent.run.interrupt`,DEVICE_TMUX_SESSIONS_LIST:`device.tmux.sessions.list`,DEVICE_TMUX_SESSION_CREATE:`device.tmux.session.create`,DEVICE_TMUX_SESSION_DELETE:`device.tmux.session.delete`,DEVICE_COMMAND_REQUEST_RUN:`device.command.request_run`,DEVICE_COMMAND_REPORT_OUTPUT:`device.command.report_output`,DEVICE_PUSH_TOKEN_UPSERT:`device.push_token.upsert`,DEVICE_PUSH_TOKEN_REVOKE:`device.push_token.revoke`},WS_RPC_FILE_CHANNELS={STAT_LOCAL_FILE:`stat_local_file`,REQUEST_SERVER_FILE:`request_server_file`,UPLOAD_FILE:`upload_file`,CHECK_UPLOAD_FILENAME:`check_upload_filename`,REQUEST_LOCAL_FILE:`request_local_file`,PUT_FILE_TO_LOCAL:`put_file_to_local`,LIST_LOCAL_FILES:`list_local_files`},WS_RPC_CHANNELS={CONNECTION_PING:`connection.ping`,CONNECTION_PONG:`connection.pong`};let ProjectTemplateIconName=function(n){return n.AUTOMATION=`automation`,n.BUG=`bug`,n.BUILD=`build`,n.CALENDAR=`calendar`,n.CODE=`code`,n.DEVICE=`device`,n.DOCUMENTS=`documents`,n.ENGINEERING=`engineering`,n.FINANCE=`finance`,n.IDEA=`idea`,n.INFORMATION=`information`,n.INBOX=`inbox`,n.INVITE=`invite`,n.MARKDOWN=`markdown`,n.PLANNING=`planning`,n.PRODUCT=`product`,n.REIMBURSEMENT=`reimbursement`,n.REQUIREMENTS=`requirements`,n.RESEARCH=`research`,n.REVIEW=`review`,n.SERVER=`server`,n.TEAM=`team`,n.TERMINAL=`terminal`,n.WEB=`web`,n}({}),ProjectTemplateBackgroundColor=function(n){return n.AMBER_SOFT=`#FFEAD5`,n.GREEN_LIGHT=`#E4FBCC`,n.MINT_LIGHT=`#D3F8DF`,n.SKY_LIGHT=`#E0F2FE`,n.BLUE_LIGHT=`#E0EAFF`,n.GRAY_LIGHT=`#EFF1F5`,n.PURPLE_LIGHT=`#FBE8FF`,n.PINK_LIGHT=`#FCE7F6`,n.YELLOW_LIGHT=`#FEF7C3`,n.LIME_LIGHT=`#E6F4D7`,n.CYAN_LIGHT=`#D5F5F6`,n.AZURE_LIGHT=`#D1E9FF`,n.INDIGO_LIGHT=`#D1E0FF`,n.SLATE_LIGHT=`#D5D9EB`,n.VIOLET_LIGHT=`#ECE9FE`,n.ROSE_LIGHT=`#FFE4E8`,n}({}),ProjectTemplateConversationOpenerFileType=function(n){return n.DOCUMENT=`document`,n.IMAGE=`image`,n.AUDIO=`audio`,n.VIDEO=`video`,n.OTHER=`other`,n}({});const richTextBlockSchema=object$1({type:string$2().trim().min(1)}).catchall(jsonValueSchema$1),richTextSchema=object$1({version:literal$1(1),blocks:array$3(richTextBlockSchema)}),projectTemplateConversationOpenerOptionSchema=object$1({type:literal$1(`opening-options`),data:object$1({text:string$2().trim().max(500),instruction:string$2().trim().max(2e3).optional(),file:object$1({types:array$3(nativeEnum(ProjectTemplateConversationOpenerFileType)).min(1).max(5),otherExtensions:array$3(string$2().trim().min(1).max(24)).max(50).optional()}).optional()})}),projectTemplateConversationOpenerSchema=object$1({hints:richTextSchema.optional(),options:array$3(projectTemplateConversationOpenerOptionSchema).max(20).optional()}),projectTemplateGraphSchema=object$1({version:literal$1(`1.0.0`),name:string$2().trim().max(128),description:string$2().trim().max(500),icon:nativeEnum(ProjectTemplateIconName),background:nativeEnum(ProjectTemplateBackgroundColor),nodes:array$3(object$1({id:string$2().trim().min(1),position:object$1({x:number$3().finite(),y:number$3().finite()}),data:object$1({type:literal$1(`task`),icon:nativeEnum(ProjectTemplateIconName),background:nativeEnum(ProjectTemplateBackgroundColor),title:string$2().trim().min(1).max(30),instructions:string$2().max(1e5),conversation_opener:projectTemplateConversationOpenerSchema.optional()})})),edges:array$3(object$1({id:string$2().trim().min(1),source:string$2().trim().min(1),target:string$2().trim().min(1)}))}).superRefine((n,c)=>{let u=new Set;for(let p of n.nodes)u.has(p.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate node id`,path:[`nodes`]}),u.add(p.id);let p=new Set,h=new Map,x=new Map;for(let w of n.edges){p.has(w.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate edge id`,path:[`edges`]}),p.add(w.id),w.source===w.target&&c.addIssue({code:ZodIssueCode.custom,message:`Edge cannot connect a node to itself`,path:[`edges`]}),(!u.has(w.source)||!u.has(w.target))&&c.addIssue({code:ZodIssueCode.custom,message:`Edge endpoint is missing`,path:[`edges`]});let n=(h.get(w.target)??0)+1;n>1&&c.addIssue({code:ZodIssueCode.custom,message:`A node cannot have multiple upstream nodes`,path:[`edges`]}),h.set(w.target,n),x.set(w.source,[...x.get(w.source)??[],w.target])}let w=new Set,T=new Set,O=n=>{if(!T.has(n)){if(w.has(n)){c.addIssue({code:ZodIssueCode.custom,message:`Graph cannot contain cycles`,path:[`edges`]});return}w.add(n);for(let c of x.get(n)??[])O(c);w.delete(n),T.add(n)}};for(let n of u)O(n)}),projectTemplateStarterTemplateSchema=object$1({id:string$2().trim().min(1),graph:projectTemplateGraphSchema}),WS_RPC_RELAY_CHANNELS={RELAY_SESSION_CREATE:`relay.session.create`,RELAY_SESSION_CLOSE:`relay.session.close`,RELAY_SESSION_CONNECT_REQUEST:`relay.session.connect_request`};let LlmScenarioName=function(n){return n.TRANSLATE=`translate`,n.FAST_MODE=`fast_mode`,n.BALANCED_MODE=`balanced_mode`,n.MAX_MODE=`max_mode`,n.DOWNSTREAM_COMPLETION_SUMMARY=`downstream_completion_summary`,n.PROJECT_TEMPLATE_INSTRUCTION_GENERATION=`project_template_instruction_generation`,n.TASK_TITLE_GENERATION=`task_title_generation`,n.GUARDRAIL=`guardrail`,n}({}),ModelApiProviderName=function(n){return n.OPENAI=`openai`,n.ANTHROPIC=`anthropic`,n.BEDROCK=`bedrock`,n.OPENROUTER=`openrouter`,n.OPENAI_COMPATIBLE=`openai-compatible`,n.DEEPSEEK=`deepseek`,n}({});const ProviderCredentialFieldName={API_KEY:`apiKey`,BASE_URL:`baseUrl`,ORGANIZATION:`organization`,REGION:`region`,VALIDATION_MODEL:`validationModel`},ProviderCredentialFieldType={SECURE:`secure`,TEXT:`text`,JSON:`json`},MODEL_API_PROVIDER_DEFINITIONS={openrouter:{provider:`openrouter`,label:`OpenRouter`,sortOrder:10,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://openrouter.ai/api/v1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`anthropic/claude-haiku-4.5`}]},openai:{provider:`openai`,label:`OpenAI`,sortOrder:20,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://api.openai.com/v1`},{name:ProviderCredentialFieldName.ORGANIZATION,label:`Organization`,type:ProviderCredentialFieldType.TEXT,required:!1},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`gpt-5.5`}]},anthropic:{provider:`anthropic`,label:`Anthropic`,sortOrder:30,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://api.anthropic.com`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`claude-haiku-4-5`}]},bedrock:{provider:`bedrock`,label:`Bedrock`,sortOrder:40,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://bedrock-runtime.{region}.amazonaws.com`},{name:ProviderCredentialFieldName.REGION,label:`AWS region`,type:ProviderCredentialFieldType.TEXT,required:!0,defaultValue:`us-east-1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`global.anthropic.claude-haiku-4-5-20251001-v1:0`}]},"openai-compatible":{provider:`openai-compatible`,label:`OpenAI Compatible`,sortOrder:50,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!0,placeholder:`https://api.example.com/v1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!0,placeholder:`provider/model-id`}]},deepseek:{provider:`deepseek`,label:`DeepSeek`,sortOrder:60,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`https://api.deepseek.com`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`deepseek-v4-flash`}]}},MODEL_API_PROVIDER_LIST=Object.values(MODEL_API_PROVIDER_DEFINITIONS).sort((n,c)=>n.sortOrder-c.sortOrder);let ModelPricingCalculatorMethod=function(n){return n.CLAUDE_TOKEN=`claude_token`,n.OPENAI_TOKEN=`openai_token`,n.DEEPSEEK_TOKEN=`deepseek_token`,n.GEMINI_TOKEN=`gemini_token`,n}({}),ModelFamily=function(n){return n.CLAUDE=`claude`,n.OPENAI=`openai`,n.GEMINI=`gemini`,n.DEEPSEEK=`deepseek`,n.CUSTOM=`custom`,n}({});const llmRequestParametersSchema=record$1(string$2(),jsonValueSchema$1),modelContextBaseSchema=object$1({contextWindowTokens:number$3().int().positive(),compactionThresholdRatio:number$3().min(0).max(1)}),llmPromptModelContextSchema=modelContextBaseSchema.extend({type:literal$1(`prompt`)}).strict(),llmNativeModelContextSchema=modelContextBaseSchema.extend({type:literal$1(`native`)}).strict(),llmModelContextSchema=discriminatedUnion$1(`type`,[llmPromptModelContextSchema,llmNativeModelContextSchema]),llmModelConfigSchema=object$1({modelId:string$2().trim().min(1),context:llmModelContextSchema,parameters:llmRequestParametersSchema.optional()}).strict(),knownLlmModelConfigSchema=llmModelConfigSchema.extend({family:nativeEnum(ModelFamily)}).strict(),llmBillingConfigSchema=object$1({calculatorMethod:nativeEnum(ModelPricingCalculatorMethod),pricing:record$1(string$2(),jsonValueSchema$1)}).strict(),llmProviderModelConfigSchema=object$1({provider:nativeEnum(ModelApiProviderName),modelConfig:knownLlmModelConfigSchema}).strict(),llmPlatformModelConfigSchema=llmProviderModelConfigSchema.extend({billingConfig:llmBillingConfigSchema}).strict(),llmScenarioConfigMapSchema=object$1({translate:string$2().trim().min(1),fast_mode:string$2().trim().min(1),balanced_mode:string$2().trim().min(1),max_mode:string$2().trim().min(1),downstream_completion_summary:string$2().trim().min(1),project_template_instruction_generation:string$2().trim().min(1),task_title_generation:string$2().trim().min(1),guardrail:string$2().trim().min(1)});function validatePlatformConfig(n,c){for(let[u,p]of Object.entries(n.scenarios))n.models[p]||c.addIssue({code:ZodIssueCode.custom,message:`Scenario references missing model config: ${p}`,path:[`scenarios`,u]});for(let[u,p]of Object.entries(n.models))p.modelConfig.family===`custom`&&c.addIssue({code:ZodIssueCode.custom,message:`Platform model config cannot use custom family`,path:[`models`,u,`modelConfig`,`family`]})}const llmPlatformConfigSchema=object$1({version:literal$1(1),scenarios:llmScenarioConfigMapSchema,models:record$1(string$2().trim().min(1),llmPlatformModelConfigSchema)}).strict().superRefine(validatePlatformConfig),putLlmPlatformConfigInputSchema=object$1({expectedRevision:string$2().nullable(),config:llmPlatformConfigSchema}),userCustomModelConfigSchema=object$1({temperature:number$3().min(0).max(2)}).strict(),workspaceScenarioModelConfigSchema=object$1({modelId:string$2().trim().min(1),context:llmPromptModelContextSchema.optional(),customConfig:userCustomModelConfigSchema.optional()}).strict(),workspaceLlmScenarioRouteSchema=object$1({credentialId:string$2().trim().min(1),modelConfig:workspaceScenarioModelConfigSchema}).strict(),workspaceLlmScenarioRouteMapSchema=object$1({translate:workspaceLlmScenarioRouteSchema.optional(),fast_mode:workspaceLlmScenarioRouteSchema.optional(),balanced_mode:workspaceLlmScenarioRouteSchema.optional(),max_mode:workspaceLlmScenarioRouteSchema.optional(),downstream_completion_summary:workspaceLlmScenarioRouteSchema.optional(),project_template_instruction_generation:workspaceLlmScenarioRouteSchema.optional(),task_title_generation:workspaceLlmScenarioRouteSchema.optional(),guardrail:workspaceLlmScenarioRouteSchema.optional()}).strict(),workspaceLlmSettingsSchema=object$1({enabled:boolean$1(),scenarioRoutes:workspaceLlmScenarioRouteMapSchema}).strict(),projectTemplateBlueprintsConfigValueSchema=object$1({templates:array$3(projectTemplateStarterTemplateSchema)}).superRefine((n,c)=>{validateProjectTemplateBlueprints(n.templates,c)}),putProjectTemplateBlueprintsConfigInputSchema=object$1({expectedRevision:string$2().nullable(),templates:array$3(projectTemplateStarterTemplateSchema)}).superRefine((n,c)=>{validateProjectTemplateBlueprints(n.templates,c)});function validateProjectTemplateBlueprints(n,c){let u=new Set;for(let p of n)u.has(p.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate template blueprint id`,path:[`templates`]}),u.add(p.id)}const taskMessageOriginSchema=_enum$1([`human`,`agent`]),taskMessageLlmRouteMetadataBaseSchema=object$1({version:literal$1(1),scenario:nativeEnum(LlmScenarioName),provider:nativeEnum(ModelApiProviderName),model_id:string$2().trim().min(1),model_family:nativeEnum(ModelFamily),model_config:llmModelConfigSchema}),taskMessageLlmRouteMetadataSchema=discriminatedUnion$1(`owner`,[taskMessageLlmRouteMetadataBaseSchema.extend({owner:literal$1(`platform`),platform_model_config_id:string$2().trim().min(1)}).catchall(jsonValueSchema$1),taskMessageLlmRouteMetadataBaseSchema.extend({owner:literal$1(`workspace`),credential_id:string$2().trim().min(1)}).catchall(jsonValueSchema$1)]),taskMessageMetadataSchema=object$1({message_origin:taskMessageOriginSchema.optional(),llm_route:taskMessageLlmRouteMetadataSchema.optional()}).catchall(jsonValueSchema$1),taskSendTextBlockSchema=object$1({type:literal$1(`text`),text:string$2()});async function connectNodeTcpSocket(n){let c=new URL(n.relayUrl);c.searchParams.set(`token`,n.token);let u=new WebSocket(c);u.binaryType=`arraybuffer`,await onceConnected(u);let p=new Set,h=new Set,x=async n=>{if(typeof n.data==`string`)return;let c=await toUint8Array(n.data);p.forEach(n=>n(c))};return u.addEventListener(`message`,n=>{x(n)}),u.addEventListener(`close`,()=>{h.forEach(n=>n())}),u.addEventListener(`error`,n=>{h.forEach(c=>c(toWebSocketError(n)))}),new TcpSocket(n.sessionId,{write:async n=>{u.send(n)},close:async()=>{u.close()},onData:n=>(p.add(n),()=>p.delete(n)),onClose:n=>(h.add(n),()=>h.delete(n))})}function onceConnected(n){return new Promise((c,u)=>{let p=()=>{},h=()=>{p(),c()},x=n=>{p(),u(toWebSocketError(n))};p=()=>{n.removeEventListener(`open`,h),n.removeEventListener(`error`,x)},n.addEventListener(`open`,h,{once:!0}),n.addEventListener(`error`,x,{once:!0})})}function toWebSocketError(n){if(typeof ErrorEvent<`u`&&n instanceof ErrorEvent&&n.error instanceof Error)return n.error;if(typeof n==`object`&&n&&`error`in n){let c=n.error;if(c instanceof Error)return c;if(typeof c==`string`&&c.length>0)return Error(c)}return Error(`WebSocket connection error`)}async function toUint8Array(n){return n instanceof ArrayBuffer?new Uint8Array(n):n instanceof Blob?new Uint8Array(await n.arrayBuffer()):ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(Buffer$1.from(n))}async function acceptAgentRunRelaySession(n){let c=await connectNodeTcpSocket({relayUrl:n.relayUrl,sessionId:n.sessionId,token:n.token,role:`acceptor`}),u=await n.integration.subscribeRun(n.runId);(async()=>{try{for await(let n of u)await c.write(encodeFrame({kind:`live_event`,event:n}));await c.write(encodeFrame({kind:`terminal`}))}catch{await u.return?.(void 0)}finally{await c.close().catch(()=>{})}})(),(async()=>{try{for(;;)await c.read()}catch{await u.return?.(void 0),await c.close().catch(()=>{})}})()}function createAgentIntegrationHandlers(n){return{listSessions:async c=>({items:await getIntegration(n.integrations,c.agentType).listRecentSessions(c.limit)}),getSessionMetadata:async c=>{let u=getIntegration(n.integrations,c.agentType);return{metadata:await u.getSessionMetadata(c.sessionId),activeRunId:u.getActiveRunId(c.sessionId)}},getSessionConfig:async c=>({config:await getIntegration(n.integrations,c.agentType).getSessionConfig(c.sessionId)}),setSessionConfig:async c=>{await getIntegration(n.integrations,c.agentType).setSessionConfig(c.sessionId,c.config)},getSessionMessages:async c=>await getIntegration(n.integrations,c.agentType).getSessionMessages(c.sessionId,c.beforeMessageCursor,c.limit),getSessionSnapshot:async c=>({latestMessageCursor:(await getIntegration(n.integrations,c.agentType).getSessionSnapshot(c.sessionId)).latestMessageCursor}),spawnSession:async c=>await getIntegration(n.integrations,c.agentType).spawnSession(c.prompt,c.config,c.cwd),resumeSession:async c=>await getIntegration(n.integrations,c.agentType).resumeSession(c.sessionId,c.prompt),renameSession:async c=>{await getIntegration(n.integrations,c.agentType).renameSession(c.sessionId,c.displayName)},interruptRun:async c=>{getIntegration(n.integrations,c.agentType).interruptRun(c.runId)},acceptRunRelaySession:async c=>{await acceptAgentRunRelaySession({integration:getIntegration(n.integrations,c.agentType),relayUrl:c.relayUrl,sessionId:c.sessionId,runId:c.runId,token:c.token})}}}function getIntegration(n,c){let u=n[c];if(!u)throw Error(`Unsupported agent type: ${String(c)}`);return u}function registerAgentDeviceRpcHandlers(n,c){let u=createAgentIntegrationHandlers(c),p=[n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSIONS_LIST,async n=>await u.listSessions(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_METADATA,async n=>await u.getSessionMetadata(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_CONFIG_GET,async n=>await u.getSessionConfig(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_CONFIG_SET,async n=>(await u.setSessionConfig(n),{})),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_MESSAGES,async n=>await u.getSessionMessages(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_SNAPSHOT,async n=>await u.getSessionSnapshot(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_SPAWN,async n=>await u.spawnSession(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_RESUME,async n=>await u.resumeSession(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_RENAME,async n=>(await u.renameSession(n),{})),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_RUN_INTERRUPT,async n=>(await u.interruptRun(n),{}))];return()=>{for(let c of p)n.removeRpcHandler(c)}}var AgentIntegrationRuntimeState=class{activeRunsById=new Map;activeRunIdBySessionId=new Map;subscribersByRunId=new Map;recordRunStarted(n){let c=randomUUID$1();return this.activeRunsById.set(c,{config:n.config,controller:n.controller,metadata:n.metadata,sessionId:n.sessionId}),n.sessionId!==void 0&&this.activeRunIdBySessionId.set(n.sessionId,c),c}hasActiveRunForSession(n){return this.activeRunIdBySessionId.has(n)}hasActiveRun(n){return this.activeRunsById.has(n)}getActiveRunId(n){return this.activeRunIdBySessionId.get(n)??null}getActiveSessionConfig(n){let c=this.readActiveRunForSession(n);return c?c.config:null}getActiveSessionMetadata(n){let c=this.readActiveRunForSession(n);return c?c.metadata:null}readOwnedRun(n,c){let u=this.activeRunsById.get(n);return!u||u.controller!==c?null:u}bindRunToSession(n,c,u){let p=this.readOwnedRun(n,c);p&&(p.sessionId=u,p.metadata={...p.metadata,sessionId:u},this.activeRunIdBySessionId.set(u,n))}updateActiveSessionConfig(n,c){let u=this.readActiveRunForSession(n);u&&(u.config=c)}updateActiveSessionMetadata(n){let c=this.readActiveRunForSession(n.sessionId);c&&(c.metadata={...c.metadata,...n.patch,sessionId:n.sessionId})}subscribeToRun(n,c){let u=this.subscribersByRunId.get(n)??new Set;return u.add(c),this.subscribersByRunId.set(n,u),()=>{let u=this.subscribersByRunId.get(n);u&&(u.delete(c),u.size===0&&this.subscribersByRunId.delete(n))}}createRunEventGenerator(n){if(!this.activeRunsById.has(n))return(async function*(){})();let c=[],u=!1,p=null,h=this.subscribeToRun(n,{onEvent:n=>{c.push(n.event);let u=p;p=null,u?.()},onTerminal:()=>{u=!0;let n=p;p=null,n?.()}});return(async function*(){try{for(;!(u&&c.length===0);){if(c.length===0){await new Promise(n=>{p=n});continue}let n=c.shift();n&&(yield n)}}finally{h()}})()}emitRunEvent(n){let c=this.subscribersByRunId.get(n.runId);if(!(!c||c.size===0))for(let u of c)u.onEvent(n)}emitRunTerminal(n){let c=this.subscribersByRunId.get(n.runId);if(!(!c||c.size===0))for(let u of c)u.onTerminal(n)}interruptRun(n){let c=this.activeRunsById.get(n);if(!c)throw Error(`Agent run is not running: ${n}`);c.controller.abort()}completeOwnedRun(n,c){let u=this.readOwnedRun(n,c);u&&(this.activeRunsById.delete(n),u.sessionId!==void 0&&this.activeRunIdBySessionId.get(u.sessionId)===n&&this.activeRunIdBySessionId.delete(u.sessionId))}readActiveRunForSession(n){let c=this.activeRunIdBySessionId.get(n);return c?this.activeRunsById.get(c)??null:null}};const DEVICE_REPORTED_OS_PLATFORM_ALIASES={android:`android`,darwin:`macos`,ios:`ios`,linux:`linux`,macos:`macos`,web:`web`,win32:`windows`,windows:`windows`},normalizeDeviceReportedOsPlatform=n=>{let c=typeof n==`string`?trimAndLowercase(n):``;return!c||!(c in DEVICE_REPORTED_OS_PLATFORM_ALIASES)?null:DEVICE_REPORTED_OS_PLATFORM_ALIASES[c]},HOST_DEVICE_INFO_TIMEOUT_MS=3e3,LINUX_OS_RELEASE_PATHS=[`/etc/os-release`,`/usr/lib/os-release`],LINUX_SYS_VENDOR_PATH=`/sys/devices/virtual/dmi/id/sys_vendor`,LINUX_PRODUCT_NAME_PATH=`/sys/devices/virtual/dmi/id/product_name`,LINUX_PRODUCT_VERSION_PATH=`/sys/devices/virtual/dmi/id/product_version`,LINE_SPLIT_REGEX=/\r?\n/,WINDOWS_POWERSHELL_COMMAND=[`$os = Get-CimInstance Win32_OperatingSystem`,`$cs = Get-CimInstance Win32_ComputerSystem`,`$csp = Get-CimInstance Win32_ComputerSystemProduct`,`[pscustomobject]@{`,` osVersion = $os.Version`,` osBuild = $os.BuildNumber`,` manufacturer = $cs.Manufacturer`,` modelName = $cs.Model`,` modelIdentifier = $csp.Version`,`} | ConvertTo-Json -Compress`].join(`; `),readTrimmedValue=n=>typeof n==`string`&&n.trim()?n.trim():null,normalizeHostOsPlatform=n=>normalizeDeviceReportedOsPlatform(n)??`linux`,normalizeCpuArchitecture=n=>{let c=readTrimmedValue(n);if(!c)return null;let u=c.toLowerCase();return u.includes(`arm64`)||u.includes(`aarch64`)?`arm64`:u===`arm`||u.startsWith(`armv`)?`arm`:u.includes(`x86_64`)||u.includes(`amd64`)||u===`x64`?`x64`:u===`ia32`||u===`x86`||u===`i386`||u===`i686`?`ia32`:c},readCommandStdout=async(n,c)=>{try{return readTrimmedValue(await new Promise((u,p)=>{execFile$1(n,c,{encoding:`utf8`,env:process.env,timeout:HOST_DEVICE_INFO_TIMEOUT_MS},(n,c)=>{if(n){p(n);return}u(c)})}))}catch{return null}},readCommandStdoutWithFallback=async n=>{for(let{command:c,args:u}of n){let n=await readCommandStdout(c,u);if(n)return n}return null},readFileValue=async n=>{try{return readTrimmedValue(await readFile$1(n,`utf8`))}catch{return null}},parseMacModelName=n=>{try{return readTrimmedValue(JSON.parse(n).SPHardwareDataType?.[0]?.machine_name)}catch{return null}},parseWindowsHostInfo=n=>{try{let c=JSON.parse(n);return{osVersion:readTrimmedValue(c.osVersion),osBuild:readTrimmedValue(c.osBuild),manufacturer:readTrimmedValue(c.manufacturer),modelName:readTrimmedValue(c.modelName),modelIdentifier:readTrimmedValue(c.modelIdentifier)}}catch{return null}},parseOsRelease=n=>{let c=new Map;for(let u of n.split(LINE_SPLIT_REGEX)){let n=u.trim();if(!n||n.startsWith(`#`))continue;let p=n.indexOf(`=`);if(p<=0)continue;let h=trimAndUppercase(n.slice(0,p)),x=n.slice(p+1).trim(),w=x.startsWith(`"`)&&x.endsWith(`"`)?x.slice(1,-1):x;c.set(h,w)}return{versionId:readTrimmedValue(c.get(`VERSION_ID`)),buildId:readTrimmedValue(c.get(`BUILD_ID`))}},readLinuxOsRelease=async()=>{for(let n of LINUX_OS_RELEASE_PATHS){let c=await readFileValue(n);if(c)return parseOsRelease(c)}return null},readMacModelName=async()=>{let n=await readCommandStdout(`system_profiler`,[`SPHardwareDataType`,`-json`]);return n?parseMacModelName(n):null},readMacModelIdentifier=async()=>await readCommandStdout(`sysctl`,[`-n`,`hw.model`]),readWindowsHostInfo=async()=>{let n=await readCommandStdoutWithFallback([{command:`powershell.exe`,args:[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-Command`,WINDOWS_POWERSHELL_COMMAND]},{command:`powershell`,args:[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-Command`,WINDOWS_POWERSHELL_COMMAND]}]);return n?parseWindowsHostInfo(n):null},createBaseDeviceInfo=n=>({osPlatform:n,osVersion:null,osBuild:null,cpuArchitecture:normalizeCpuArchitecture(process.arch),manufacturer:null,modelName:null,modelIdentifier:null}),readMacDeviceInfo=async()=>{let[n,c,u,p]=await Promise.all([readCommandStdout(`sw_vers`,[`-productVersion`]),readCommandStdout(`sw_vers`,[`-buildVersion`]),readMacModelName(),readMacModelIdentifier()]);return{...createBaseDeviceInfo(`macos`),osVersion:n,osBuild:c,manufacturer:`Apple`,modelName:u,modelIdentifier:p}},readLinuxDeviceInfo=async()=>{let[n,c,u,p,h]=await Promise.all([readLinuxOsRelease(),readCommandStdout(`uname`,[`-r`]),readFileValue(LINUX_SYS_VENDOR_PATH),readFileValue(LINUX_PRODUCT_NAME_PATH),readFileValue(LINUX_PRODUCT_VERSION_PATH)]);return{...createBaseDeviceInfo(`linux`),osVersion:n?.versionId??null,osBuild:n?.buildId??c,manufacturer:u,modelName:p,modelIdentifier:h}},readWindowsDeviceInfo=async()=>{let n=await readWindowsHostInfo();return{...createBaseDeviceInfo(`windows`),osVersion:n?.osVersion??null,osBuild:n?.osBuild??null,manufacturer:n?.manufacturer??null,modelName:n?.modelName??null,modelIdentifier:n?.modelIdentifier??null}},HOST_DEVICE_INFO_READERS={linux:readLinuxDeviceInfo,macos:readMacDeviceInfo,windows:readWindowsDeviceInfo},getHostDeviceInfo=async()=>{let n=normalizeHostOsPlatform(process.platform),c=HOST_DEVICE_INFO_READERS[n];return c?await c():createBaseDeviceInfo(n)},HOST_COMMAND_CAPABILITY_NAME={TMUX:`tmux`,CODEX:`codex`,CLAUDE:`claude`},CODEX_EXECUTABLE_ENV_KEYS$1=[`CODEX_EXECUTABLE`,`CODEX_EXECUTABLE_PATH`],CLAUDE_CODE_EXECUTABLE_ENV_KEYS$1=[`CLAUDE_CODE_EXECUTABLE`,`CLAUDE_CODE_EXECUTABLE_PATH`],HOST_COMMAND_CAPABILITY_DEFINITIONS={[HOST_COMMAND_CAPABILITY_NAME.TMUX]:{command:`tmux`},[HOST_COMMAND_CAPABILITY_NAME.CODEX]:{command:`codex`,probeOptions:{envKeys:CODEX_EXECUTABLE_ENV_KEYS$1}},[HOST_COMMAND_CAPABILITY_NAME.CLAUDE]:{command:`claude`,probeOptions:{envKeys:CLAUDE_CODE_EXECUTABLE_ENV_KEYS$1}}},buildCliDeviceName=()=>`Syncless CLI (${hostname()})`,readHostDeviceInfo=getHostDeviceInfo;let cliHostDeviceInfoPromise=null;const getCliHostDeviceInfo=async()=>(cliHostDeviceInfoPromise??=readHostDeviceInfo(),await cliHostDeviceInfoPromise),probeCliAgentCapability=n=>{try{let c=HOST_COMMAND_CAPABILITY_DEFINITIONS[n];return probeExecutableCommand(c.command,c.probeOptions).available}catch{return!1}},waitForRuntimeAuthentication=async n=>{let c=n.useConnectionUIStore.getState().status;if(c===ConnectionUIStatus.SIGNED_OUT){let c=n.useLoginCycleStore.getState().errorMessage;if(c)throw Error(c)}if(c===ConnectionUIStatus.ONLINE){await n.provider.sendRpc(WS_RPC_CHANNELS.CONNECTION_PING,{sentAt:new Date().toISOString()});return}await new Promise((c,u)=>{let p=()=>{},h=n.useConnectionUIStore.subscribe(async x=>{if(x.status===ConnectionUIStatus.ONLINE)try{await n.provider.sendRpc(WS_RPC_CHANNELS.CONNECTION_PING,{sentAt:new Date().toISOString()}),h(),p(),c()}catch(n){h(),p(),u(n)}});p=n.useLoginCycleStore.subscribe(n=>{n.status===LoginCycleStatus.ERROR&&(h(),p(),u(Error(n.errorMessage??`Authentication failed`)))})})},createCliNetworkRuntime=n=>{let c=createNetworkRuntime({apiBaseUrl:n.endpoints.apiBaseUrl,httpFetch:createCliObservedFetch(`cli.auth`),observability:getCliObservability().createNetworkPort(),wsBaseUrl:n.endpoints.wsBaseUrl,persistence:cliPersistenceStore,providers:{github:GitHubOAuthLoginAdapter,google:GoogleOAuthLoginAdapter,slack:SlackOAuthLoginAdapter,googleWorkspace:GoogleWorkspaceSSOLoginAdapter},hooks:{getDeviceCode:async()=>n.deviceCode,getDeviceInfo:async()=>await getCliHostDeviceInfo(),getDeviceMetadata:n.getDeviceMetadata??(async()=>null),getDeviceName:async()=>buildCliDeviceName(),getDeviceType:async()=>`cli_host`,getUserAgent:async()=>`echo-cli`,openExternalUrl:n.onExternalUrl,supportBrowser:async()=>!1,supportClaude:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.CLAUDE),supportCodex:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.CODEX),supportTmux:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.TMUX)},callbacks:n.callbacks}),u=bindCliAuthObservabilityScope(c),p=c.stop;return c.stop=()=>{u(),p()},c},getRuntimeAuthError=n=>n.useLoginCycleStore.getState().status===LoginCycleStatus.ERROR?n.useLoginCycleStore.getState().errorMessage:null,loginWithBootstrapToken=async n=>{let c=await exchangeCliSessionBootstrap(n.endpoints.apiBaseUrl,{token:n.token,deviceCode:n.deviceCode,deviceName:buildCliDeviceName()},{fetchImpl:createCliObservedFetch(`cli.auth.bootstrap`)});await saveAuthSession({email:c.email,token:c.token,expiresAt:c.expiresAt,updatedAt:c.updatedAt,userId:c.userId,name:c.name,avatarUrl:c.avatarUrl??null,onboardingCompleted:!1,projectTemplateOnboardingCompleted:!1},n.endpoints)},toLogPayload=n=>n.map(n=>`${n}\n`).join(``),createCliLogFileWriter=()=>{let n=Promise.resolve(),c=null;return{appendLines:u=>{if(u.length===0)return;let p=toLogPayload(u);n=n.then(async()=>{await mkdir(getLogsDirectoryPath(),{recursive:!0}),await appendFile(getDailyLogPath(new Date),p,`utf8`)}).catch(n=>{c=n})},flush:async()=>{if(await n,!c)return;let u=c;throw c=null,u instanceof Error?u:Error(String(u))}}};var Nj=Object.create,{getPrototypeOf:Vj,defineProperty:D5,getOwnPropertyNames:wj}=Object,Oj=Object.prototype.hasOwnProperty;function Bj(n){return this[n]}var qj,Dj,VH=(n,c,u)=>{var p=typeof n==`object`&&!!n;if(p){var h=c?qj??=new WeakMap:Dj??=new WeakMap,x=h.get(n);if(x)return x}u=n==null?{}:Nj(Vj(n));let w=c||!n||!n.__esModule?D5(u,`default`,{value:n,enumerable:!0}):u;for(let c of wj(n))Oj.call(w,c)||D5(w,c,{get:Bj.bind(n,c),enumerable:!0});return p&&h.set(n,w),w},k=(n,c)=>()=>(c||n((c={exports:{}}).exports,c),c.exports),Lj=n=>n;function jj(n,c){this[n]=Lj.bind(null,c)}var z1=(n,c)=>{for(var u in c)D5(n,u,{get:c[u],enumerable:!0,configurable:!0,set:jj.bind(c,u)})},Fj=Symbol.dispose||Symbol.for(`Symbol.dispose`),Mj=Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`),w$=(n,c,u)=>{if(c!=null){if(typeof c!=`object`&&typeof c!=`function`)throw TypeError(`Object expected to be assigned to "using" declaration`);var p;if(u&&(p=c[Mj]),p===void 0&&(p=c[Fj]),typeof p!=`function`)throw TypeError(`Object not disposable`);n.push([u,p,c])}else u&&n.push([u]);return c},O$=(n,c,u)=>{var p=typeof SuppressedError==`function`?SuppressedError:function(n,c,u,p){return p=Error(u),p.name=`SuppressedError`,p.error=n,p.suppressed=c,p},h=n=>c=u?new p(n,c,`An error was suppressed during disposal`):(u=!0,n),x=p=>{for(;p=n.pop();)try{var w=p[1]&&p[1].call(p[2]);if(p[0])return Promise.resolve(w).then(x,n=>(h(n),x()))}catch(n){h(n)}if(u)throw c};return x()},v9=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class c{}n._CodeOrName=c,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class u extends c{constructor(c){if(super(),!n.IDENTIFIER.test(c))throw Error(`CodeGen: name must be a valid identifier`);this.str=c}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}n.Name=u;class p extends c{constructor(n){super(),this._items=typeof n==`string`?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===``||n===`""`}get str(){var n;return this._str??=this._items.reduce((n,c)=>`${n}${c}`,``)}get names(){var n;return this._names??=this._items.reduce((n,c)=>(c instanceof u&&(n[c.str]=(n[c.str]||0)+1),n),{})}}n._Code=p,n.nil=new p(``);function h(n,...c){let u=[n[0]],h=0;for(;h<c.length;)T(u,c[h]),u.push(n[++h]);return new p(u)}n._=h;var x=new p(`+`);function w(n,...c){let u=[L(n[0])],h=0;for(;h<c.length;)u.push(x),T(u,c[h]),u.push(x,L(n[++h]));return O(u),new p(u)}n.str=w;function T(n,c){c instanceof p?n.push(...c._items):c instanceof u?n.push(c):n.push(N(c))}n.addCodeArg=T;function O(n){let c=1;for(;c<n.length-1;){if(n[c]===x){let u=A(n[c-1],n[c+1]);if(u!==void 0){n.splice(c-1,3,u);continue}n[c++]=`+`}c++}}function A(n,c){if(c===`""`)return n;if(n===`""`)return c;if(typeof n==`string`)return c instanceof u||n[n.length-1]!==`"`?void 0:typeof c==`string`?c[0]===`"`?n.slice(0,-1)+c.slice(1):void 0:`${n.slice(0,-1)}${c}"`;if(typeof c==`string`&&c[0]===`"`&&!(n instanceof u))return`"${n}${c.slice(1)}`}function j(n,c){return c.emptyStr()?n:n.emptyStr()?c:w`${n}${c}`}n.strConcat=j;function N(n){return typeof n==`number`||typeof n==`boolean`||n===null?n:L(Array.isArray(n)?n.join(`,`):n)}function I(n){return new p(L(n))}n.stringify=I;function L(n){return JSON.stringify(n).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}n.safeStringify=L;function z(c){return typeof c==`string`&&n.IDENTIFIER.test(c)?new p(`.${c}`):h`[${c}]`}n.getProperty=z;function B(c){if(typeof c==`string`&&n.IDENTIFIER.test(c))return new p(`${c}`);throw Error(`CodeGen: invalid export name: ${c}, use explicit $id name mapping`)}n.getEsmExportName=B;function V(n){return new p(n.toString())}n.regexpCode=V}),d3=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;var c=v9();class u extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`),this.value=n.value}}var p;(function(n){n[n.Started=0]=`Started`,n[n.Completed=1]=`Completed`})(p||(n.UsedValueState=p={})),n.varKinds={const:new c.Name(`const`),let:new c.Name(`let`),var:new c.Name(`var`)};class h{constructor({prefixes:n,parent:c}={}){this._names={},this._prefixes=n,this._parent=c}toName(n){return n instanceof c.Name?n:this.name(n)}name(n){return new c.Name(this._newName(n))}_newName(n){let c=this._names[n]||this._nameGroup(n);return`${n}${c.index++}`}_nameGroup(n){var c,u;if((this._parent?._prefixes)?.has(n)||this._prefixes&&!this._prefixes.has(n))throw Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}}n.Scope=h;class x extends c.Name{constructor(n,c){super(c),this.prefix=n}setValue(n,{property:u,itemIndex:p}){this.value=n,this.scopePath=c._`.${new c.Name(u)}[${p}]`}}n.ValueScopeName=x;var w=c._`\n`;class T extends h{constructor(n){super(n),this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?w:c.nil}}get(){return this._scope}name(n){return new x(n,this._newName(n))}value(n,c){var u;if(c.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let p=this.toName(n),{prefix:h}=p,x=c.key??c.ref,w=this._values[h];if(w){let n=w.get(x);if(n)return n}else w=this._values[h]=new Map;w.set(x,p);let T=this._scope[h]||(this._scope[h]=[]),O=T.length;return T[O]=c.ref,p.setValue(c,{property:h,itemIndex:O}),p}getValue(n,c){let u=this._values[n];if(u)return u.get(c)}scopeRefs(n,u=this._values){return this._reduceValues(u,u=>{if(u.scopePath===void 0)throw Error(`CodeGen: name "${u}" has no value`);return c._`${n}${u.scopePath}`})}scopeCode(n=this._values,c,u){return this._reduceValues(n,n=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},c,u)}_reduceValues(h,x,w={},T){let O=c.nil;for(let A in h){let j=h[A];if(!j)continue;let N=w[A]=w[A]||new Map;j.forEach(h=>{if(N.has(h))return;N.set(h,p.Started);let w=x(h);if(w){let u=this.opts.es5?n.varKinds.var:n.varKinds.const;O=c._`${O}${u} ${h} = ${w};${this.opts._n}`}else if(w=T?.(h))O=c._`${O}${w}${this.opts._n}`;else throw new u(h);N.set(h,p.Completed)})}return O}}n.ValueScope=T}),a=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;var c=v9(),u=d3(),p=v9();Object.defineProperty(n,`_`,{enumerable:!0,get:function(){return p._}}),Object.defineProperty(n,`str`,{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(n,`strConcat`,{enumerable:!0,get:function(){return p.strConcat}}),Object.defineProperty(n,`nil`,{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(n,`getProperty`,{enumerable:!0,get:function(){return p.getProperty}}),Object.defineProperty(n,`stringify`,{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(n,`regexpCode`,{enumerable:!0,get:function(){return p.regexpCode}}),Object.defineProperty(n,`Name`,{enumerable:!0,get:function(){return p.Name}});var h=d3();Object.defineProperty(n,`Scope`,{enumerable:!0,get:function(){return h.Scope}}),Object.defineProperty(n,`ValueScope`,{enumerable:!0,get:function(){return h.ValueScope}}),Object.defineProperty(n,`ValueScopeName`,{enumerable:!0,get:function(){return h.ValueScopeName}}),Object.defineProperty(n,`varKinds`,{enumerable:!0,get:function(){return h.varKinds}}),n.operators={GT:new c._Code(`>`),GTE:new c._Code(`>=`),LT:new c._Code(`<`),LTE:new c._Code(`<=`),EQ:new c._Code(`===`),NEQ:new c._Code(`!==`),NOT:new c._Code(`!`),OR:new c._Code(`||`),AND:new c._Code(`&&`),ADD:new c._Code(`+`)};class x{optimizeNodes(){return this}optimizeNames(n,c){return this}}class w extends x{constructor(n,c,u){super(),this.varKind=n,this.name=c,this.rhs=u}render({es5:n,_n:c}){let p=n?u.varKinds.var:this.varKind,h=this.rhs===void 0?``:` = ${this.rhs}`;return`${p} ${this.name}${h};`+c}optimizeNames(n,c){if(n[this.name.str])return this.rhs&&=ae(this.rhs,n,c),this}get names(){return this.rhs instanceof c._CodeOrName?this.rhs.names:{}}}class T extends x{constructor(n,c,u){super(),this.lhs=n,this.rhs=c,this.sideEffects=u}render({_n:n}){return`${this.lhs} = ${this.rhs};`+n}optimizeNames(n,u){if(!(this.lhs instanceof c.Name&&!n[this.lhs.str]&&!this.sideEffects))return this.rhs=ae(this.rhs,n,u),this}get names(){return ie(this.lhs instanceof c.Name?{}:{...this.lhs.names},this.rhs)}}class O extends T{constructor(n,c,u,p){super(n,u,p),this.op=c}render({_n:n}){return`${this.lhs} ${this.op}= ${this.rhs};`+n}}class A extends x{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`${this.label}:`+n}}class j extends x{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`break${this.label?` ${this.label}`:``};`+n}}class N extends x{constructor(n){super(),this.error=n}render({_n:n}){return`throw ${this.error};`+n}get names(){return this.error.names}}class I extends x{constructor(n){super(),this.code=n}render({_n:n}){return`${this.code};`+n}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(n,c){return this.code=ae(this.code,n,c),this}get names(){return this.code instanceof c._CodeOrName?this.code.names:{}}}class L extends x{constructor(n=[]){super(),this.nodes=n}render(n){return this.nodes.reduce((c,u)=>c+u.render(n),``)}optimizeNodes(){let{nodes:n}=this,c=n.length;for(;c--;){let u=n[c].optimizeNodes();Array.isArray(u)?n.splice(c,1,...u):u?n[c]=u:n.splice(c,1)}return n.length>0?this:void 0}optimizeNames(n,c){let{nodes:u}=this,p=u.length;for(;p--;){let h=u[p];h.optimizeNames(n,c)||(oe(n,h.names),u.splice(p,1))}return u.length>0?this:void 0}get names(){return this.nodes.reduce((n,c)=>X(n,c.names),{})}}class z extends L{render(n){return`{`+n._n+super.render(n)+`}`+n._n}}class B extends L{}class V extends z{}V.kind=`else`;class H extends z{constructor(n,c){super(c),this.condition=n}render(n){let c=`if(${this.condition})`+super.render(n);return this.else&&(c+=`else `+this.else.render(n)),c}optimizeNodes(){super.optimizeNodes();let n=this.condition;if(n===!0)return this.nodes;let c=this.else;if(c){let n=c.optimizeNodes();c=this.else=Array.isArray(n)?new V(n):n}if(c)return n===!1?c instanceof H?c:c.nodes:this.nodes.length?this:new H(se(n),c instanceof H?[c]:c.nodes);if(!(n===!1||!this.nodes.length))return this}optimizeNames(n,c){var u;if(this.else=this.else?.optimizeNames(n,c),super.optimizeNames(n,c)||this.else)return this.condition=ae(this.condition,n,c),this}get names(){let n=super.names;return ie(n,this.condition),this.else&&X(n,this.else.names),n}}H.kind=`if`;class U extends z{}U.kind=`for`;class W extends U{constructor(n){super(),this.iteration=n}render(n){return`for(${this.iteration})`+super.render(n)}optimizeNames(n,c){if(super.optimizeNames(n,c))return this.iteration=ae(this.iteration,n,c),this}get names(){return X(super.names,this.iteration.names)}}class G extends U{constructor(n,c,u,p){super(),this.varKind=n,this.name=c,this.from=u,this.to=p}render(n){let c=n.es5?u.varKinds.var:this.varKind,{name:p,from:h,to:x}=this;return`for(${c} ${p}=${h}; ${p}<${x}; ${p}++)`+super.render(n)}get names(){return ie(ie(super.names,this.from),this.to)}}class K extends U{constructor(n,c,u,p){super(),this.loop=n,this.varKind=c,this.name=u,this.iterable=p}render(n){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(n)}optimizeNames(n,c){if(super.optimizeNames(n,c))return this.iterable=ae(this.iterable,n,c),this}get names(){return X(super.names,this.iterable.names)}}class ee extends z{constructor(n,c,u){super(),this.name=n,this.args=c,this.async=u}render(n){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(n)}}ee.kind=`func`;class te extends L{render(n){return`return `+super.render(n)}}te.kind=`return`;class J extends z{render(n){let c=`try`+super.render(n);return this.catch&&(c+=this.catch.render(n)),this.finally&&(c+=this.finally.render(n)),c}optimizeNodes(){var n,c;return super.optimizeNodes(),(n=this.catch)==null||n.optimizeNodes(),(c=this.finally)==null||c.optimizeNodes(),this}optimizeNames(n,c){var u,p;return super.optimizeNames(n,c),(u=this.catch)==null||u.optimizeNames(n,c),(p=this.finally)==null||p.optimizeNames(n,c),this}get names(){let n=super.names;return this.catch&&X(n,this.catch.names),this.finally&&X(n,this.finally.names),n}}class Y extends z{constructor(n){super(),this.error=n}render(n){return`catch(${this.error})`+super.render(n)}}Y.kind=`catch`;class ne extends z{render(n){return`finally`+super.render(n)}}ne.kind=`finally`;class re{constructor(n,c={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...c,_n:c.lines?`
|
|
77
|
+
`,n)}function G(n){return K(` `,n)}function K(n,c){let u=``;for(let p=0;p<c;p++)u+=n;return u}let ee=[u.TokenKind.FLOAT,u.TokenKind.STRING,u.TokenKind.INT,u.TokenKind.BLOCK_STRING];function te(n,c=!1,p,h){let x=``;if(n?.startToken){let w=typeof p==`number`?p:n.start,T=typeof h==`number`?h:n.end,O=n.startToken.next,A=1;for(;O;){if(O.start<w){O=O.next,A=O?.line;continue}if(O.end>T){O=O.next,A=O?.line;continue}let n=O.value||O.kind,p=``;!c&&ee.indexOf(O.kind)>=0&&(n=`*`),O.kind===u.TokenKind.STRING&&(n=`"${n}"`),O.kind===u.TokenKind.EOF&&(n=``),O.line>A?(x+=W(O.line-A),A=O.line,p=G(O.column-1)):O.line===O.prev?.line&&(p=G(O.start-(O.prev?.end||0))),x+=p+n,O&&=O.next}}return x}n.getSourceFromLocation=te;function J(n,c,u){if(!n||n[h.OTEL_PATCHED_SYMBOL])return;let p=n.getFields();n[h.OTEL_PATCHED_SYMBOL]=!0,Object.keys(p).forEach(n=>{let h=p[n];if(h&&(h.resolve&&=ae(c,u,h.resolve),h.type)){let n=Y(h.type);for(let p of n)J(p,c,u)}})}n.wrapFields=J;function Y(n){return`ofType`in n?Y(n.ofType):ne(n)?n.getTypes():re(n)?[n]:[]}function ne(n){return`getTypes`in n&&typeof n.getTypes==`function`}function re(n){return`getFields`in n&&typeof n.getFields==`function`}let X=(n,u,p)=>{p&&(n.recordException(u),n.setStatus({code:c.SpanStatusCode.ERROR,message:u.message}),n.end())},ie=(n,c)=>{c&&n.end()};function ae(u,p,x,T=!1){if(O[h.OTEL_PATCHED_SYMBOL]||typeof x!=`function`)return x;function O(O,A,N,I){if(!x)return;let L=p();if(L.ignoreTrivialResolveSpans&&T&&(w(O)||typeof O==`function`)&&typeof O[I.fieldName]!=`function`||!N[h.OTEL_GRAPHQL_DATA_SYMBOL])return x.call(this,O,A,N,I);let z=U(L.mergeItems,I&&I.path),B=z.filter(n=>typeof n==`string`).length,H,W=!1;if(L.depth>=0&&L.depth<B)H=V(N,z);else{let{field:n,spanAdded:c}=j(u,p,N,I,z);H=n.span,W=c}return c.context.with(c.trace.setSpan(c.context.active(),H),()=>{try{let c=x.call(this,O,A,N,I);return(0,n.isPromise)(c)?c.then(n=>(ie(H,W),n),n=>{throw X(H,n,W),n}):(ie(H,W),c)}catch(n){throw X(H,n,W),n}})}return O[h.OTEL_PATCHED_SYMBOL]=!0,O}n.wrapFieldResolver=ae})),require_version$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.62.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-graphql`})),require_instrumentation$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GraphQLInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_enum(),h=require_AttributeNames$5(),x=require_symbols(),w=require_internal_types$7(),T=require_utils$32(),O=require_version$25(),A={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},j=[`>=14.0.0 <17`];n.GraphQLInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(O.PACKAGE_NAME,O.PACKAGE_VERSION,{...A,...n})}setConfig(n={}){super.setConfig({...A,...n})}init(){let n=new u.InstrumentationNodeModuleDefinition(`graphql`,j);return n.files.push(this._addPatchingExecute()),n.files.push(this._addPatchingParser()),n.files.push(this._addPatchingValidate()),n}_addPatchingExecute(){return new u.InstrumentationNodeModuleFile(`graphql/execution/execute.js`,j,n=>((0,u.isWrapped)(n.execute)&&this._unwrap(n,`execute`),this._wrap(n,`execute`,this._patchExecute(n.defaultFieldResolver)),n),n=>{n&&this._unwrap(n,`execute`)})}_addPatchingParser(){return new u.InstrumentationNodeModuleFile(`graphql/language/parser.js`,j,n=>((0,u.isWrapped)(n.parse)&&this._unwrap(n,`parse`),this._wrap(n,`parse`,this._patchParse()),n),n=>{n&&this._unwrap(n,`parse`)})}_addPatchingValidate(){return new u.InstrumentationNodeModuleFile(`graphql/validation/validate.js`,j,n=>((0,u.isWrapped)(n.validate)&&this._unwrap(n,`validate`),this._wrap(n,`validate`,this._patchValidate()),n),n=>{n&&this._unwrap(n,`validate`)})}_patchExecute(n){let p=this;return function(h){return function(){let w;if(arguments.length>=2){let c=arguments;w=p._wrapExecuteArgs(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],n)}else{let c=arguments[0];w=p._wrapExecuteArgs(c.schema,c.document,c.rootValue,c.contextValue,c.variableValues,c.operationName,c.fieldResolver,c.typeResolver,n)}let O=(0,T.getOperation)(w.document,w.operationName),A=p._createExecuteSpan(O,w);return w.contextValue[x.OTEL_GRAPHQL_DATA_SYMBOL]={source:w.document?w.document||w.document[x.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:A,fields:{}},c.context.with(c.trace.setSpan(c.context.active(),A),()=>(0,u.safeExecuteInTheMiddle)(()=>h.apply(this,[w]),(n,c)=>{p._handleExecutionResult(A,n,c)}))}}}_handleExecutionResult(n,c,u){let p=this.getConfig();if(u===void 0||c){(0,T.endSpan)(n,c);return}if((0,T.isPromise)(u))u.then(c=>{if(typeof p.responseHook!=`function`){(0,T.endSpan)(n);return}this._executeResponseHook(n,c)},c=>{(0,T.endSpan)(n,c)});else{if(typeof p.responseHook!=`function`){(0,T.endSpan)(n);return}this._executeResponseHook(n,u)}}_executeResponseHook(n,c){let{responseHook:p}=this.getConfig();p&&(0,u.safeExecuteInTheMiddle)(()=>{p(n,c)},c=>{c&&this._diag.error(`Error running response hook`,c),(0,T.endSpan)(n,void 0)},!0)}_patchParse(){let n=this;return function(c){return function(u,p){return n._parse(this,c,u,p)}}}_patchValidate(){let n=this;return function(c){return function(u,p,h,x,w){return n._validate(this,c,u,p,h,w,x)}}}_parse(n,h,x,w){let O=this.getConfig(),A=this.tracer.startSpan(p.SpanNames.PARSE);return c.context.with(c.trace.setSpan(c.context.active(),A),()=>(0,u.safeExecuteInTheMiddle)(()=>h.call(n,x,w),(n,c)=>{c&&((0,T.getOperation)(c)?c.loc&&(0,T.addSpanSource)(A,c.loc,O.allowValues):A.updateName(p.SpanNames.SCHEMA_PARSE)),(0,T.endSpan)(A,n)}))}_validate(n,x,w,O,A,j,N){let I=this.tracer.startSpan(p.SpanNames.VALIDATE,{});return c.context.with(c.trace.setSpan(c.context.active(),I),()=>(0,u.safeExecuteInTheMiddle)(()=>x.call(n,w,O,A,N,j),(n,c)=>{O.loc||I.updateName(p.SpanNames.SCHEMA_VALIDATE),c&&c.length&&I.recordException({name:h.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(c)}),(0,T.endSpan)(I,n)}))}_createExecuteSpan(n,c){let u=this.getConfig(),x=this.tracer.startSpan(p.SpanNames.EXECUTE,{});if(n){let{operation:c,name:u}=n;x.setAttribute(h.AttributeNames.OPERATION_TYPE,c);let p=u?.value;p?(x.setAttribute(h.AttributeNames.OPERATION_NAME,p),x.updateName(`${c} ${p}`)):x.updateName(c)}else{let n=` `;c.operationName&&(n=` "${c.operationName}" `),n=w.OPERATION_NOT_SUPPORTED.replace(`$operationName$`,n),x.setAttribute(h.AttributeNames.OPERATION_NAME,n)}return c.document?.loc&&(0,T.addSpanSource)(x,c.document.loc,u.allowValues),c.variableValues&&u.allowValues&&(0,T.addInputVariableAttributes)(x,c.variableValues),x}_wrapExecuteArgs(n,c,u,p,h,w,O,A,j){if(p||={},p[x.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:n,document:c,rootValue:u,contextValue:p,variableValues:h,operationName:w,fieldResolver:O,typeResolver:A};let N=O==null,I=O??j;return O=(0,T.wrapFieldResolver)(this.tracer,()=>this.getConfig(),I,N),n&&((0,T.wrapFields)(n.getQueryType(),this.tracer,()=>this.getConfig()),(0,T.wrapFields)(n.getMutationType(),this.tracer,()=>this.getConfig())),{schema:n,document:c,rootValue:u,contextValue:p,variableValues:h,operationName:w,fieldResolver:O,typeResolver:A}}}})),require_src$43=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GraphQLInstrumentation=void 0;var c=require_instrumentation$15();Object.defineProperty(n,`GraphQLInstrumentation`,{enumerable:!0,get:function(){return c.GraphQLInstrumentation}})}));init_esm$2();var import_src$30=require_src$43();const INTEGRATION_NAME$19=`Graphql`,instrumentGraphql=generateInstrumentOnce(INTEGRATION_NAME$19,import_src$30.GraphQLInstrumentation,n=>{let c=getOptionsWithDefaults(n);return{...c,responseHook(n,u){addOriginToSpan(n,`auto.graphql.otel.graphql`),u.errors?.length&&!spanToJSON(n).status&&n.setStatus({code:SpanStatusCode.ERROR});let p=spanToJSON(n).data,h=p[`graphql.operation.type`],x=p[`graphql.operation.name`];if(c.useOperationNameForRootSpan&&h){let c=getRootSpan(n),u=spanToJSON(c).data[`sentry.graphql.operation`]||[],p=x?`${h} ${x}`:`${h}`;Array.isArray(u)?(u.push(p),c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,u)):typeof u==`string`?c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,[u,p]):c.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION,p),spanToJSON(c).data[`original-description`]||c.setAttribute(`original-description`,spanToJSON(c).description),c.updateName(`${spanToJSON(c).data[`original-description`]} (${getGraphqlOperationNamesFromAttribute(u)})`)}}}}),_graphqlIntegration=((n={})=>({name:INTEGRATION_NAME$19,setupOnce(){instrumentGraphql(getOptionsWithDefaults(n))}})),graphqlIntegration=defineIntegration(_graphqlIntegration);function getOptionsWithDefaults(n){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...n}}function getGraphqlOperationNamesFromAttribute(n){if(Array.isArray(n)){let c=n.slice().sort();return c.length<=5?c.join(`, `):`${c.slice(0,5).join(`, `)}, +${c.length-5}`}return`${n}`}var require_internal_types$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EVENT_LISTENERS_SET=void 0,n.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.kafkajs.eventListenersSet`)})),require_propagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.bufferTextMapGetter=void 0,n.bufferTextMapGetter={get(n,c){if(!n)return;let u=Object.keys(n);for(let p of u)if(p===c||p.toLowerCase()===c)return n[p]?.toString()},keys(n){return n?Object.keys(n):[]}}})),require_semconv$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_MESSAGING_PROCESS_DURATION=n.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=n.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=n.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=n.MESSAGING_SYSTEM_VALUE_KAFKA=n.MESSAGING_OPERATION_TYPE_VALUE_SEND=n.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=n.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=n.ATTR_MESSAGING_SYSTEM=n.ATTR_MESSAGING_OPERATION_TYPE=n.ATTR_MESSAGING_OPERATION_NAME=n.ATTR_MESSAGING_KAFKA_OFFSET=n.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=n.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=n.ATTR_MESSAGING_DESTINATION_PARTITION_ID=n.ATTR_MESSAGING_DESTINATION_NAME=n.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0,n.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=`messaging.batch.message_count`,n.ATTR_MESSAGING_DESTINATION_NAME=`messaging.destination.name`,n.ATTR_MESSAGING_DESTINATION_PARTITION_ID=`messaging.destination.partition.id`,n.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=`messaging.kafka.message.key`,n.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=`messaging.kafka.message.tombstone`,n.ATTR_MESSAGING_KAFKA_OFFSET=`messaging.kafka.offset`,n.ATTR_MESSAGING_OPERATION_NAME=`messaging.operation.name`,n.ATTR_MESSAGING_OPERATION_TYPE=`messaging.operation.type`,n.ATTR_MESSAGING_SYSTEM=`messaging.system`,n.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=`process`,n.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=`receive`,n.MESSAGING_OPERATION_TYPE_VALUE_SEND=`send`,n.MESSAGING_SYSTEM_VALUE_KAFKA=`kafka`,n.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=`messaging.client.consumed.messages`,n.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=`messaging.client.operation.duration`,n.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=`messaging.client.sent.messages`,n.METRIC_MESSAGING_PROCESS_DURATION=`messaging.process.duration`})),require_version$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.23.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-kafkajs`})),require_instrumentation$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KafkaJsInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_internal_types$6(),x=require_propagator(),w=require_semconv$24(),T=require_version$24();function O(n,c,u){return h=>{n.add(c,{...u,...h?{[p.ATTR_ERROR_TYPE]:h}:{}})}}function A(n,c,u){return h=>{n.record((Date.now()-c)/1e3,{...u,...h?{[p.ATTR_ERROR_TYPE]:h}:{}})}}let j=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10];n.KafkaJsInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(w.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:j}}),this._sentMessages=this.meter.createCounter(w.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(w.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(w.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:j}})}init(){let n=n=>{(0,u.isWrapped)(n?.Kafka?.prototype.producer)&&this._unwrap(n.Kafka.prototype,`producer`),(0,u.isWrapped)(n?.Kafka?.prototype.consumer)&&this._unwrap(n.Kafka.prototype,`consumer`)};return new u.InstrumentationNodeModuleDefinition(`kafkajs`,[`>=0.3.0 <3`],c=>(n(c),this._wrap(c?.Kafka?.prototype,`producer`,this._getProducerPatch()),this._wrap(c?.Kafka?.prototype,`consumer`,this._getConsumerPatch()),c),n)}_getConsumerPatch(){let n=this;return c=>function(...p){let h=c.apply(this,p);return(0,u.isWrapped)(h.run)&&n._unwrap(h,`run`),n._wrap(h,`run`,n._getConsumerRunPatch()),n._setKafkaEventListeners(h),h}}_setKafkaEventListeners(n){n[h.EVENT_LISTENERS_SET]||(n.events?.REQUEST&&n.on(n.events.REQUEST,this._recordClientDurationMetric.bind(this)),n[h.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(n){let[c,u]=n.payload.broker.split(`:`);this._clientDuration.record(n.payload.duration/1e3,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`${n.payload.apiName}`,[p.ATTR_SERVER_ADDRESS]:c,[p.ATTR_SERVER_PORT]:Number.parseInt(u,10)})}_getProducerPatch(){let n=this;return c=>function(...p){let h=c.apply(this,p);return(0,u.isWrapped)(h.sendBatch)&&n._unwrap(h,`sendBatch`),n._wrap(h,`sendBatch`,n._getSendBatchPatch()),(0,u.isWrapped)(h.send)&&n._unwrap(h,`send`),n._wrap(h,`send`,n._getSendPatch()),(0,u.isWrapped)(h.transaction)&&n._unwrap(h,`transaction`),n._wrap(h,`transaction`,n._getProducerTransactionPatch()),n._setKafkaEventListeners(h),h}}_getConsumerRunPatch(){let n=this;return c=>function(...p){let h=p[0];return h?.eachMessage&&((0,u.isWrapped)(h.eachMessage)&&n._unwrap(h,`eachMessage`),n._wrap(h,`eachMessage`,n._getConsumerEachMessagePatch())),h?.eachBatch&&((0,u.isWrapped)(h.eachBatch)&&n._unwrap(h,`eachBatch`),n._wrap(h,`eachBatch`,n._getConsumerEachBatchPatch())),c.call(this,h)}}_getConsumerEachMessagePatch(){let n=this;return u=>function(...p){let h=p[0],T=c.propagation.extract(c.ROOT_CONTEXT,h.message.headers,x.bufferTextMapGetter),j=n._startConsumerSpan({topic:h.topic,message:h.message,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:T,attributes:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)}}),N=[A(n._processDuration,Date.now(),{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)}),O(n._consumedMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.partition)})],I=c.context.with(c.trace.setSpan(T,j),()=>u.apply(this,p));return n._endSpansOnPromise([j],N,I)}}_getConsumerEachBatchPatch(){return n=>{let u=this;return function(...p){let h=p[0],T=u._startConsumerSpan({topic:h.batch.topic,message:void 0,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:c.ROOT_CONTEXT,attributes:{[w.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:h.batch.messages.length,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}});return c.context.with(c.trace.setSpan(c.context.active(),T),()=>{let j=Date.now(),N=[],I=[O(u._consumedMessages,h.batch.messages.length,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.batch.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)})];h.batch.messages.forEach(n=>{let p=c.propagation.extract(c.ROOT_CONTEXT,n.headers,x.bufferTextMapGetter),T=c.trace.getSpan(p)?.spanContext(),O;T&&(O={context:T}),N.push(u._startConsumerSpan({topic:h.batch.topic,message:n,operationType:w.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:O,attributes:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}})),I.push(A(u._processDuration,j,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`process`,[w.ATTR_MESSAGING_DESTINATION_NAME]:h.batch.topic,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(h.batch.partition)}))});let L=n.apply(this,p);return N.unshift(T),u._endSpansOnPromise(N,I,L)})}}}_getProducerTransactionPatch(){let n=this;return u=>function(...p){let h=n.tracer.startSpan(`transaction`),x=u.apply(this,p);return x.then(u=>{let p=u.send;u.send=function(...u){return c.context.with(c.trace.setSpan(c.context.active(),h),()=>n._getSendPatch()(p).apply(this,u).catch(n=>{throw h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),n}))};let x=u.sendBatch;u.sendBatch=function(...u){return c.context.with(c.trace.setSpan(c.context.active(),h),()=>n._getSendBatchPatch()(x).apply(this,u).catch(n=>{throw h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),n}))};let w=u.commit;u.commit=function(...u){let p=w.apply(this,u).then(()=>{h.setStatus({code:c.SpanStatusCode.OK})});return n._endSpansOnPromise([h],[],p)};let T=u.abort;u.abort=function(...c){let u=T.apply(this,c);return n._endSpansOnPromise([h],[],u)}}).catch(n=>{h.setStatus({code:c.SpanStatusCode.ERROR,message:n?.message}),h.recordException(n),h.end()}),x}}_getSendBatchPatch(){let n=this;return c=>function(...u){let p=u[0].topicMessages||[],h=[],x=[];p.forEach(c=>{c.messages.forEach(u=>{h.push(n._startProducerSpan(c.topic,u)),x.push(O(n._sentMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_DESTINATION_NAME]:c.topic,...u.partition===void 0?{}:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(u.partition)}}))})});let T=c.apply(this,u);return n._endSpansOnPromise(h,x,T)}}_getSendPatch(){let n=this;return c=>function(...u){let p=u[0],h=p.messages.map(c=>n._startProducerSpan(p.topic,c)),x=p.messages.map(c=>O(n._sentMessages,1,{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...c.partition===void 0?{}:{[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(c.partition)}})),T=c.apply(this,u);return n._endSpansOnPromise(h,x,T)}}_endSpansOnPromise(n,u,h){return Promise.resolve(h).then(n=>(u.forEach(n=>n()),n)).catch(h=>{let x,w=p.ERROR_TYPE_VALUE_OTHER;throw typeof h==`string`||h===void 0?x=h:typeof h==`object`&&Object.prototype.hasOwnProperty.call(h,`message`)&&(x=h.message,w=h.constructor.name),u.forEach(n=>n(w)),n.forEach(n=>{n.setAttribute(p.ATTR_ERROR_TYPE,w),n.setStatus({code:c.SpanStatusCode.ERROR,message:x})}),h}).finally(()=>{n.forEach(n=>n.end())})}_startConsumerSpan({topic:n,message:p,operationType:h,ctx:x,link:T,attributes:O}){let A=h===w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?`poll`:h,j=this.tracer.startSpan(`${A} ${n}`,{kind:h===w.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?c.SpanKind.CLIENT:c.SpanKind.CONSUMER,attributes:{...O,[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_DESTINATION_NAME]:n,[w.ATTR_MESSAGING_OPERATION_TYPE]:h,[w.ATTR_MESSAGING_OPERATION_NAME]:A,[w.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:p?.key?String(p.key):void 0,[w.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:p?.key&&p.value===null?!0:void 0,[w.ATTR_MESSAGING_KAFKA_OFFSET]:p?.offset},links:T?[T]:[]},x),{consumerHook:N}=this.getConfig();return N&&p&&(0,u.safeExecuteInTheMiddle)(()=>N(j,{topic:n,message:p}),n=>{n&&this._diag.error(`consumerHook error`,n)},!0),j}_startProducerSpan(n,p){let h=this.tracer.startSpan(`send ${n}`,{kind:c.SpanKind.PRODUCER,attributes:{[w.ATTR_MESSAGING_SYSTEM]:w.MESSAGING_SYSTEM_VALUE_KAFKA,[w.ATTR_MESSAGING_DESTINATION_NAME]:n,[w.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:p.key?String(p.key):void 0,[w.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:p.key&&p.value===null?!0:void 0,[w.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:p.partition===void 0?void 0:String(p.partition),[w.ATTR_MESSAGING_OPERATION_NAME]:`send`,[w.ATTR_MESSAGING_OPERATION_TYPE]:w.MESSAGING_OPERATION_TYPE_VALUE_SEND}});p.headers=p.headers??{},c.propagation.inject(c.trace.setSpan(c.context.active(),h),p.headers);let{producerHook:x}=this.getConfig();return x&&(0,u.safeExecuteInTheMiddle)(()=>x(h,{topic:n,message:p}),n=>{n&&this._diag.error(`producerHook error`,n)},!0),h}}})),require_src$42=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KafkaJsInstrumentation=void 0;var c=require_instrumentation$14();Object.defineProperty(n,`KafkaJsInstrumentation`,{enumerable:!0,get:function(){return c.KafkaJsInstrumentation}})})),import_src$29=require_src$42();const INTEGRATION_NAME$18=`Kafka`,instrumentKafka=generateInstrumentOnce(INTEGRATION_NAME$18,()=>new import_src$29.KafkaJsInstrumentation({consumerHook(n){addOriginToSpan(n,`auto.kafkajs.otel.consumer`)},producerHook(n){addOriginToSpan(n,`auto.kafkajs.otel.producer`)}})),_kafkaIntegration=(()=>({name:INTEGRATION_NAME$18,setupOnce(){instrumentKafka()}})),kafkaIntegration=defineIntegration(_kafkaIntegration);var require_version$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.58.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-lru-memoizer`})),require_instrumentation$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LruMemoizerInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_version$23();n.LruMemoizerInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(p.PACKAGE_NAME,p.PACKAGE_VERSION,n)}init(){return[new u.InstrumentationNodeModuleDefinition(`lru-memoizer`,[`>=1.3 <4`],n=>{let u=function(){let u=n.apply(this,arguments);return function(){let n=[...arguments],p=n.pop(),h=typeof p==`function`?c.context.bind(c.context.active(),p):p;return n.push(h),u.apply(this,n)}};return u.sync=n.sync,u},void 0)]}}})),require_src$41=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LruMemoizerInstrumentation=void 0;var c=require_instrumentation$13();Object.defineProperty(n,`LruMemoizerInstrumentation`,{enumerable:!0,get:function(){return c.LruMemoizerInstrumentation}})})),import_src$28=require_src$41();const INTEGRATION_NAME$17=`LruMemoizer`,instrumentLruMemoizer=generateInstrumentOnce(INTEGRATION_NAME$17,()=>new import_src$28.LruMemoizerInstrumentation),_lruMemoizerIntegration=(()=>({name:INTEGRATION_NAME$17,setupOnce(){instrumentLruMemoizer()}})),lruMemoizerIntegration=defineIntegration(_lruMemoizerIntegration);var require_semconv$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=n.DB_SYSTEM_VALUE_MONGODB=n.DB_SYSTEM_NAME_VALUE_MONGODB=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_OPERATION=n.ATTR_DB_NAME=n.ATTR_DB_MONGODB_COLLECTION=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_OPERATION=`db.operation`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`,n.DB_SYSTEM_VALUE_MONGODB=`mongodb`,n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),require_internal_types$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=void 0,(function(n){n.CREATE_INDEXES=`createIndexes`,n.FIND_AND_MODIFY=`findAndModify`,n.IS_MASTER=`isMaster`,n.COUNT=`count`,n.AGGREGATE=`aggregate`,n.UNKNOWN=`unknown`})(n.MongodbCommandType||={})})),require_version$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.67.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mongodb`})),require_instrumentation$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongoDBInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$23(),x=require_internal_types$5(),w=require_version$22(),T={requireParentSpan:!0};n.MongoDBInstrumentation=class n extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,{...T,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...T,...n})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(h.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(n,c,u){this._connectionsUsage?.add(n,{"pool.name":c,state:u})}init(){let{v3PatchConnection:n,v3UnpatchConnection:c}=this._getV3ConnectionPatches(),{v4PatchConnect:p,v4UnpatchConnect:h}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:x,v4PatchConnectionPromise:w,v4UnpatchConnection:T}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:O,v4UnpatchConnectionPool:A}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:j,v4UnpatchSessions:N}=this._getV4SessionsPatches();return[new u.InstrumentationNodeModuleDefinition(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new u.InstrumentationNodeModuleFile(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],n,c)]),new u.InstrumentationNodeModuleDefinition(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],x,T),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],w,T),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],O,A),new u.InstrumentationNodeModuleFile(`mongodb/lib/cmap/connect.js`,[`>=4.0.0 <8`],p,h),new u.InstrumentationNodeModuleFile(`mongodb/lib/sessions.js`,[`>=4.0.0 <8`],j,N)])]}_getV3ConnectionPatches(){return{v3PatchConnection:n=>((0,u.isWrapped)(n.insert)&&this._unwrap(n,`insert`),this._wrap(n,`insert`,this._getV3PatchOperation(`insert`)),(0,u.isWrapped)(n.remove)&&this._unwrap(n,`remove`),this._wrap(n,`remove`,this._getV3PatchOperation(`remove`)),(0,u.isWrapped)(n.update)&&this._unwrap(n,`update`),this._wrap(n,`update`,this._getV3PatchOperation(`update`)),(0,u.isWrapped)(n.command)&&this._unwrap(n,`command`),this._wrap(n,`command`,this._getV3PatchCommand()),(0,u.isWrapped)(n.query)&&this._unwrap(n,`query`),this._wrap(n,`query`,this._getV3PatchFind()),(0,u.isWrapped)(n.getMore)&&this._unwrap(n,`getMore`),this._wrap(n,`getMore`,this._getV3PatchCursor()),n),v3UnpatchConnection:n=>{n!==void 0&&(this._unwrap(n,`insert`),this._unwrap(n,`remove`),this._unwrap(n,`update`),this._unwrap(n,`command`),this._unwrap(n,`query`),this._unwrap(n,`getMore`))}}}_getV4SessionsPatches(){return{v4PatchSessions:n=>((0,u.isWrapped)(n.acquire)&&this._unwrap(n,`acquire`),this._wrap(n.ServerSessionPool.prototype,`acquire`,this._getV4AcquireCommand()),(0,u.isWrapped)(n.release)&&this._unwrap(n,`release`),this._wrap(n.ServerSessionPool.prototype,`release`,this._getV4ReleaseCommand()),n),v4UnpatchSessions:n=>{n!==void 0&&((0,u.isWrapped)(n.acquire)&&this._unwrap(n,`acquire`),(0,u.isWrapped)(n.release)&&this._unwrap(n,`release`))}}}_getV4AcquireCommand(){let n=this;return c=>function(){let u=this.sessions.length,p=c.call(this),h=this.sessions.length;return u===h?n._connCountAdd(1,n._poolName,`used`):u-1===h&&(n._connCountAdd(-1,n._poolName,`idle`),n._connCountAdd(1,n._poolName,`used`)),p}}_getV4ReleaseCommand(){let n=this;return c=>function(u){let p=c.call(this,u);return n._connCountAdd(-1,n._poolName,`used`),n._connCountAdd(1,n._poolName,`idle`),p}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:n=>{let c=n.ConnectionPool.prototype;return(0,u.isWrapped)(c.checkOut)&&this._unwrap(c,`checkOut`),this._wrap(c,`checkOut`,this._getV4ConnectionPoolCheckOut()),n},v4UnpatchConnectionPool:n=>{n!==void 0&&this._unwrap(n.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectPatches(){return{v4PatchConnect:n=>((0,u.isWrapped)(n.connect)&&this._unwrap(n,`connect`),this._wrap(n,`connect`,this._getV4ConnectCommand()),n),v4UnpatchConnect:n=>{n!==void 0&&this._unwrap(n,`connect`)}}}_getV4ConnectionPoolCheckOut(){return n=>function(u){let p=c.context.bind(c.context.active(),u);return n.call(this,p)}}_getV4ConnectCommand(){let n=this;return c=>function(u,p){if(c.length===1){let p=c.call(this,u);return p&&typeof p.then==`function`&&p.then(()=>n.setPoolName(u),()=>void 0),p}return c.call(this,u,function(c,h){if(c||!h){p(c,h);return}n.setPoolName(u),p(c,h)})}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:n=>((0,u.isWrapped)(n.Connection.prototype.command)&&this._unwrap(n.Connection.prototype,`command`),this._wrap(n.Connection.prototype,`command`,this._getV4PatchCommandCallback()),n),v4PatchConnectionPromise:n=>((0,u.isWrapped)(n.Connection.prototype.command)&&this._unwrap(n.Connection.prototype,`command`),this._wrap(n.Connection.prototype,`command`,this._getV4PatchCommandPromise()),n),v4UnpatchConnection:n=>{n!==void 0&&this._unwrap(n.Connection.prototype,`command`)}}}_getV3PatchOperation(n){let u=this;return p=>function(h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=u._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`||typeof w!=`object`)return typeof T==`function`?p.call(this,h,x,w,T):p.call(this,h,x,w,T,O);let I=u._getV3SpanAttributes(x,h,w[0],n),L=u._spanNameFromAttrs(I),z=u.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=u._patchEnd(z,N);return typeof T==`function`?p.call(this,h,x,w,B):p.call(this,h,x,w,T,B)}}_getV3PatchCommand(){let u=this;return p=>function(h,w,T,O,A){let j=c.trace.getSpan(c.context.active()),N=u._checkSkipInstrumentation(j),I=typeof O==`function`?O:A;if(N||typeof I!=`function`||typeof T!=`object`)return typeof O==`function`?p.call(this,h,w,T,O):p.call(this,h,w,T,O,A);let L=n._getCommandType(T),z=L===x.MongodbCommandType.UNKNOWN?void 0:L,B=u._getV3SpanAttributes(w,h,T,z),V=u._spanNameFromAttrs(B),H=u.tracer.startSpan(V,{kind:c.SpanKind.CLIENT,attributes:B}),U=u._patchEnd(H,I);return typeof O==`function`?p.call(this,h,w,T,U):p.call(this,h,w,T,O,U)}}_getV4PatchCommandCallback(){let n=this;return u=>function(p,h,x,w){let T=c.trace.getSpan(c.context.active()),O=n._checkSkipInstrumentation(T),A=w,j=Object.keys(h)[0];if(typeof h!=`object`||h.ismaster||h.hello)return u.call(this,p,h,x,w);let N;if(!O){let u=n._getV4SpanAttributes(this,p,h,j),x=n._spanNameFromAttrs(u);N=n.tracer.startSpan(x,{kind:c.SpanKind.CLIENT,attributes:u})}let I=n._patchEnd(N,A,this.id,j);return u.call(this,p,h,x,I)}}_getV4PatchCommandPromise(){let n=this;return u=>function(...p){let[h,x]=p,w=c.trace.getSpan(c.context.active()),T=n._checkSkipInstrumentation(w),O=Object.keys(x)[0],A=()=>void 0;if(typeof x!=`object`||x.ismaster||x.hello)return u.apply(this,p);let j;if(!T){let u=n._getV4SpanAttributes(this,h,x,O),p=n._spanNameFromAttrs(u);j=n.tracer.startSpan(p,{kind:c.SpanKind.CLIENT,attributes:u})}let N=n._patchEnd(j,A,this.id,O),I=u.apply(this,p);return I.then(n=>N(null,n),n=>N(n)),I}}_getV3PatchFind(){let n=this;return u=>function(p,h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=n._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`||typeof x!=`object`)return typeof T==`function`?u.call(this,p,h,x,w,T):u.call(this,p,h,x,w,T,O);let I=n._getV3SpanAttributes(h,p,x,`find`),L=n._spanNameFromAttrs(I),z=n.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=n._patchEnd(z,N);return typeof T==`function`?u.call(this,p,h,x,w,B):u.call(this,p,h,x,w,T,B)}}_getV3PatchCursor(){let n=this;return u=>function(p,h,x,w,T,O){let A=c.trace.getSpan(c.context.active()),j=n._checkSkipInstrumentation(A),N=typeof T==`function`?T:O;if(j||typeof N!=`function`)return typeof T==`function`?u.call(this,p,h,x,w,T):u.call(this,p,h,x,w,T,O);let I=n._getV3SpanAttributes(h,p,x.cmd,`getMore`),L=n._spanNameFromAttrs(I),z=n.tracer.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I}),B=n._patchEnd(z,N);return typeof T==`function`?u.call(this,p,h,x,w,B):u.call(this,p,h,x,w,T,B)}}static _getCommandType(n){return n.createIndexes===void 0?n.findandmodify===void 0?n.ismaster===void 0?n.count===void 0?n.aggregate===void 0?x.MongodbCommandType.UNKNOWN:x.MongodbCommandType.AGGREGATE:x.MongodbCommandType.COUNT:x.MongodbCommandType.IS_MASTER:x.MongodbCommandType.FIND_AND_MODIFY:x.MongodbCommandType.CREATE_INDEXES}_getV4SpanAttributes(n,c,u,p){let h,x;if(n){let c=typeof n.address==`string`?n.address.split(`:`):``;c.length===2&&(h=c[0],x=c[1])}let w;return w=u?.documents&&u.documents[0]?u.documents[0]:u?.cursors?u.cursors:u,this._getSpanAttributes(c.db,c.collection,h,x,w,p)}_getV3SpanAttributes(n,c,u,p){let h,x;if(c&&c.s&&(h=c.s.options?.host??c.s.host,x=(c.s.options?.port??c.s.port)?.toString(),h==null||x==null)){let n=c.description?.address;if(n){let c=n.split(`:`);h=c[0],x=c[1]}}let[w,T]=n.toString().split(`.`),O=u?.query??u?.q??u;return this._getSpanAttributes(w,T,h,x,O,p)}_getSpanAttributes(n,c,x,w,T,O){let A={};if(this._dbSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_DB_SYSTEM]=h.DB_SYSTEM_VALUE_MONGODB,A[h.ATTR_DB_NAME]=n,A[h.ATTR_DB_MONGODB_COLLECTION]=c,A[h.ATTR_DB_OPERATION]=O,A[h.ATTR_DB_CONNECTION_STRING]=`mongodb://${x}:${w}/${n}`),this._dbSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_DB_SYSTEM_NAME]=h.DB_SYSTEM_NAME_VALUE_MONGODB,A[p.ATTR_DB_NAMESPACE]=n,A[p.ATTR_DB_OPERATION_NAME]=O,A[p.ATTR_DB_COLLECTION_NAME]=c),x&&w){this._netSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_NET_PEER_NAME]=x),this._netSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_SERVER_ADDRESS]=x);let n=parseInt(w,10);isNaN(n)||(this._netSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_NET_PEER_PORT]=n),this._netSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_SERVER_PORT]=n))}if(T){let{dbStatementSerializer:n}=this.getConfig(),c=typeof n==`function`?n:this._defaultDbStatementSerializer.bind(this);(0,u.safeExecuteInTheMiddle)(()=>{let n=c(T);this._dbSemconvStability&u.SemconvStability.OLD&&(A[h.ATTR_DB_STATEMENT]=n),this._dbSemconvStability&u.SemconvStability.STABLE&&(A[p.ATTR_DB_QUERY_TEXT]=n)},n=>{n&&this._diag.error(`Error running dbStatementSerializer hook`,n)},!0)}return A}_spanNameFromAttrs(n){let c;return c=this._dbSemconvStability&u.SemconvStability.STABLE?[n[p.ATTR_DB_OPERATION_NAME],n[p.ATTR_DB_COLLECTION_NAME]].filter(n=>n).join(` `)||h.DB_SYSTEM_NAME_VALUE_MONGODB:`mongodb.${n[h.ATTR_DB_OPERATION]||`command`}`,c}_getDefaultDbStatementReplacer(){let n=new WeakSet;return(c,u)=>typeof u!=`object`||!u?`?`:n.has(u)?`[Circular]`:(n.add(u),u)}_defaultDbStatementSerializer(n){let{enhancedDatabaseReporting:c}=this.getConfig();return c?JSON.stringify(n):JSON.stringify(n,this._getDefaultDbStatementReplacer())}_handleExecutionResult(n,c){let{responseHook:p}=this.getConfig();typeof p==`function`&&(0,u.safeExecuteInTheMiddle)(()=>{p(n,{data:c})},n=>{n&&this._diag.error(`Error running response hook`,n)},!0)}_patchEnd(n,u,p,h){let x=c.context.active(),w=this,T=!1;return function(...p){if(!T){T=!0;let u=p[0];if(n){if(u instanceof Error)n.setStatus({code:c.SpanStatusCode.ERROR,message:u.message});else{let c=p[1];w._handleExecutionResult(n,c)}n.end()}h===`endSessions`&&w._connCountAdd(-1,w._poolName,`idle`)}return c.context.with(x,()=>u.apply(this,p))}}setPoolName(n){let c=`mongodb://${n.hostAddress?.host}:${n.hostAddress?.port}/${n.dbName}`;this._poolName=c}_checkSkipInstrumentation(n){return this.getConfig().requireParentSpan===!0&&n===void 0}}})),require_types$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=void 0,(function(n){n.CREATE_INDEXES=`createIndexes`,n.FIND_AND_MODIFY=`findAndModify`,n.IS_MASTER=`isMaster`,n.COUNT=`count`,n.UNKNOWN=`unknown`})(n.MongodbCommandType||={})})),require_src$40=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongodbCommandType=n.MongoDBInstrumentation=void 0;var c=require_instrumentation$12();Object.defineProperty(n,`MongoDBInstrumentation`,{enumerable:!0,get:function(){return c.MongoDBInstrumentation}});var u=require_types$6();Object.defineProperty(n,`MongodbCommandType`,{enumerable:!0,get:function(){return u.MongodbCommandType}})})),import_src$27=require_src$40();const INTEGRATION_NAME$16=`Mongo`,instrumentMongo=generateInstrumentOnce(INTEGRATION_NAME$16,()=>new import_src$27.MongoDBInstrumentation({dbStatementSerializer:_defaultDbStatementSerializer,responseHook(n){addOriginToSpan(n,`auto.db.otel.mongo`)}}));function _defaultDbStatementSerializer(n){let c=_scrubStatement(n);return JSON.stringify(c)}function _scrubStatement(n){return Array.isArray(n)?n.map(n=>_scrubStatement(n)):isCommandObj(n)?Object.entries(n).map(([n,c])=>[n,_scrubStatement(c)]).reduce((n,c)=>(isCommandEntry(c)&&(n[c[0]]=c[1]),n),{}):`?`}function isCommandObj(n){return typeof n==`object`&&!!n&&!isBuffer(n)}function isBuffer(n){let c=!1;return typeof Buffer<`u`&&(c=Buffer.isBuffer(n)),c}function isCommandEntry(n){return Array.isArray(n)}const _mongoIntegration=(()=>({name:INTEGRATION_NAME$16,setupOnce(){instrumentMongo()}})),mongoIntegration=defineIntegration(_mongoIntegration);var require_suppress_tracing$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$31=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$9();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8(),p=require_constants$9(),h=require_utils$31();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$8().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$21(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$22();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$8();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$9();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$8();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$22();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$22(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$8(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8(),p=require_TraceState$8();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$8(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$8();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$8();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$39=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$8();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$8();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$8();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$8();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$8();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$8();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$8();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$8();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$31();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$22();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$8();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$8();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$8();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$8();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$8();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$8();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$8();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$8();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$8();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$8();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$8()._export}})),require_semconv$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_NAME_VALUE_MONGODB=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_OPERATION=n.ATTR_DB_NAME=n.ATTR_DB_MONGODB_COLLECTION=void 0,n.ATTR_DB_MONGODB_COLLECTION=`db.mongodb.collection`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_OPERATION=`db.operation`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_NAME_VALUE_MONGODB=`mongodb`})),require_utils$30=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.handleCallbackResponse=n.handlePromiseResponse=n.getAttributesFromCollection=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_semconv$21(),h=(init_esm$1(),__toCommonJS(esm_exports$1));function x(n,c,x){let w={};return c&u.SemconvStability.OLD&&(w[p.ATTR_DB_MONGODB_COLLECTION]=n.name,w[p.ATTR_DB_NAME]=n.conn.name,w[p.ATTR_DB_USER]=n.conn.user),c&u.SemconvStability.STABLE&&(w[h.ATTR_DB_COLLECTION_NAME]=n.name,w[h.ATTR_DB_NAMESPACE]=n.conn.name),x&u.SemconvStability.OLD&&(w[p.ATTR_NET_PEER_NAME]=n.conn.host,w[p.ATTR_NET_PEER_PORT]=n.conn.port),x&u.SemconvStability.STABLE&&(w[h.ATTR_SERVER_ADDRESS]=n.conn.host,w[h.ATTR_SERVER_PORT]=n.conn.port),w}n.getAttributesFromCollection=x;function w(n,u={}){n.recordException(u),n.setStatus({code:c.SpanStatusCode.ERROR,message:`${u.message} ${u.code?`\nMongoose Error Code: ${u.code}`:``}`})}function T(n,p,h,x=void 0){h&&(0,u.safeExecuteInTheMiddle)(()=>h(n,{moduleVersion:x,response:p}),n=>{n&&c.diag.error(`mongoose instrumentation: responseHook error`,n)},!0)}function O(n,c,u,p=void 0){return n instanceof Promise?n.then(n=>(T(c,n,u,p),n)).catch(n=>{throw w(c,n),n}).finally(()=>c.end()):(T(c,n,u,p),c.end(),n)}n.handlePromiseResponse=O;function A(n,c,u,p,h,x,O=void 0){let A=0;return h.length===2?A=1:h.length===3&&(A=2),h[A]=(c,u)=>(c?w(p,c):T(p,u,x,O),p.end(),n(c,u)),c.apply(u,h)}n.handleCallbackResponse=A})),require_version$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mongoose`})),require_mongoose=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongooseInstrumentation=n._ALREADY_INSTRUMENTED=n._STORED_PARENT_SPAN=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$39(),p=require_utils$30(),h=require_src$52(),x=require_version$20(),w=require_semconv$21(),T=(init_esm$1(),__toCommonJS(esm_exports$1)),O=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],A=[`remove`,`count`,`findOneAndRemove`,...O],j=[`count`,`findOneAndRemove`,...O],N=[...O];function I(n){return n?n.startsWith(`6.`)||n.startsWith(`5.`)?A:n.startsWith(`7.`)?j:N:O}function L(n){return n&&(n.startsWith(`5.`)||n.startsWith(`6.`))||!1}function z(n){return!n||!n.startsWith(`8.`)?!1:parseInt(n.split(`.`)[1],10)>=21}n._STORED_PARENT_SPAN=Symbol(`stored-parent-span`),n._ALREADY_INSTRUMENTED=Symbol(`already-instrumented`),n.MongooseInstrumentation=class extends h.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(x.PACKAGE_NAME,x.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,h.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,h.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new h.InstrumentationNodeModuleDefinition(`mongoose`,[`>=5.9.7 <10`],this.patch.bind(this),this.unpatch.bind(this))}patch(n,c){let u=n[Symbol.toStringTag]===`Module`?n.default:n;return this._wrap(u.Model.prototype,`save`,this.patchOnModelMethods(`save`,c)),u.Model.prototype.$save=u.Model.prototype.save,L(c)&&this._wrap(u.Model.prototype,`remove`,this.patchOnModelMethods(`remove`,c)),z(c)&&(this._wrap(u.Model.prototype,`updateOne`,this._patchDocumentUpdateMethods(`updateOne`,c)),this._wrap(u.Model.prototype,`deleteOne`,this._patchDocumentUpdateMethods(`deleteOne`,c))),this._wrap(u.Query.prototype,`exec`,this.patchQueryExec(c)),this._wrap(u.Aggregate.prototype,`exec`,this.patchAggregateExec(c)),I(c).forEach(n=>{this._wrap(u.Query.prototype,n,this.patchAndCaptureSpanContext(n))}),this._wrap(u.Model,`aggregate`,this.patchModelAggregate()),this._wrap(u.Model,`insertMany`,this.patchModelStatic(`insertMany`,c)),this._wrap(u.Model,`bulkWrite`,this.patchModelStatic(`bulkWrite`,c)),u}unpatch(n,c){let u=n[Symbol.toStringTag]===`Module`?n.default:n,p=I(c);this._unwrap(u.Model.prototype,`save`),u.Model.prototype.$save=u.Model.prototype.save,L(c)&&this._unwrap(u.Model.prototype,`remove`),z(c)&&(this._unwrap(u.Model.prototype,`updateOne`),this._unwrap(u.Model.prototype,`deleteOne`)),this._unwrap(u.Query.prototype,`exec`),this._unwrap(u.Aggregate.prototype,`exec`),p.forEach(n=>{this._unwrap(u.Query.prototype,n)}),this._unwrap(u.Model,`aggregate`),this._unwrap(u.Model,`insertMany`),this._unwrap(u.Model,`bulkWrite`)}patchAggregateExec(u){let p=this;return x=>function(O){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let A=this[n._STORED_PARENT_SPAN],j={},{dbStatementSerializer:N}=p.getConfig();if(N){let n=N(`aggregate`,{options:this.options,aggregatePipeline:this._pipeline});p._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_STATEMENT]=n),p._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_QUERY_TEXT]=n)}let I=p._startSpan(this._model.collection,this._model?.modelName,`aggregate`,j,A);return p._handleResponse(I,x,this,arguments,O,u)}}patchQueryExec(u){let p=this;return x=>function(O){if(this[n._ALREADY_INSTRUMENTED]||p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let A=this[n._STORED_PARENT_SPAN],j={},{dbStatementSerializer:N}=p.getConfig();if(N){let n=N(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});p._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_STATEMENT]=n),p._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_QUERY_TEXT]=n)}let I=p._startSpan(this.mongooseCollection,this.model.modelName,this.op,j,A);return p._handleResponse(I,x,this,arguments,O,u)}}patchOnModelMethods(n,u){let p=this;return x=>function(O,A){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);let j={document:this};O&&!(O instanceof Function)&&(j.options=O);let N={},{dbStatementSerializer:I}=p.getConfig();if(I){let c=I(n,j);p._dbSemconvStability&h.SemconvStability.OLD&&(N[w.ATTR_DB_STATEMENT]=c),p._dbSemconvStability&h.SemconvStability.STABLE&&(N[T.ATTR_DB_QUERY_TEXT]=c)}let L=p._startSpan(this.constructor.collection,this.constructor.modelName,n,N);return O instanceof Function&&(A=O,O=void 0),p._handleResponse(L,x,this,arguments,A,u)}}_patchDocumentUpdateMethods(u,p){let x=this;return O=>function(A,j,N){if(x.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return O.apply(this,arguments);let I=N,L=A,z=j;typeof A==`function`?(I=A,L=void 0,z=void 0):typeof j==`function`&&(I=j,z=void 0);let B={},V=x.getConfig().dbStatementSerializer;if(V){let n=V(u,{condition:{_id:this._id},updates:L,options:z});x._dbSemconvStability&h.SemconvStability.OLD&&(B[w.ATTR_DB_STATEMENT]=n),x._dbSemconvStability&h.SemconvStability.STABLE&&(B[T.ATTR_DB_QUERY_TEXT]=n)}let H=x._startSpan(this.constructor.collection,this.constructor.modelName,u,B),U=x._handleResponse(H,O,this,arguments,I,p);return U&&typeof U==`object`&&(U[n._ALREADY_INSTRUMENTED]=!0),U}}patchModelStatic(n,u){let p=this;return x=>function(O,A,j){if(p.getConfig().requireParentSpan&&c.trace.getSpan(c.context.active())===void 0)return x.apply(this,arguments);typeof A==`function`&&(j=A,A=void 0);let N={};switch(n){case`insertMany`:N.documents=O;break;case`bulkWrite`:N.operations=O;break;default:N.document=O;break}A!==void 0&&(N.options=A);let I={},{dbStatementSerializer:L}=p.getConfig();if(L){let c=L(n,N);p._dbSemconvStability&h.SemconvStability.OLD&&(I[w.ATTR_DB_STATEMENT]=c),p._dbSemconvStability&h.SemconvStability.STABLE&&(I[T.ATTR_DB_QUERY_TEXT]=c)}let z=p._startSpan(this.collection,this.modelName,n,I);return p._handleResponse(z,x,this,arguments,j,u)}}patchModelAggregate(){let u=this;return p=>function(){let h=c.trace.getSpan(c.context.active()),x=u._callOriginalFunction(()=>p.apply(this,arguments));return x&&(x[n._STORED_PARENT_SPAN]=h),x}}patchAndCaptureSpanContext(u){let p=this;return u=>function(){return this[n._STORED_PARENT_SPAN]=c.trace.getSpan(c.context.active()),p._callOriginalFunction(()=>u.apply(this,arguments))}}_startSpan(n,u,x,O,A){let j={...O,...(0,p.getAttributesFromCollection)(n,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&h.SemconvStability.OLD&&(j[w.ATTR_DB_OPERATION]=x,j[w.ATTR_DB_SYSTEM]=`mongoose`),this._dbSemconvStability&h.SemconvStability.STABLE&&(j[T.ATTR_DB_OPERATION_NAME]=x,j[T.ATTR_DB_SYSTEM_NAME]=w.DB_SYSTEM_NAME_VALUE_MONGODB);let N=this._dbSemconvStability&h.SemconvStability.STABLE?`${x} ${n.name}`:`mongoose.${u}.${x}`;return this.tracer.startSpan(N,{kind:c.SpanKind.CLIENT,attributes:j},A?c.trace.setSpan(c.context.active(),A):void 0)}_handleResponse(n,c,u,h,x,w=void 0){let T=this;if(x instanceof Function)return T._callOriginalFunction(()=>(0,p.handleCallbackResponse)(x,c,u,n,h,T.getConfig().responseHook,w));{let x=T._callOriginalFunction(()=>c.apply(u,h));return(0,p.handlePromiseResponse)(x,n,T.getConfig().responseHook,w)}}_callOriginalFunction(n){return this.getConfig().suppressInternalInstrumentation?c.context.with((0,u.suppressTracing)(c.context.active()),n):n()}}})),require_src$38=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MongooseInstrumentation=void 0;var c=require_mongoose();Object.defineProperty(n,`MongooseInstrumentation`,{enumerable:!0,get:function(){return c.MongooseInstrumentation}})})),import_src$26=require_src$38();const INTEGRATION_NAME$15=`Mongoose`,instrumentMongoose=generateInstrumentOnce(INTEGRATION_NAME$15,()=>new import_src$26.MongooseInstrumentation({responseHook(n){addOriginToSpan(n,`auto.db.otel.mongoose`)}})),_mongooseIntegration=(()=>({name:INTEGRATION_NAME$15,setupOnce(){instrumentMongoose()}})),mongooseIntegration=defineIntegration(_mongooseIntegration);var require_semconv$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=n.DB_SYSTEM_VALUE_MYSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MYSQL=`mysql`,n.METRIC_DB_CLIENT_CONNECTIONS_USAGE=`db.client.connections.usage`})),require_AttributeNames$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.MYSQL_VALUES=`db.mysql.values`})(n.AttributeNames||={})})),require_utils$29=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getPoolNameOld=n.arrayStringifyHelper=n.getSpanName=n.getDbValues=n.getDbQueryText=n.getJDBCString=n.getConfig=void 0;function c(n){let{host:c,port:u,database:p,user:h}=n&&n.connectionConfig||n||{};return{host:c,port:u,database:p,user:h}}n.getConfig=c;function u(n,c,u){let p=`jdbc:mysql://${n||`localhost`}`;return typeof c==`number`&&(p+=`:${c}`),typeof u==`string`&&(p+=`/${u}`),p}n.getJDBCString=u;function p(n){return typeof n==`string`?n:n.sql}n.getDbQueryText=p;function h(n,c){return w(typeof n==`string`?c:c||n.values)}n.getDbValues=h;function x(n){let c=typeof n==`object`?n.sql:n,u=c?.indexOf(` `);return typeof u==`number`&&u!==-1?c?.substring(0,u):c}n.getSpanName=x;function w(n){return n?`[${n.toString()}]`:``}n.arrayStringifyHelper=w;function T(n){let c=n.config.connectionConfig,u=``;return u+=c.host?`host: '${c.host}', `:``,u+=c.port?`port: ${c.port}, `:``,u+=c.database?`database: '${c.database}', `:``,u+=c.user?`user: '${c.user}'`:``,c.user||(u=u.substring(0,u.length-2)),u.trim()}n.getPoolNameOld=T})),require_version$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql`})),require_instrumentation$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQLInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$20(),x=require_AttributeNames$4(),w=require_utils$29(),T=require_version$19();n.MySQLInstrumentation=class extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(h.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`})}_connCountAdd(n,c,u){this._connectionsUsageOld?.add(n,{state:u,name:c})}init(){return[new u.InstrumentationNodeModuleDefinition(`mysql`,[`>=2.0.0 <3`],n=>((0,u.isWrapped)(n.createConnection)&&this._unwrap(n,`createConnection`),this._wrap(n,`createConnection`,this._patchCreateConnection()),(0,u.isWrapped)(n.createPool)&&this._unwrap(n,`createPool`),this._wrap(n,`createPool`,this._patchCreatePool()),(0,u.isWrapped)(n.createPoolCluster)&&this._unwrap(n,`createPoolCluster`),this._wrap(n,`createPoolCluster`,this._patchCreatePoolCluster()),n),n=>{n!==void 0&&(this._unwrap(n,`createConnection`),this._unwrap(n,`createPool`),this._unwrap(n,`createPoolCluster`))})]}_patchCreateConnection(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`query`,c._patchQuery(p)),p}}}_patchCreatePool(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`query`,c._patchQuery(p)),c._wrap(p,`getConnection`,c._patchGetConnection(p)),c._wrap(p,`end`,c._patchPoolEnd(p)),c._setPoolCallbacks(p,``),p}}}_patchPoolEnd(n){return c=>{let u=this;return function(p){let h=n._allConnections.length,x=n._freeConnections.length,T=h-x,O=(0,w.getPoolNameOld)(n);u._connCountAdd(-T,O,`used`),u._connCountAdd(-x,O,`idle`),c.apply(n,arguments)}}}_patchCreatePoolCluster(){return n=>{let c=this;return function(u){let p=n(...arguments);return c._wrap(p,`getConnection`,c._patchGetConnection(p)),c._wrap(p,`add`,c._patchAdd(p)),p}}}_patchAdd(n){return c=>{let u=this;return function(p,h){if(!u._enabled)return u._unwrap(n,`add`),c.apply(n,arguments);c.apply(n,arguments);let x=n._nodes;if(x){let c=x[typeof p==`object`?`CLUSTER::`+n._lastId:String(p)].pool;u._setPoolCallbacks(c,p)}}}}_patchGetConnection(n){return c=>{let u=this;return function(p,h,x){if(!u._enabled)return u._unwrap(n,`getConnection`),c.apply(n,arguments);if(arguments.length===1&&typeof p==`function`){let h=u._getConnectionCallbackPatchFn(p);return c.call(n,h)}if(arguments.length===2&&typeof h==`function`){let x=u._getConnectionCallbackPatchFn(h);return c.call(n,p,x)}if(arguments.length===3&&typeof x==`function`){let w=u._getConnectionCallbackPatchFn(x);return c.call(n,p,h,w)}return c.apply(n,arguments)}}}_getConnectionCallbackPatchFn(n){let p=this,h=c.context.active();return function(x,w){w&&((0,u.isWrapped)(w.query)||p._wrap(w,`query`,p._patchQuery(w))),typeof n==`function`&&c.context.with(h,n,this,x,w)}}_patchQuery(n){return T=>{let O=this;return function(A,j,N){if(!O._enabled)return O._unwrap(n,`query`),T.apply(n,arguments);let I={},{host:L,port:z,database:B,user:V}=(0,w.getConfig)(n.config),H=parseInt(z,10),U=(0,w.getDbQueryText)(A);O._dbSemconvStability&u.SemconvStability.OLD&&(I[h.ATTR_DB_SYSTEM]=h.DB_SYSTEM_VALUE_MYSQL,I[h.ATTR_DB_CONNECTION_STRING]=(0,w.getJDBCString)(L,z,B),I[h.ATTR_DB_NAME]=B,I[h.ATTR_DB_USER]=V,I[h.ATTR_DB_STATEMENT]=U),O._dbSemconvStability&u.SemconvStability.STABLE&&(I[p.ATTR_DB_SYSTEM_NAME]=p.DB_SYSTEM_NAME_VALUE_MYSQL,I[p.ATTR_DB_NAMESPACE]=B,I[p.ATTR_DB_QUERY_TEXT]=U),O._netSemconvStability&u.SemconvStability.OLD&&(I[h.ATTR_NET_PEER_NAME]=L,isNaN(H)||(I[h.ATTR_NET_PEER_PORT]=H)),O._netSemconvStability&u.SemconvStability.STABLE&&(I[p.ATTR_SERVER_ADDRESS]=L,isNaN(H)||(I[p.ATTR_SERVER_PORT]=H));let W=O.tracer.startSpan((0,w.getSpanName)(A),{kind:c.SpanKind.CLIENT,attributes:I});if(O.getConfig().enhancedDatabaseReporting){let n;Array.isArray(j)?n=j:arguments[2]&&(n=[j]),W.setAttribute(x.AttributeNames.MYSQL_VALUES,(0,w.getDbValues)(A,n))}let G=Array.from(arguments).findIndex(n=>typeof n==`function`),K=c.context.active();if(G===-1){let u=c.context.with(c.trace.setSpan(c.context.active(),W),()=>T.apply(n,arguments));return c.context.bind(K,u),u.on(`error`,n=>W.setStatus({code:c.SpanStatusCode.ERROR,message:n.message})).on(`end`,()=>{W.end()})}else return O._wrap(arguments,G,O._patchCallbackQuery(W,K)),c.context.with(c.trace.setSpan(c.context.active(),W),()=>T.apply(n,arguments))}}}_patchCallbackQuery(n,u){return p=>function(h,x,w){return h&&n.setStatus({code:c.SpanStatusCode.ERROR,message:h.message}),n.end(),c.context.with(u,()=>p(...arguments))}}_setPoolCallbacks(n,c){let u=c||(0,w.getPoolNameOld)(n);n.on(`connection`,n=>{this._connCountAdd(1,u,`idle`)}),n.on(`acquire`,n=>{this._connCountAdd(-1,u,`idle`),this._connCountAdd(1,u,`used`)}),n.on(`release`,n=>{this._connCountAdd(1,u,`idle`),this._connCountAdd(-1,u,`used`)})}}})),require_src$37=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQLInstrumentation=void 0;var c=require_instrumentation$11();Object.defineProperty(n,`MySQLInstrumentation`,{enumerable:!0,get:function(){return c.MySQLInstrumentation}})})),import_src$25=require_src$37();const INTEGRATION_NAME$14=`Mysql`,instrumentMysql=generateInstrumentOnce(INTEGRATION_NAME$14,()=>new import_src$25.MySQLInstrumentation({})),_mysqlIntegration=(()=>({name:INTEGRATION_NAME$14,setupOnce(){instrumentMysql()}})),mysqlIntegration=defineIntegration(_mysqlIntegration);var require_semconv$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_VALUE_MYSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=void 0,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MYSQL=`mysql`})),require_suppress_tracing$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$28=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$8();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7(),p=require_constants$8(),h=require_utils$28();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$7().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$18(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$18();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$7();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$8();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$7();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$21();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$21(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$7(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7(),p=require_TraceState$7();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$7(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$7();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$7();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$36=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$7();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$7();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$7();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$7();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$7();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$7();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$7();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$7();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$28();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$21();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$7();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$7();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$7();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$7();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$7();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$7();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$7();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$7();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$7();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$7();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$7()._export}})),require_src$35=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addSqlCommenterComment=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$36();function p(n){let c=n.indexOf(`--`);return c>=0?!0:n.indexOf(`/*`)<0?!1:c<n.indexOf(`*/`)}function h(n){return encodeURIComponent(n).replace(/[!'()*]/g,n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}function x(n,x){if(typeof x!=`string`||x.length===0||p(x))return x;let w=new u.W3CTraceContextPropagator,T={};w.inject(c.trace.setSpan(c.ROOT_CONTEXT,n),T,c.defaultTextMapSetter);let O=Object.keys(T).sort();return O.length===0?x:`${x} /*${O.map(n=>`${n}='${h(T[n])}'`).join(`,`)}*/`}n.addSqlCommenterComment=x})),require_utils$27=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getConnectionPrototypeToInstrument=n.once=n.getSpanName=n.getQueryText=n.getConnectionAttributes=void 0;let c=require_semconv$19(),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1));function h(n,h,T){let{host:O,port:A,database:j,user:N}=x(n),I={};h&u.SemconvStability.OLD&&(I[c.ATTR_DB_CONNECTION_STRING]=w(O,A,j),I[c.ATTR_DB_NAME]=j,I[c.ATTR_DB_USER]=N),h&u.SemconvStability.STABLE&&(I[p.ATTR_DB_NAMESPACE]=j);let L=parseInt(A,10);return T&u.SemconvStability.OLD&&(I[c.ATTR_NET_PEER_NAME]=O,isNaN(L)||(I[c.ATTR_NET_PEER_PORT]=L)),T&u.SemconvStability.STABLE&&(I[p.ATTR_SERVER_ADDRESS]=O,isNaN(L)||(I[p.ATTR_SERVER_PORT]=L)),I}n.getConnectionAttributes=h;function x(n){let{host:c,port:u,database:p,user:h}=n&&n.connectionConfig||n||{};return{host:c,port:u,database:p,user:h}}function w(n,c,u){let p=`jdbc:mysql://${n||`localhost`}`;return typeof c==`number`&&(p+=`:${c}`),typeof u==`string`&&(p+=`/${u}`),p}function T(n,c,u,p=!1,h=O){let[x,w]=typeof n==`string`?[n,u]:[n.sql,A(n)?u||n.values:u];try{return p?h(x):c&&w?c(x,w):x}catch{return`Could not determine the query due to an error in masking or formatting`}}n.getQueryText=T;function O(n){return n.replace(/\b\d+\b/g,`?`).replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,`?`)}function A(n){return`values`in n}function j(n){let c=typeof n==`object`?n.sql:n,u=c?.indexOf(` `);return typeof u==`number`&&u!==-1?c?.substring(0,u):c}n.getSpanName=j,n.once=n=>{let c=!1;return(...u)=>{if(!c)return c=!0,n(...u)}};function N(n){let c=n.prototype,u=Object.getPrototypeOf(c);return typeof u?.query==`function`&&typeof u?.execute==`function`?u:c}n.getConnectionPrototypeToInstrument=N})),require_version$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-mysql2`})),require_instrumentation$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQL2Instrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_semconv$19(),h=require_src$35(),x=require_utils$27(),w=require_version$17(),T=(init_esm$1(),__toCommonJS(esm_exports$1)),O=[`>=1.4.2 <4`];n.MySQL2Instrumentation=class extends u.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,u.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,u.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let n;function c(c){!n&&c.format&&(n=c.format)}let p=c=>{(0,u.isWrapped)(c.query)&&this._unwrap(c,`query`),this._wrap(c,`query`,this._patchQuery(n,!1)),(0,u.isWrapped)(c.execute)&&this._unwrap(c,`execute`),this._wrap(c,`execute`,this._patchQuery(n,!0))},h=n=>{this._unwrap(n,`query`),this._unwrap(n,`execute`)};return[new u.InstrumentationNodeModuleDefinition(`mysql2`,O,n=>(c(n),n),()=>{},[new u.InstrumentationNodeModuleFile(`mysql2/promise.js`,O,n=>(c(n),n),()=>{}),new u.InstrumentationNodeModuleFile(`mysql2/lib/connection.js`,O,n=>(p((0,x.getConnectionPrototypeToInstrument)(n)),n),n=>{n!==void 0&&h((0,x.getConnectionPrototypeToInstrument)(n))})])]}_patchQuery(n,w){return O=>{let A=this;return function(j,N,I){let L;Array.isArray(N)?L=N:arguments[2]&&(L=[N]);let{maskStatement:z,maskStatementHook:B,responseHook:V}=A.getConfig(),H=(0,x.getConnectionAttributes)(this.config,A._dbSemconvStability,A._netSemconvStability),U=(0,x.getQueryText)(j,n,L,z,B);A._dbSemconvStability&u.SemconvStability.OLD&&(H[p.ATTR_DB_SYSTEM]=p.DB_SYSTEM_VALUE_MYSQL,H[p.ATTR_DB_STATEMENT]=U),A._dbSemconvStability&u.SemconvStability.STABLE&&(H[T.ATTR_DB_SYSTEM_NAME]=T.DB_SYSTEM_NAME_VALUE_MYSQL,H[T.ATTR_DB_QUERY_TEXT]=U);let W=A.tracer.startSpan((0,x.getSpanName)(j),{kind:c.SpanKind.CLIENT,attributes:H});!w&&A.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=j=typeof j==`string`?(0,h.addSqlCommenterComment)(W,j):Object.assign(j,{sql:(0,h.addSqlCommenterComment)(W,j.sql)}));let G=(0,x.once)((n,p)=>{n?W.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}):typeof V==`function`&&(0,u.safeExecuteInTheMiddle)(()=>{V(W,{queryResults:p})},n=>{n&&A._diag.warn(`Failed executing responseHook`,n)},!0),W.end()});if(arguments.length===1){typeof j.onResult==`function`&&A._wrap(j,`onResult`,A._patchCallbackQuery(G));let n=O.apply(this,arguments);return n.once(`error`,n=>{G(n)}).once(`result`,n=>{G(void 0,n)}),n}return typeof arguments[1]==`function`?A._wrap(arguments,1,A._patchCallbackQuery(G)):typeof arguments[2]==`function`&&A._wrap(arguments,2,A._patchCallbackQuery(G)),O.apply(this,arguments)}}}_patchCallbackQuery(n){return c=>function(u,p,h){return n(u,p),c(...arguments)}}}})),require_src$34=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MySQL2Instrumentation=void 0;var c=require_instrumentation$10();Object.defineProperty(n,`MySQL2Instrumentation`,{enumerable:!0,get:function(){return c.MySQL2Instrumentation}})})),import_src$24=require_src$34();const INTEGRATION_NAME$13=`Mysql2`,instrumentMysql2=generateInstrumentOnce(INTEGRATION_NAME$13,()=>new import_src$24.MySQL2Instrumentation({responseHook(n){addOriginToSpan(n,`auto.db.otel.mysql2`)}})),_mysql2Integration=(()=>({name:INTEGRATION_NAME$13,setupOnce(){instrumentMysql2()}})),mysql2Integration=defineIntegration(_mysql2Integration),SINGLE_ARG_COMMANDS=[`get`,`set`,`setex`],GET_COMMANDS=[`get`,`mget`],SET_COMMANDS=[`set`,`setex`];function isInCommands(n,c){return n.includes(c.toLowerCase())}function getCacheOperation(n){if(isInCommands(GET_COMMANDS,n))return`cache.get`;if(isInCommands(SET_COMMANDS,n))return`cache.put`}function keyHasPrefix(n,c){return c.some(c=>n.startsWith(c))}function getCacheKeySafely(n,c){try{if(c.length===0)return;let u=n=>typeof n==`string`||typeof n==`number`||Buffer.isBuffer(n)?[n.toString()]:Array.isArray(n)?flatten(n.map(n=>u(n))):[`<unknown>`],p=c[0];return isInCommands(SINGLE_ARG_COMMANDS,n)&&p!=null?u(p):flatten(c.map(n=>u(n)))}catch{return}}function shouldConsiderForCache(n,c,u){if(!getCacheOperation(n))return!1;for(let n of c)if(keyHasPrefix(n,u))return!0;return!1}function calculateCacheItemSize(n){let c=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n==`string`?n.length:typeof n==`number`?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(n)?n.reduce((n,u)=>{let p=c(u);return typeof p==`number`?n===void 0?p:n+p:n},0):c(n)}function flatten(n){let c=[],u=n=>{n.forEach(n=>{Array.isArray(n)?u(n):c.push(n)})};return u(n),c}const serializationSubsets=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}],defaultDbStatementSerializer=(n,c)=>{if(Array.isArray(c)&&c.length){let u=serializationSubsets.find(({regex:c})=>c.test(n))?.args??0,p=u>=0?c.slice(0,u):c.slice();return c.length>p.length&&p.push(`[${c.length-u} other arguments]`),`${n} ${p.join(` `)}`}return n},ATTR_DB_CONNECTION_STRING=`db.connection_string`,ATTR_DB_STATEMENT=`db.statement`,ATTR_DB_SYSTEM=`db.system`,ATTR_NET_PEER_NAME=`net.peer.name`,ATTR_NET_PEER_PORT=`net.peer.port`,DB_SYSTEM_NAME_VALUE_REDIS=`redis`,DB_SYSTEM_VALUE_REDIS=`redis`;init_esm$2(),init_esm$1();const PACKAGE_NAME$2=`@opentelemetry/instrumentation-ioredis`,PACKAGE_VERSION$2=`0.62.0`;function endSpan$1(n,c){c&&(n.recordException(c),n.setStatus({code:SpanStatusCode.ERROR,message:c.message})),n.end()}const DEFAULT_CONFIG$1={requireParentSpan:!0};var IORedisInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(PACKAGE_NAME$2,PACKAGE_VERSION$2,{...DEFAULT_CONFIG$1,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,import_src$35.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...DEFAULT_CONFIG$1,...n})}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`ioredis`,[`>=2.0.0 <6`],(n,c)=>{let u=n[Symbol.toStringTag]===`Module`?n.default:n;return(0,import_src$35.isWrapped)(u.prototype.sendCommand)&&this._unwrap(u.prototype,`sendCommand`),this._wrap(u.prototype,`sendCommand`,this._patchSendCommand(c)),(0,import_src$35.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`connect`,this._patchConnection()),n},n=>{if(n===void 0)return;let c=n[Symbol.toStringTag]===`Module`?n.default:n;this._unwrap(c.prototype,`sendCommand`),this._unwrap(c.prototype,`connect`)})]}_patchSendCommand(n){return c=>this._traceSendCommand(c,n)}_patchConnection(){return n=>this._traceConnection(n)}_traceSendCommand(n,c){let u=this;return function(p){if(arguments.length<1||typeof p!=`object`)return n.apply(this,arguments);let h=u.getConfig(),x=h.dbStatementSerializer||defaultDbStatementSerializer,w=trace.getSpan(context$1.active())===void 0;if(h.requireParentSpan===!0&&w)return n.apply(this,arguments);let T={},{host:O,port:A}=this.options,j=x(p.name,p.args);u._dbSemconvStability&import_src$35.SemconvStability.OLD&&(T[ATTR_DB_SYSTEM]=DB_SYSTEM_VALUE_REDIS,T[ATTR_DB_STATEMENT]=j,T[ATTR_DB_CONNECTION_STRING]=`redis://${O}:${A}`),u._dbSemconvStability&import_src$35.SemconvStability.STABLE&&(T[ATTR_DB_SYSTEM_NAME]=DB_SYSTEM_NAME_VALUE_REDIS,T[ATTR_DB_QUERY_TEXT]=j),u._netSemconvStability&import_src$35.SemconvStability.OLD&&(T[ATTR_NET_PEER_NAME]=O,T[ATTR_NET_PEER_PORT]=A),u._netSemconvStability&import_src$35.SemconvStability.STABLE&&(T[ATTR_SERVER_ADDRESS]=O,T[ATTR_SERVER_PORT]=A),T[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let N=u.tracer.startSpan(p.name,{kind:SpanKind.CLIENT,attributes:T}),{requestHook:I}=h;I&&(0,import_src$35.safeExecuteInTheMiddle)(()=>I(N,{moduleVersion:c,cmdName:p.name,cmdArgs:p.args}),n=>{n&&diag.error(`ioredis instrumentation: request hook failed`,n)},!0);try{let c=n.apply(this,arguments),u=p.resolve;p.resolve=function(n){(0,import_src$35.safeExecuteInTheMiddle)(()=>h.responseHook?.(N,p.name,p.args,n),n=>{n&&diag.error(`ioredis instrumentation: response hook failed`,n)},!0),endSpan$1(N,null),u(n)};let x=p.reject;return p.reject=function(n){endSpan$1(N,n),x(n)},c}catch(n){throw endSpan$1(N,n),n}}}_traceConnection(n){let c=this;return function(){let u=trace.getSpan(context$1.active())===void 0;if(c.getConfig().requireParentSpan===!0&&u)return n.apply(this,arguments);let p={},{host:h,port:x}=this.options;c._dbSemconvStability&import_src$35.SemconvStability.OLD&&(p[ATTR_DB_SYSTEM]=DB_SYSTEM_VALUE_REDIS,p[ATTR_DB_STATEMENT]=`connect`,p[ATTR_DB_CONNECTION_STRING]=`redis://${h}:${x}`),c._dbSemconvStability&import_src$35.SemconvStability.STABLE&&(p[ATTR_DB_SYSTEM_NAME]=DB_SYSTEM_NAME_VALUE_REDIS,p[ATTR_DB_QUERY_TEXT]=`connect`),c._netSemconvStability&import_src$35.SemconvStability.OLD&&(p[ATTR_NET_PEER_NAME]=h,p[ATTR_NET_PEER_PORT]=x),c._netSemconvStability&import_src$35.SemconvStability.STABLE&&(p[ATTR_SERVER_ADDRESS]=h,p[ATTR_SERVER_PORT]=x),p[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let w=c.tracer.startSpan(`connect`,{kind:SpanKind.CLIENT,attributes:p});try{let c=n.apply(this,arguments);return typeof c?.then==`function`?c.then(n=>(endSpan$1(w,null),n),n=>(endSpan$1(w,n),Promise.reject(n))):(endSpan$1(w,null),c)}catch(n){throw endSpan$1(w,n),n}}}};init_esm$2(),init_esm$1();const PACKAGE_NAME$1=`@opentelemetry/instrumentation-redis`,PACKAGE_VERSION$1=`0.62.0`,OTEL_OPEN_SPANS=Symbol(`opentelemetry.instrumentation.redis.open_spans`),MULTI_COMMAND_OPTIONS=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function removeCredentialsFromDBConnectionStringAttribute(n,c){if(!(typeof c!=`string`||!c))try{let n=new URL(c);return n.searchParams.delete(`user_pwd`),n.username=``,n.password=``,n.href}catch(c){n.error(`failed to sanitize redis connection url`,c)}}function getClientAttributes(n,c,u){let p={};return u&import_src$35.SemconvStability.OLD&&Object.assign(p,{[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,[ATTR_NET_PEER_NAME]:c?.socket?.host,[ATTR_NET_PEER_PORT]:c?.socket?.port,[ATTR_DB_CONNECTION_STRING]:removeCredentialsFromDBConnectionStringAttribute(n,c?.url)}),u&import_src$35.SemconvStability.STABLE&&Object.assign(p,{[ATTR_DB_SYSTEM_NAME]:DB_SYSTEM_NAME_VALUE_REDIS,[ATTR_SERVER_ADDRESS]:c?.socket?.host,[ATTR_SERVER_PORT]:c?.socket?.port}),p}function endSpanV2(n,c){c&&n.setStatus({code:SpanStatusCode.ERROR,message:c.message}),n.end()}function getTracedCreateClient(n){return function(){let c=n.apply(this,arguments);return context$1.bind(context$1.active(),c)}}function getTracedCreateStreamTrace(n){return function(){return Object.prototype.hasOwnProperty.call(this,`stream`)||Object.defineProperty(this,`stream`,{get(){return this._patched_redis_stream},set(n){context$1.bind(context$1.active(),n),this._patched_redis_stream=n}}),n.apply(this,arguments)}}var RedisInstrumentationV2_V3=class n extends import_src$35.InstrumentationBase{static __initStatic(){this.COMPONENT=`redis`}constructor(n={}){super(PACKAGE_NAME$1,PACKAGE_VERSION$1,n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig(n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`redis`,[`>=2.6.0 <4`],n=>((0,import_src$35.isWrapped)(n.RedisClient.prototype.internal_send_command)&&this._unwrap(n.RedisClient.prototype,`internal_send_command`),this._wrap(n.RedisClient.prototype,`internal_send_command`,this._getPatchInternalSendCommand()),(0,import_src$35.isWrapped)(n.RedisClient.prototype.create_stream)&&this._unwrap(n.RedisClient.prototype,`create_stream`),this._wrap(n.RedisClient.prototype,`create_stream`,this._getPatchCreateStream()),(0,import_src$35.isWrapped)(n.createClient)&&this._unwrap(n,`createClient`),this._wrap(n,`createClient`,this._getPatchCreateClient()),n),n=>{n!==void 0&&(this._unwrap(n.RedisClient.prototype,`internal_send_command`),this._unwrap(n.RedisClient.prototype,`create_stream`),this._unwrap(n,`createClient`))})]}_getPatchInternalSendCommand(){let c=this;return function(u){return function(p){if(arguments.length!==1||typeof p!=`object`)return u.apply(this,arguments);let h=c.getConfig(),x=trace.getSpan(context$1.active())===void 0;if(h.requireParentSpan===!0&&x)return u.apply(this,arguments);let w=h?.dbStatementSerializer||defaultDbStatementSerializer,T={};c._semconvStability&import_src$35.SemconvStability.OLD&&Object.assign(T,{[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,[ATTR_DB_STATEMENT]:w(p.command,p.args)}),c._semconvStability&import_src$35.SemconvStability.STABLE&&Object.assign(T,{[ATTR_DB_SYSTEM_NAME]:DB_SYSTEM_NAME_VALUE_REDIS,[ATTR_DB_OPERATION_NAME]:p.command,[ATTR_DB_QUERY_TEXT]:w(p.command,p.args)}),T[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let O=c.tracer.startSpan(`${n.COMPONENT}-${p.command}`,{kind:SpanKind.CLIENT,attributes:T});if(this.connection_options){let n={};c._semconvStability&import_src$35.SemconvStability.OLD&&Object.assign(n,{[ATTR_NET_PEER_NAME]:this.connection_options.host,[ATTR_NET_PEER_PORT]:this.connection_options.port}),c._semconvStability&import_src$35.SemconvStability.STABLE&&Object.assign(n,{[ATTR_SERVER_ADDRESS]:this.connection_options.host,[ATTR_SERVER_PORT]:this.connection_options.port}),O.setAttributes(n)}this.address&&c._semconvStability&import_src$35.SemconvStability.OLD&&O.setAttribute(ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let A=arguments[0].callback;if(A){let n=context$1.active();arguments[0].callback=function(u,x){if(h?.responseHook){let n=h.responseHook;(0,import_src$35.safeExecuteInTheMiddle)(()=>{n(O,p.command,p.args,x)},n=>{n&&c._diag.error(`Error executing responseHook`,n)},!0)}return endSpanV2(O,u),context$1.with(n,A,this,...arguments)}}try{return u.apply(this,arguments)}catch(n){throw endSpanV2(O,n),n}}}}_getPatchCreateClient(){return function(n){return getTracedCreateClient(n)}}_getPatchCreateStream(){return function(n){return getTracedCreateStreamTrace(n)}}};RedisInstrumentationV2_V3.__initStatic();var RedisInstrumentationV4_V5=class n extends import_src$35.InstrumentationBase{static __initStatic2(){this.COMPONENT=`redis`}constructor(n={}){super(PACKAGE_NAME$1,PACKAGE_VERSION$1,n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig(n),this._semconvStability=n.semconvStability?n.semconvStability:(0,import_src$35.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(n){return new import_src$35.InstrumentationNodeModuleDefinition(n,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>n,()=>{},[new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/commander.js`,[`^1.0.0`],(n,c)=>{let u=n.transformCommandArguments;if(!u)return this._diag.error(`internal instrumentation error, missing transformCommandArguments function`),n;let p=c?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return(0,import_src$35.isWrapped)(n?.[p])&&this._unwrap(n,p),this._wrap(n,p,this._getPatchExtendWithCommands(u)),n},n=>{(0,import_src$35.isWrapped)(n?.extendWithCommands)&&this._unwrap(n,`extendWithCommands`),(0,import_src$35.isWrapped)(n?.attachCommands)&&this._unwrap(n,`attachCommands`)}),new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>{let c=n?.default?.prototype;return(0,import_src$35.isWrapped)(c?.exec)&&this._unwrap(c,`exec`),this._wrap(c,`exec`,this._getPatchMultiCommandsExec(!1)),(0,import_src$35.isWrapped)(c?.execAsPipeline)&&this._unwrap(c,`execAsPipeline`),this._wrap(c,`execAsPipeline`,this._getPatchMultiCommandsExec(!0)),(0,import_src$35.isWrapped)(c?.addCommand)&&this._unwrap(c,`addCommand`),this._wrap(c,`addCommand`,this._getPatchMultiCommandsAddCommand()),n},n=>{let c=n?.default?.prototype;(0,import_src$35.isWrapped)(c?.exec)&&this._unwrap(c,`exec`),(0,import_src$35.isWrapped)(c?.execAsPipeline)&&this._unwrap(c,`execAsPipeline`),(0,import_src$35.isWrapped)(c?.addCommand)&&this._unwrap(c,`addCommand`)}),new import_src$35.InstrumentationNodeModuleFile(`${n}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],n=>{let c=n?.default?.prototype;return c?.multi&&((0,import_src$35.isWrapped)(c?.multi)&&this._unwrap(c,`multi`),this._wrap(c,`multi`,this._getPatchRedisClientMulti())),c?.MULTI&&((0,import_src$35.isWrapped)(c?.MULTI)&&this._unwrap(c,`MULTI`),this._wrap(c,`MULTI`,this._getPatchRedisClientMulti())),(0,import_src$35.isWrapped)(c?.sendCommand)&&this._unwrap(c,`sendCommand`),this._wrap(c,`sendCommand`,this._getPatchRedisClientSendCommand()),(0,import_src$35.isWrapped)(c?.connect)&&this._unwrap(c,`connect`),this._wrap(c,`connect`,this._getPatchedClientConnect()),n},n=>{let c=n?.default?.prototype;(0,import_src$35.isWrapped)(c?.multi)&&this._unwrap(c,`multi`),(0,import_src$35.isWrapped)(c?.MULTI)&&this._unwrap(c,`MULTI`),(0,import_src$35.isWrapped)(c?.sendCommand)&&this._unwrap(c,`sendCommand`),(0,import_src$35.isWrapped)(c?.connect)&&this._unwrap(c,`connect`)})])}_getPatchExtendWithCommands(n){let c=this;return function(u){return function(p){if(p?.BaseClass?.name!==`RedisClient`)return u.apply(this,arguments);let h=p.executor;return p.executor=function(u,p){let x=n(u,p).args;return c._traceClientCommand(h,this,arguments,x)},u.apply(this,arguments)}}}_getPatchMultiCommandsExec(n){let c=this;return function(u){return function(){let p=u.apply(this,arguments);return typeof p?.then==`function`?p.then(u=>{let p=this[OTEL_OPEN_SPANS];return c._endSpansWithRedisReplies(p,u,n),u}).catch(u=>{let p=this[OTEL_OPEN_SPANS];if(!p)c._diag.error(`cannot find open spans to end for multi/pipeline`);else{let h=u.constructor.name===`MultiErrorReply`?u.replies:Array(p.length).fill(u);c._endSpansWithRedisReplies(p,h,n)}return Promise.reject(u)}):(c._diag.error(`non-promise result when patching exec/execAsPipeline`),p)}}}_getPatchMultiCommandsAddCommand(){let n=this;return function(c){return function(u){return n._traceClientCommand(c,this,arguments,u)}}}_getPatchRedisClientMulti(){return function(n){return function(){let c=n.apply(this,arguments);return c[MULTI_COMMAND_OPTIONS]=this.options,c}}}_getPatchRedisClientSendCommand(){let n=this;return function(c){return function(u){return n._traceClientCommand(c,this,arguments,u)}}}_getPatchedClientConnect(){let c=this;return function(u){return function(){let p=this.options,h=getClientAttributes(c._diag,p,c._semconvStability);h[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let x=c.tracer.startSpan(`${n.COMPONENT}-connect`,{kind:SpanKind.CLIENT,attributes:h});return context$1.with(trace.setSpan(context$1.active(),x),()=>u.apply(this)).then(n=>(x.end(),n)).catch(n=>(x.recordException(n),x.setStatus({code:SpanStatusCode.ERROR,message:n.message}),x.end(),Promise.reject(n)))}}}_traceClientCommand(c,u,p,h){if(trace.getSpan(context$1.active())===void 0&&this.getConfig().requireParentSpan)return c.apply(u,p);let x=u.options||u[MULTI_COMMAND_OPTIONS],w=h[0],T=h.slice(1),O=this.getConfig().dbStatementSerializer||defaultDbStatementSerializer,A=getClientAttributes(this._diag,x,this._semconvStability);this._semconvStability&import_src$35.SemconvStability.STABLE&&(A[ATTR_DB_OPERATION_NAME]=w);try{let n=O(w,T);n!=null&&(this._semconvStability&import_src$35.SemconvStability.OLD&&(A[ATTR_DB_STATEMENT]=n),this._semconvStability&import_src$35.SemconvStability.STABLE&&(A[ATTR_DB_QUERY_TEXT]=n))}catch(n){this._diag.error(`dbStatementSerializer throw an exception`,n,{commandName:w})}A[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]=`auto.db.otel.redis`;let j=this.tracer.startSpan(`${n.COMPONENT}-${w}`,{kind:SpanKind.CLIENT,attributes:A}),N=context$1.with(trace.setSpan(context$1.active(),j),()=>c.apply(u,p));if(typeof N?.then==`function`)N.then(n=>{this._endSpanWithResponse(j,w,T,n,void 0)},n=>{this._endSpanWithResponse(j,w,T,null,n)});else{let n=N;n[OTEL_OPEN_SPANS]=n[OTEL_OPEN_SPANS]||[],n[OTEL_OPEN_SPANS].push({span:j,commandName:w,commandArgs:T})}return N}_endSpansWithRedisReplies(n,c,u=!1){if(!n)return this._diag.error(`cannot find open spans to end for redis multi/pipeline`);if(c.length!==n.length)return this._diag.error(`number of multi command spans does not match response from redis`);let p=n.map(n=>n.commandName),h=p.every(n=>n===p[0])?(u?`PIPELINE `:`MULTI `)+p[0]:u?`PIPELINE`:`MULTI`;for(let u=0;u<n.length;u++){let{span:x,commandArgs:w}=n[u],T=c[u],[O,A]=T instanceof Error?[null,T]:[T,void 0];this._semconvStability&import_src$35.SemconvStability.STABLE&&x.setAttribute(ATTR_DB_OPERATION_NAME,h),this._endSpanWithResponse(x,p[u],w,O,A)}}_endSpanWithResponse(n,c,u,p,h){let{responseHook:x}=this.getConfig();if(!h&&x)try{x(n,c,u,p)}catch(n){this._diag.error(`responseHook throw an exception`,n)}h&&(n.recordException(h),n.setStatus({code:SpanStatusCode.ERROR,message:h?.message})),n.end()}};RedisInstrumentationV4_V5.__initStatic2();const DEFAULT_CONFIG={requireParentSpan:!1};var RedisInstrumentation=class n extends import_src$35.InstrumentationBase{__init(){this.initialized=!1}constructor(c={}){let u={...DEFAULT_CONFIG,...c};super(PACKAGE_NAME$1,PACKAGE_VERSION$1,u),n.prototype.__init.call(this),this.instrumentationV2_V3=new RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(n={}){let c={...DEFAULT_CONFIG,...n};super.setConfig(c),this.initialized&&(this.instrumentationV2_V3.setConfig(c),this.instrumentationV4_V5.setConfig(c))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(n){super.setTracerProvider(n),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(n),this.instrumentationV4_V5.setTracerProvider(n))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};init_esm$2();function tracingChannel$1(n,c){let u=tracingChannel(n),p;try{p=context$1._getContextManager().getAsyncLocalStorageLookup()}catch{}if(!p)return DEBUG_BUILD$1&&warn(`[TracingChannel] Could not access OpenTelemetry AsyncLocalStorage, context propagation will not work.`),u;let h=p.asyncLocalStorage;return u.start.bindStore(h,n=>{let u=c(n);return n._sentrySpan=u,trace.setSpan(context$1.active(),u)}),u}const CHANNEL_COMMAND=`node-redis:command`,CHANNEL_BATCH=`node-redis:batch`,CHANNEL_CONNECT=`node-redis:connect`,ORIGIN=`auto.db.redis.diagnostic_channel`,NOOP=()=>{};let subscribed=!1,currentResponseHook;function subscribeRedisDiagnosticChannels(n){if(currentResponseHook=n,!subscribed)try{setupCommandChannel(),setupBatchChannel(),setupConnectChannel(),subscribed=!0}catch{}}function setupCommandChannel(){tracingChannel$1(CHANNEL_COMMAND,n=>{let c=n.args.slice(1),u=safeSerialize(n.command,c);return startSpanManual$1({name:`redis-${n.command}`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...u==null?{}:{[ATTR_DB_STATEMENT]:u},...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)}).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{let c=n._sentrySpan;!c||n.error||(runResponseHook(c,n.command,n.args.slice(1),n.result),c.end())},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function setupBatchChannel(){tracingChannel$1(CHANNEL_BATCH,n=>startSpanManual$1({name:n.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...n.batchSize==null?{}:{"db.redis.batch_size":n.batchSize},...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{n.error||n._sentrySpan?.end()},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function setupConnectChannel(){tracingChannel$1(CHANNEL_CONNECT,n=>startSpanManual$1({name:`redis-connect`,attributes:{[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:ORIGIN,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`db.redis.connect`,[ATTR_DB_SYSTEM]:DB_SYSTEM_VALUE_REDIS,...n.serverAddress==null?{}:{[ATTR_NET_PEER_NAME]:n.serverAddress},...n.serverPort==null?{}:{[ATTR_NET_PEER_PORT]:n.serverPort}}},n=>n)).subscribe({start:NOOP,asyncStart:NOOP,end:NOOP,asyncEnd:n=>{n.error||n._sentrySpan?.end()},error:n=>{let c=n._sentrySpan;c&&(n.error&&c.setStatus({code:2,message:n.error.message}),c.end())}})}function runResponseHook(n,c,u,p){let h=currentResponseHook;if(h)try{h(n,c,u,p)}catch{}}function safeSerialize(n,c){try{return defaultDbStatementSerializer(n,c)}catch{return}}const INTEGRATION_NAME$12=`Redis`;let _redisOptions={};const cacheResponseHook=(n,c,u,p)=>{let h=getCacheKeySafely(c,u),x=getCacheOperation(c);if(!h||!x||!_redisOptions.cachePrefixes||!shouldConsiderForCache(c,h,_redisOptions.cachePrefixes))return;let w=spanToJSON(n).data,T=w[`net.peer.name`]??w[`server.address`],O=w[`net.peer.port`]??w[`server.port`];O&&T&&n.setAttributes({"network.peer.address":T,"network.peer.port":O});let A=calculateCacheItemSize(p);A&&n.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,A),isInCommands(GET_COMMANDS,c)&&A!==void 0&&n.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT,A>0),n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_OP]:x,[SEMANTIC_ATTRIBUTE_CACHE_KEY]:h});let j=h.join(`, `);n.updateName(_redisOptions.maxCacheKeyLength?truncate(j,_redisOptions.maxCacheKeyLength):j)},instrumentIORedis=generateInstrumentOnce(`${INTEGRATION_NAME$12}.IORedis`,()=>new IORedisInstrumentation({responseHook:cacheResponseHook})),instrumentRedisModule=generateInstrumentOnce(`${INTEGRATION_NAME$12}.Redis`,()=>new RedisInstrumentation({responseHook:cacheResponseHook})),instrumentRedis=Object.assign(()=>{instrumentIORedis(),instrumentRedisModule(),Promise.resolve().then(()=>subscribeRedisDiagnosticChannels(cacheResponseHook))},{id:INTEGRATION_NAME$12}),_redisIntegration=((n={})=>({name:INTEGRATION_NAME$12,setupOnce(){_redisOptions=n,instrumentRedis()}})),redisIntegration=defineIntegration(_redisIntegration);var require_internal_types$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EVENT_LISTENERS_SET=void 0,n.EVENT_LISTENERS_SET=Symbol(`opentelemetry.instrumentation.pg.eventListenersSet`)})),require_AttributeNames$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.PG_VALUES=`db.postgresql.values`,n.PG_PLAN=`db.postgresql.plan`,n.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,n.MAX_CLIENT=`db.postgresql.max.client`})(n.AttributeNames||={})})),require_semconv$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=n.METRIC_DB_CLIENT_CONNECTION_COUNT=n.DB_SYSTEM_VALUE_POSTGRESQL=n.DB_CLIENT_CONNECTION_STATE_VALUE_USED=n.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_NAME=n.ATTR_DB_CONNECTION_STRING=n.ATTR_DB_CLIENT_CONNECTION_STATE=n.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0,n.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=`db.client.connection.pool.name`,n.ATTR_DB_CLIENT_CONNECTION_STATE=`db.client.connection.state`,n.ATTR_DB_CONNECTION_STRING=`db.connection_string`,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=`idle`,n.DB_CLIENT_CONNECTION_STATE_VALUE_USED=`used`,n.DB_SYSTEM_VALUE_POSTGRESQL=`postgresql`,n.METRIC_DB_CLIENT_CONNECTION_COUNT=`db.client.connection.count`,n.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=`db.client.connection.pending_requests`})),require_SpanNames=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanNames=void 0,(function(n){n.QUERY_PREFIX=`pg.query`,n.CONNECT=`pg.connect`,n.POOL_CONNECT=`pg-pool.connect`})(n.SpanNames||={})})),require_utils$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.sanitizedErrorMessage=n.isObjectWithTextString=n.getErrorMessage=n.patchClientConnectCallback=n.patchCallbackPGPool=n.updateCounter=n.getPoolName=n.patchCallback=n.handleExecutionResult=n.handleConfigQuery=n.shouldSkipInstrumentation=n.getSemanticAttributesFromPoolConnection=n.getSemanticAttributesFromConnection=n.getConnectionString=n.parseAndMaskConnectionString=n.parseNormalizedOperationName=n.getQuerySpanName=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_AttributeNames$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$17(),x=require_src$52(),w=require_SpanNames();function T(n,c){if(!c)return w.SpanNames.QUERY_PREFIX;let u=typeof c.name==`string`&&c.name?c.name:O(c.text);return`${w.SpanNames.QUERY_PREFIX}:${u}${n?` ${n}`:``}`}n.getQuerySpanName=T;function O(n){let c=n.trim(),u=c.indexOf(` `),p=u===-1?c:c.slice(0,u);return p=p.toUpperCase(),p.endsWith(`;`)?p.slice(0,-1):p}n.parseNormalizedOperationName=O;function A(n){try{let c=new URL(n);return c.username=``,c.password=``,c.toString()}catch{return`postgresql://localhost:5432/`}}n.parseAndMaskConnectionString=A;function j(n){return`connectionString`in n&&n.connectionString?A(n.connectionString):`postgresql://${n.host||`localhost`}:${n.port||5432}/${n.database||``}`}n.getConnectionString=j;function N(n){if(Number.isInteger(n))return n}function I(n,c){let u={};return c&x.SemconvStability.OLD&&(u={...u,[h.ATTR_DB_SYSTEM]:h.DB_SYSTEM_VALUE_POSTGRESQL,[h.ATTR_DB_NAME]:n.database,[h.ATTR_DB_CONNECTION_STRING]:j(n),[h.ATTR_DB_USER]:n.user,[h.ATTR_NET_PEER_NAME]:n.host,[h.ATTR_NET_PEER_PORT]:N(n.port)}),c&x.SemconvStability.STABLE&&(u={...u,[p.ATTR_DB_SYSTEM_NAME]:p.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[p.ATTR_DB_NAMESPACE]:n.namespace,[p.ATTR_SERVER_ADDRESS]:n.host,[p.ATTR_SERVER_PORT]:N(n.port)}),u}n.getSemanticAttributesFromConnection=I;function L(n,c){let w;try{w=n.connectionString?new URL(n.connectionString):void 0}catch{w=void 0}let T={[u.AttributeNames.IDLE_TIMEOUT_MILLIS]:n.idleTimeoutMillis,[u.AttributeNames.MAX_CLIENT]:n.maxClient};return c&x.SemconvStability.OLD&&(T={...T,[h.ATTR_DB_SYSTEM]:h.DB_SYSTEM_VALUE_POSTGRESQL,[h.ATTR_DB_NAME]:w?.pathname.slice(1)??n.database,[h.ATTR_DB_CONNECTION_STRING]:j(n),[h.ATTR_NET_PEER_NAME]:w?.hostname??n.host,[h.ATTR_NET_PEER_PORT]:Number(w?.port)||N(n.port),[h.ATTR_DB_USER]:w?.username??n.user}),c&x.SemconvStability.STABLE&&(T={...T,[p.ATTR_DB_SYSTEM_NAME]:p.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[p.ATTR_DB_NAMESPACE]:n.namespace,[p.ATTR_SERVER_ADDRESS]:w?.hostname??n.host,[p.ATTR_SERVER_PORT]:Number(w?.port)||N(n.port)}),T}n.getSemanticAttributesFromPoolConnection=L;function z(n){return n.requireParentSpan===!0&&c.trace.getSpan(c.context.active())===void 0}n.shouldSkipInstrumentation=z;function B(n,w,O,A){let{connectionParameters:j}=this,N=j.database,L=T(N,A),z=n.startSpan(L,{kind:c.SpanKind.CLIENT,attributes:I(j,O)});if(!A)return z;if(A.text&&(O&x.SemconvStability.OLD&&z.setAttribute(h.ATTR_DB_STATEMENT,A.text),O&x.SemconvStability.STABLE&&z.setAttribute(p.ATTR_DB_QUERY_TEXT,A.text)),w.enhancedDatabaseReporting&&Array.isArray(A.values))try{let n=A.values.map(n=>n==null?`null`:n instanceof Buffer?n.toString():typeof n==`object`?typeof n.toPostgres==`function`?n.toPostgres():JSON.stringify(n):n.toString());z.setAttribute(u.AttributeNames.PG_VALUES,n)}catch(n){c.diag.error(`failed to stringify `,A.values,n)}return typeof A.name==`string`&&z.setAttribute(u.AttributeNames.PG_PLAN,A.name),z}n.handleConfigQuery=B;function V(n,u,p){typeof n.responseHook==`function`&&(0,x.safeExecuteInTheMiddle)(()=>{n.responseHook(u,{data:p})},n=>{n&&c.diag.error(`Error running response hook`,n)},!0)}n.handleExecutionResult=V;function H(n,u,h,x,w){return function(T,O){T?(Object.prototype.hasOwnProperty.call(T,`code`)&&(x[p.ATTR_ERROR_TYPE]=T.code),T instanceof Error&&u.recordException(J(T)),u.setStatus({code:c.SpanStatusCode.ERROR,message:T.message})):V(n,u,O),w(),u.end(),h.call(this,T,O)}}n.patchCallback=H;function U(n){let c=``;return c+=(n?.host?`${n.host}`:`unknown_host`)+`:`,c+=(n?.port?`${n.port}`:`unknown_port`)+`/`,c+=n?.database?`${n.database}`:`unknown_database`,c.trim()}n.getPoolName=U;function W(n,c,u,p,x){let w=c.totalCount,T=c.waitingCount,O=c.idleCount,A=w-O;return u.add(A-x.used,{[h.ATTR_DB_CLIENT_CONNECTION_STATE]:h.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),u.add(O-x.idle,{[h.ATTR_DB_CLIENT_CONNECTION_STATE]:h.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),p.add(T-x.pending,{[h.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:n}),{used:A,idle:O,pending:T}}n.updateCounter=W;function G(n,u){return function(p,h,x){p&&(p instanceof Error&&n.recordException(J(p)),n.setStatus({code:c.SpanStatusCode.ERROR,message:p.message})),n.end(),u.call(this,p,h,x)}}n.patchCallbackPGPool=G;function K(n,u){return function(p){p&&(p instanceof Error&&n.recordException(J(p)),n.setStatus({code:c.SpanStatusCode.ERROR,message:p.message})),n.end(),u.apply(this,arguments)}}n.patchClientConnectCallback=K;function ee(n){return typeof n==`object`&&n&&`message`in n?String(n.message):void 0}n.getErrorMessage=ee;function te(n){return typeof n==`object`&&typeof n?.text==`string`}n.isObjectWithTextString=te;function J(n){return`PostgreSQL error of type '${n?.name??`PostgreSQLError`}' occurred (code: ${n?.code??`UNKNOWN`})`}n.sanitizedErrorMessage=J})),require_version$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.66.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-pg`})),require_instrumentation$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PgInstrumentation=void 0;let c=require_src$52(),u=(init_esm$2(),__toCommonJS(esm_exports$2)),p=require_internal_types$4(),h=require_utils$26(),x=require_src$35(),w=require_version$16(),T=require_SpanNames(),O=require_src$47(),A=(init_esm$1(),__toCommonJS(esm_exports$1)),j=require_semconv$17();function N(n){return n[Symbol.toStringTag]===`Module`?n.default:n}n.PgInstrumentation=class extends c.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(n={}){super(w.PACKAGE_NAME,w.PACKAGE_VERSION,n),this._semconvStability=(0,c.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(A.METRIC_DB_CLIENT_OPERATION_DURATION,{description:`Duration of database client operations.`,unit:`s`,valueType:u.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(j.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:`The number of connections that are currently in state described by the state attribute.`,unit:`{connection}`}),this._connectionPendingRequests=this.meter.createUpDownCounter(j.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:`The number of current pending requests for an open connection.`,unit:`{connection}`})}init(){let n=[`>=8.0.3 <9`],u=[`>=2.0.0 <4`],p=new c.InstrumentationNodeModuleFile(`pg/lib/native/client.js`,n,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),h=new c.InstrumentationNodeModuleFile(`pg/lib/client.js`,n,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new c.InstrumentationNodeModuleDefinition(`pg`,n,n=>{let c=N(n);return this._patchPgClient(c.Client),n},n=>{let c=N(n);return this._unpatchPgClient(c.Client),n},[h,p]),new c.InstrumentationNodeModuleDefinition(`pg-pool`,u,n=>{let u=N(n);return(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`connect`,this._getPoolConnectPatch()),u},n=>{let u=N(n);(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`)})]}_patchPgClient(n){if(!n)return;let u=N(n);return(0,c.isWrapped)(u.prototype.query)&&this._unwrap(u.prototype,`query`),(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),this._wrap(u.prototype,`query`,this._getClientQueryPatch()),this._wrap(u.prototype,`connect`,this._getClientConnectPatch()),n}_unpatchPgClient(n){let u=N(n);return(0,c.isWrapped)(u.prototype.query)&&this._unwrap(u.prototype,`query`),(0,c.isWrapped)(u.prototype.connect)&&this._unwrap(u.prototype,`connect`),n}_getClientConnectPatch(){let n=this;return c=>function(p){let x=n.getConfig();if(h.shouldSkipInstrumentation(x)||x.ignoreConnectSpans)return c.call(this,p);let w=n.tracer.startSpan(T.SpanNames.CONNECT,{kind:u.SpanKind.CLIENT,attributes:h.getSemanticAttributesFromConnection(this,n._semconvStability)});if(p){let n=u.trace.getSpan(u.context.active());p=h.patchClientConnectCallback(w,p),n&&(p=u.context.bind(u.context.active(),p))}return I(w,u.context.with(u.trace.setSpan(u.context.active(),w),()=>c.call(this,p)))}}recordOperationDuration(n,u){let p={},h=[A.ATTR_DB_NAMESPACE,A.ATTR_ERROR_TYPE,A.ATTR_SERVER_PORT,A.ATTR_SERVER_ADDRESS,A.ATTR_DB_OPERATION_NAME];this._semconvStability&c.SemconvStability.OLD&&h.push(j.ATTR_DB_SYSTEM),this._semconvStability&c.SemconvStability.STABLE&&h.push(A.ATTR_DB_SYSTEM_NAME),h.forEach(c=>{c in n&&(p[c]=n[c])});let x=(0,O.hrTimeToMilliseconds)((0,O.hrTimeDuration)(u,(0,O.hrTime)()))/1e3;this._operationDuration.record(x,p)}_getClientQueryPatch(){let n=this;return p=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...w){if(h.shouldSkipInstrumentation(n.getConfig()))return p.apply(this,w);let T=(0,O.hrTime)(),N=w[0],I=typeof N==`string`,L=h.isObjectWithTextString(N),z=I?{text:N,values:Array.isArray(w[1])?w[1]:void 0}:L?{...N,name:N.name,text:N.text,values:N.values??(Array.isArray(w[1])?w[1]:void 0)}:void 0,B={[j.ATTR_DB_SYSTEM]:j.DB_SYSTEM_VALUE_POSTGRESQL,[A.ATTR_DB_NAMESPACE]:this.database,[A.ATTR_SERVER_PORT]:this.connectionParameters.port,[A.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};z?.text&&(B[A.ATTR_DB_OPERATION_NAME]=h.parseNormalizedOperationName(z?.text));let V=()=>{n.recordOperationDuration(B,T)},H=n.getConfig(),U=h.handleConfigQuery.call(this,n.tracer,H,n._semconvStability,z);if(H.addSqlCommenterCommentToQueries&&(I?w[0]=(0,x.addSqlCommenterComment)(U,N):L&&!(`name`in N)&&(w[0]={...N,text:(0,x.addSqlCommenterComment)(U,N.text)})),w.length>0){let c=u.trace.getSpan(u.context.active());if(typeof w[w.length-1]==`function`)w[w.length-1]=h.patchCallback(H,U,w[w.length-1],B,V),c&&(w[w.length-1]=u.context.bind(u.context.active(),w[w.length-1]));else if(typeof z?.callback==`function`){let p=h.patchCallback(n.getConfig(),U,z.callback,B,V);c&&(p=u.context.bind(u.context.active(),p)),w[0].callback=p}}let{requestHook:W}=H;typeof W==`function`&&z&&(0,c.safeExecuteInTheMiddle)(()=>{let{database:n,host:c,port:u,user:p}=this.connectionParameters;W(U,{connection:{database:n,host:c,port:u,user:p},query:{text:z.text,values:z.values,name:z.name}})},c=>{c&&n._diag.error(`Error running query hook`,c)},!0);let G;try{G=p.apply(this,w)}catch(n){throw n instanceof Error&&U.recordException(h.sanitizedErrorMessage(n)),U.setStatus({code:u.SpanStatusCode.ERROR,message:h.getErrorMessage(n)}),U.end(),n}return G instanceof Promise?G.then(c=>new Promise(u=>{h.handleExecutionResult(n.getConfig(),U,c),V(),U.end(),u(c)})).catch(n=>new Promise((c,p)=>{n instanceof Error&&U.recordException(h.sanitizedErrorMessage(n)),U.setStatus({code:u.SpanStatusCode.ERROR,message:n.message}),V(),U.end(),p(n)})):G})}_setPoolConnectEventListeners(n){if(n[p.EVENT_LISTENERS_SET])return;let c=h.getPoolName(n.options);n.on(`connect`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`acquire`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`remove`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n.on(`release`,()=>{this._connectionsCounter=h.updateCounter(c,n,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),n[p.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let n=this;return c=>function(p){let x=n.getConfig();if(h.shouldSkipInstrumentation(x)||(n._setPoolConnectEventListeners(this),x.ignoreConnectSpans))return c.call(this,p);let w=n.tracer.startSpan(T.SpanNames.POOL_CONNECT,{kind:u.SpanKind.CLIENT,attributes:h.getSemanticAttributesFromPoolConnection(this.options,n._semconvStability)});if(p){let n=u.trace.getSpan(u.context.active());p=h.patchCallbackPGPool(w,p),n&&(p=u.context.bind(u.context.active(),p))}return I(w,u.context.with(u.trace.setSpan(u.context.active(),w),()=>c.call(this,p)))}}};function I(n,c){if(!(c instanceof Promise))return c;let p=c;return u.context.bind(u.context.active(),p.then(c=>(n.end(),c)).catch(c=>(c instanceof Error&&n.recordException(h.sanitizedErrorMessage(c)),n.setStatus({code:u.SpanStatusCode.ERROR,message:h.getErrorMessage(c)}),n.end(),Promise.reject(c))))}})),require_src$33=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=n.PgInstrumentation=void 0;var c=require_instrumentation$9();Object.defineProperty(n,`PgInstrumentation`,{enumerable:!0,get:function(){return c.PgInstrumentation}});var u=require_AttributeNames$3();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}})})),import_src$23=require_src$33();const INTEGRATION_NAME$11=`Postgres`,instrumentPostgres=generateInstrumentOnce(INTEGRATION_NAME$11,import_src$23.PgInstrumentation,n=>({requireParentSpan:!0,requestHook(n){addOriginToSpan(n,`auto.db.otel.postgres`)},ignoreConnectSpans:n?.ignoreConnectSpans??!1})),_postgresIntegration=(n=>({name:INTEGRATION_NAME$11,setupOnce(){instrumentPostgres(n)}})),postgresIntegration=defineIntegration(_postgresIntegration);init_esm$2(),init_esm$1();const INTEGRATION_NAME$10=`PostgresJs`,SUPPORTED_VERSIONS$1=[`>=3.0.0 <4`],SQL_OPERATION_REGEX=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,QUERY_FROM_INSTRUMENTED_SQL=Symbol.for(`sentry.query.from.instrumented.sql`),instrumentPostgresJs=generateInstrumentOnce(INTEGRATION_NAME$10,n=>new PostgresJsInstrumentation({requireParentSpan:n?.requireParentSpan??!0,requestHook:n?.requestHook}));var PostgresJsInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n){super(`sentry-postgres-js`,SDK_VERSION,n)}init(){let n=new import_src$35.InstrumentationNodeModuleDefinition(`postgres`,SUPPORTED_VERSIONS$1,n=>{try{return this._patchPostgres(n)}catch(c){return DEBUG_BUILD&&debug.error(`Failed to patch postgres module:`,c),n}},n=>n);return[`src`,`cf/src`,`cjs/src`].forEach(c=>{n.files.push(new import_src$35.InstrumentationNodeModuleFile(`postgres/${c}/query.js`,SUPPORTED_VERSIONS$1,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),n}_patchPostgres(n){let c=typeof n==`function`,u=c?n:n.default;if(typeof u!=`function`)return DEBUG_BUILD&&debug.warn(`postgres module does not export a function. Skipping instrumentation.`),n;let p=this,h=function(...n){let c=Reflect.construct(u,n);if(!c||typeof c!=`function`)return DEBUG_BUILD&&debug.warn(`postgres() did not return a valid instance`),c;let h=p.getConfig();return instrumentPostgresJsSql(c,{requireParentSpan:h.requireParentSpan,requestHook:h.requestHook})};Object.setPrototypeOf(h,u),Object.setPrototypeOf(h.prototype,u.prototype);for(let n of Object.getOwnPropertyNames(u))if(![`length`,`name`,`prototype`].includes(n)){let c=Object.getOwnPropertyDescriptor(u,n);c&&Object.defineProperty(h,n,c)}return c?h:(replaceExports(n,`default`,h),n)}_shouldCreateSpans(){let n=this.getConfig();return trace.getSpan(context$1.active())!==void 0||!n.requireParentSpan}_setOperationName(n,c,u){if(u){n.setAttribute(ATTR_DB_OPERATION_NAME,u);return}let p=c?.match(SQL_OPERATION_REGEX);p?.[1]&&n.setAttribute(ATTR_DB_OPERATION_NAME,p[1].toUpperCase())}_reconstructQuery(n){if(n?.length)return n.length===1?n[0]||void 0:n.reduce((n,c,u)=>u===0?c:`${n}$${u}${c}`,``)}_sanitizeSqlQuery(n){return n?n.replace(/--.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``).replace(/;\s*$/,``).replace(/\s+/g,` `).trim().replace(/\bX'[0-9A-Fa-f]*'/gi,`?`).replace(/\bB'[01]*'/gi,`?`).replace(/'(?:[^']|'')*'/g,`?`).replace(/\b0x[0-9A-Fa-f]+/gi,`?`).replace(/\b(?:TRUE|FALSE)\b/gi,`?`).replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,`?`).replace(/-?\b\d+\.\d+\b/g,`?`).replace(/-?\.\d+\b/g,`?`).replace(/(?<!\$)-?\b\d+\b/g,`?`).replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,`IN (?)`).replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,`IN ($?)`):`Unknown SQL Query`}_patchQueryPrototype(n){let c=this,u=n.Query.prototype.handle;return n.Query.prototype.handle=async function(...n){if(this[QUERY_FROM_INSTRUMENTED_SQL]||!c._shouldCreateSpans())return u.apply(this,n);let p=c._reconstructQuery(this.strings),h=c._sanitizeSqlQuery(p);return startSpanManual$1({name:h||`postgresjs.query`,op:`db`},p=>{addOriginToSpan(p,`auto.db.postgresjs`),p.setAttributes({[ATTR_DB_SYSTEM_NAME]:`postgres`,[ATTR_DB_QUERY_TEXT]:h});let{requestHook:x}=c.getConfig();x&&(0,import_src$35.safeExecuteInTheMiddle)(()=>x(p,h,void 0),n=>{n&&(p.setAttribute(`sentry.hook.error`,`requestHook failed`),DEBUG_BUILD&&debug.error(`Error in requestHook for ${INTEGRATION_NAME$10} integration:`,n))},!0);let w=this.resolve;this.resolve=new Proxy(w,{apply:(n,u,x)=>{try{c._setOperationName(p,h,x?.[0]?.command),p.end()}catch(n){DEBUG_BUILD&&debug.error(`Error ending span in resolve callback:`,n)}return Reflect.apply(n,u,x)}});let T=this.reject;this.reject=new Proxy(T,{apply:(n,u,x)=>{try{p.setStatus({code:2,message:x?.[0]?.message||`unknown_error`}),p.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE,x?.[0]?.code||`unknown`),p.setAttribute(ATTR_ERROR_TYPE,x?.[0]?.name||`unknown`),c._setOperationName(p,h),p.end()}catch(n){DEBUG_BUILD&&debug.error(`Error ending span in reject callback:`,n)}return Reflect.apply(n,u,x)}});try{return u.apply(this,n)}catch(n){throw p.setStatus({code:2,message:n instanceof Error?n.message:`unknown_error`}),p.end(),n}})},n.Query.prototype.handle.__sentry_original__=u,n}_unpatchQueryPrototype(n){return n.Query.prototype.handle.__sentry_original__&&(n.Query.prototype.handle=n.Query.prototype.handle.__sentry_original__),n}};const _postgresJsIntegration=(n=>({name:INTEGRATION_NAME$10,setupOnce(){instrumentPostgresJs(n)}})),postgresJsIntegration=defineIntegration(_postgresJsIntegration);var require_LogRecord$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SeverityNumber=void 0,(function(n){n[n.UNSPECIFIED=0]=`UNSPECIFIED`,n[n.TRACE=1]=`TRACE`,n[n.TRACE2=2]=`TRACE2`,n[n.TRACE3=3]=`TRACE3`,n[n.TRACE4=4]=`TRACE4`,n[n.DEBUG=5]=`DEBUG`,n[n.DEBUG2=6]=`DEBUG2`,n[n.DEBUG3=7]=`DEBUG3`,n[n.DEBUG4=8]=`DEBUG4`,n[n.INFO=9]=`INFO`,n[n.INFO2=10]=`INFO2`,n[n.INFO3=11]=`INFO3`,n[n.INFO4=12]=`INFO4`,n[n.WARN=13]=`WARN`,n[n.WARN2=14]=`WARN2`,n[n.WARN3=15]=`WARN3`,n[n.WARN4=16]=`WARN4`,n[n.ERROR=17]=`ERROR`,n[n.ERROR2=18]=`ERROR2`,n[n.ERROR3=19]=`ERROR3`,n[n.ERROR4=20]=`ERROR4`,n[n.FATAL=21]=`FATAL`,n[n.FATAL2=22]=`FATAL2`,n[n.FATAL3=23]=`FATAL3`,n[n.FATAL4=24]=`FATAL4`})(n.SeverityNumber||={})})),require_NoopLogger$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER=n.NoopLogger=void 0;var c=class{emit(n){}};n.NoopLogger=c,n.NOOP_LOGGER=new c})),require_NoopLoggerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NOOP_LOGGER_PROVIDER=n.NoopLoggerProvider=void 0;let c=require_NoopLogger$1();var u=class{getLogger(n,u,p){return new c.NoopLogger}};n.NoopLoggerProvider=u,n.NOOP_LOGGER_PROVIDER=new u})),require_ProxyLogger$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLogger=void 0;let c=require_NoopLogger$1();n.ProxyLogger=class{constructor(n,c,u,p){this._provider=n,this.name=c,this.version=u,this.options=p}emit(n){this._getLogger().emit(n)}_getLogger(){if(this._delegate)return this._delegate;let n=this._provider._getDelegateLogger(this.name,this.version,this.options);return n?(this._delegate=n,this._delegate):c.NOOP_LOGGER}}})),require_ProxyLoggerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ProxyLoggerProvider=void 0;let c=require_NoopLoggerProvider$1(),u=require_ProxyLogger$1();n.ProxyLoggerProvider=class{getLogger(n,c,p){var h;return this._getDelegateLogger(n,c,p)??new u.ProxyLogger(this,n,c,p)}_getDelegate(){var n;return this._delegate??c.NOOP_LOGGER_PROVIDER}_setDelegate(n){this._delegate=n}_getDelegateLogger(n,c,u){var p;return this._delegate?.getLogger(n,c,u)}}})),require_globalThis$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=typeof globalThis==`object`?globalThis:global})),require_node$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0;var c=require_globalThis$7();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}})})),require_platform$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0;var c=require_node$20();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}})})),require_global_utils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.API_BACKWARDS_COMPATIBILITY_VERSION=n.makeGetter=n._global=n.GLOBAL_LOGS_API_KEY=void 0;let c=require_platform$20();n.GLOBAL_LOGS_API_KEY=Symbol.for(`io.opentelemetry.js.api.logs`),n._global=c._globalThis;function u(n,c,u){return p=>p===n?c:u}n.makeGetter=u,n.API_BACKWARDS_COMPATIBILITY_VERSION=1})),require_logs$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.LogsAPI=void 0;let c=require_global_utils$1(),u=require_NoopLoggerProvider$1(),p=require_ProxyLoggerProvider$1();n.LogsAPI=class n{constructor(){this._proxyLoggerProvider=new p.ProxyLoggerProvider}static getInstance(){return this._instance||=new n,this._instance}setGlobalLoggerProvider(n){return c._global[c.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(c._global[c.GLOBAL_LOGS_API_KEY]=(0,c.makeGetter)(c.API_BACKWARDS_COMPATIBILITY_VERSION,n,u.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(n),n)}getLoggerProvider(){var n,u;return c._global[c.GLOBAL_LOGS_API_KEY]?.call(c._global,c.API_BACKWARDS_COMPATIBILITY_VERSION)??this._proxyLoggerProvider}getLogger(n,c,u){return this.getLoggerProvider().getLogger(n,c,u)}disable(){delete c._global[c.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new p.ProxyLoggerProvider}}})),require_src$32=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.logs=n.ProxyLoggerProvider=n.ProxyLogger=n.NoopLoggerProvider=n.NOOP_LOGGER_PROVIDER=n.NoopLogger=n.NOOP_LOGGER=n.SeverityNumber=void 0;var c=require_LogRecord$1();Object.defineProperty(n,`SeverityNumber`,{enumerable:!0,get:function(){return c.SeverityNumber}});var u=require_NoopLogger$1();Object.defineProperty(n,`NOOP_LOGGER`,{enumerable:!0,get:function(){return u.NOOP_LOGGER}}),Object.defineProperty(n,`NoopLogger`,{enumerable:!0,get:function(){return u.NoopLogger}});var p=require_NoopLoggerProvider$1();Object.defineProperty(n,`NOOP_LOGGER_PROVIDER`,{enumerable:!0,get:function(){return p.NOOP_LOGGER_PROVIDER}}),Object.defineProperty(n,`NoopLoggerProvider`,{enumerable:!0,get:function(){return p.NoopLoggerProvider}});var h=require_ProxyLogger$1();Object.defineProperty(n,`ProxyLogger`,{enumerable:!0,get:function(){return h.ProxyLogger}});var x=require_ProxyLoggerProvider$1();Object.defineProperty(n,`ProxyLoggerProvider`,{enumerable:!0,get:function(){return x.ProxyLoggerProvider}}),n.logs=require_logs$3().LogsAPI.getInstance()})),require_autoLoaderUtils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.disableInstrumentations=n.enableInstrumentations=void 0;function c(n,c,u,p){for(let h=0,x=n.length;h<x;h++){let x=n[h];c&&x.setTracerProvider(c),u&&x.setMeterProvider(u),p&&x.setLoggerProvider&&x.setLoggerProvider(p),x.getConfig().enabled||x.enable()}}n.enableInstrumentations=c;function u(n){n.forEach(n=>n.disable())}n.disableInstrumentations=u})),require_autoLoader$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.registerInstrumentations=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$32(),p=require_autoLoaderUtils$1();function h(n){let h=n.tracerProvider||c.trace.getTracerProvider(),x=n.meterProvider||c.metrics.getMeterProvider(),w=n.loggerProvider||u.logs.getLoggerProvider(),T=n.instrumentations?.flat()??[];return(0,p.enableInstrumentations)(T,h,x,w),()=>{(0,p.disableInstrumentations)(T)}}n.registerInstrumentations=h})),require_semver$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.satisfies=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,p=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function x(n,u,p){if(!w(n))return c.diag.error(`Invalid version: ${n}`),!1;if(!u)return!0;u=u.replace(/([<>=~^]+)\s+/g,`$1`);let h=L(n);if(!h)return!1;let x=[],O=T(h,u,x,p);return O&&!p?.includePrerelease?j(h,x):O}n.satisfies=x;function w(n){return typeof n==`string`&&u.test(n)}function T(n,c,u,p){if(c.includes(`||`)){let h=c.trim().split(`||`);for(let c of h)if(O(n,c,u,p))return!0;return!1}else if(c.includes(` - `))c=ge(c,p);else if(c.includes(` `)){let h=c.trim().replace(/\s{2,}/g,` `).split(` `);for(let c of h)if(!O(n,c,u,p))return!1;return!0}return O(n,c,u,p)}function O(n,c,u,p){if(c=N(c,p),c.includes(` `))return T(n,c,u,p);{let p=z(c);return u.push(p),A(n,p)}}function A(n,c){if(c.invalid)return!1;if(!c.version||B(c.version))return!0;let u=W(n.versionSegments||[],c.versionSegments||[]);if(u===0){let p=n.prereleaseSegments||[],h=c.prereleaseSegments||[];u=!p.length&&!h.length?0:!p.length&&h.length?1:p.length&&!h.length?-1:W(p,h)}return h[c.op]?.includes(u)}function j(n,c){return n.prerelease?c.some(c=>c.prerelease&&c.version===n.version):!0}function N(n,c){return n=n.trim(),n=me(n,c),n=pe(n),n=he(n,c),n=n.trim(),n}function I(n){return!n||n.toLowerCase()===`x`||n===`*`}function L(n){let p=n.match(u);if(!p){c.diag.error(`Invalid version: ${n}`);return}let h=p.groups.version,x=p.groups.prerelease,w=p.groups.build,T=h.split(`.`),O=x?.split(`.`);return{op:void 0,version:h,versionSegments:T,versionSegmentCount:T.length,prerelease:x,prereleaseSegments:O,prereleaseSegmentCount:O?O.length:0,build:w}}function z(n){if(!n)return{};let u=n.match(p);if(!u)return c.diag.error(`Invalid range: ${n}`),{invalid:!0};let h=u.groups.op,x=u.groups.version,w=u.groups.prerelease,T=u.groups.build,O=x.split(`.`),A=w?.split(`.`);return h===`==`&&(h=`=`),{op:h||`=`,version:x,versionSegments:O,versionSegmentCount:O.length,prerelease:w,prereleaseSegments:A,prereleaseSegmentCount:A?A.length:0,build:T}}function B(n){return n===`*`||n===`x`||n===`X`}function V(n){let c=parseInt(n,10);return isNaN(c)?n:c}function H(n,c){if(typeof n==typeof c){if(typeof n==`number`||typeof n==`string`)return[n,c];throw Error(`Version segments can only be strings or numbers`)}else return[String(n),String(c)]}function U(n,c){if(B(n)||B(c))return 0;let[u,p]=H(V(n),V(c));return u>p?1:u<p?-1:0}function W(n,c){for(let u=0;u<Math.max(n.length,c.length);u++){let p=U(n[u]||`0`,c[u]||`0`);if(p!==0)return p}return 0}let G=`[a-zA-Z0-9-]`,K=`0|[1-9]\\d*`,ee=`\\d*[a-zA-Z-]${G}*`,te=`((?:<|>)?=?)`,J=`(?:${K}|${ee})`,Y=`(?:-(${J}(?:\\.${J})*))`,ne=`${G}+`,re=`(?:\\+(${ne}(?:\\.${ne})*))`,X=`${K}|x|X|\\*`,ie=`[v=\\s]*(${X})(?:\\.(${X})(?:\\.(${X})(?:${Y})?${re}?)?)?`,ae=`^((?:<|>)?=?)\\s*${ie}$`,oe=new RegExp(ae),se=`^\\s*(${ie})\\s+-\\s+(${ie})\\s*$`,ce=new RegExp(se),le=`^(?:~>?)${ie}$`,ue=new RegExp(le),de=`^(?:\\^)${ie}$`,fe=new RegExp(de);function pe(n){let c=ue;return n.replace(c,(n,c,u,p,h)=>{let x;return x=I(c)?``:I(u)?`>=${c}.0.0 <${+c+1}.0.0-0`:I(p)?`>=${c}.${u}.0 <${c}.${+u+1}.0-0`:h?`>=${c}.${u}.${p}-${h} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${p} <${c}.${+u+1}.0-0`,x})}function me(n,c){let u=fe,p=c?.includePrerelease?`-0`:``;return n.replace(u,(n,c,u,h,x)=>{let w;return w=I(c)?``:I(u)?`>=${c}.0.0${p} <${+c+1}.0.0-0`:I(h)?c===`0`?`>=${c}.${u}.0${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.0${p} <${+c+1}.0.0-0`:x?c===`0`?u===`0`?`>=${c}.${u}.${h}-${x} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}-${x} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h}-${x} <${+c+1}.0.0-0`:c===`0`?u===`0`?`>=${c}.${u}.${h}${p} <${c}.${u}.${+h+1}-0`:`>=${c}.${u}.${h}${p} <${c}.${+u+1}.0-0`:`>=${c}.${u}.${h} <${+c+1}.0.0-0`,w})}function he(n,c){let u=oe;return n.replace(u,(n,u,p,h,x,w)=>{let T=I(p),O=T||I(h),A=O||I(x),j=A;return u===`=`&&j&&(u=``),w=c?.includePrerelease?`-0`:``,T?n=u===`>`||u===`<`?`<0.0.0-0`:`*`:u&&j?(O&&(h=0),x=0,u===`>`?(u=`>=`,O?(p=+p+1,h=0,x=0):(h=+h+1,x=0)):u===`<=`&&(u=`<`,O?p=+p+1:h=+h+1),u===`<`&&(w=`-0`),n=`${u+p}.${h}.${x}${w}`):O?n=`>=${p}.0.0${w} <${+p+1}.0.0-0`:A&&(n=`>=${p}.${h}.0${w} <${p}.${+h+1}.0-0`),n})}function ge(n,c){let u=ce;return n.replace(u,(n,u,p,h,x,w,T,O,A,j,N,L)=>(u=I(p)?``:I(h)?`>=${p}.0.0${c?.includePrerelease?`-0`:``}`:I(x)?`>=${p}.${h}.0${c?.includePrerelease?`-0`:``}`:w?`>=${u}`:`>=${u}${c?.includePrerelease?`-0`:``}`,O=I(A)?``:I(j)?`<${+A+1}.0.0-0`:I(N)?`<${A}.${+j+1}.0-0`:L?`<=${A}.${j}.${N}-${L}`:c?.includePrerelease?`<${A}.${j}.${+N+1}-0`:`<=${O}`,`${u} ${O}`.trim()))}})),require_shimmer$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.massUnwrap=n.unwrap=n.massWrap=n.wrap=void 0;let c=console.error.bind(console);function u(n,c,u){let p=!!n[c]&&Object.prototype.propertyIsEnumerable.call(n,c);Object.defineProperty(n,c,{configurable:!0,enumerable:p,writable:!0,value:u})}n.wrap=(n,p,h)=>{if(!n||!n[p]){c(`no original function `+String(p)+` to wrap`);return}if(!h){c(`no wrapper function`),c(Error().stack);return}let x=n[p];if(typeof x!=`function`||typeof h!=`function`){c(`original object and wrapper must be functions`);return}let w=h(x,p);return u(w,`__original`,x),u(w,`__unwrap`,()=>{n[p]===w&&u(n,p,x)}),u(w,`__wrapped`,!0),u(n,p,w),w},n.massWrap=(u,p,h)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to wrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.wrap)(c,u,h)})})},n.unwrap=(n,u)=>{if(!n||!n[u]){c(`no function to unwrap.`),c(Error().stack);return}let p=n[u];if(!p.__unwrap)c(`no original to unwrap to -- has `+String(u)+` already been unwrapped?`);else{p.__unwrap();return}},n.massUnwrap=(u,p)=>{if(u)Array.isArray(u)||(u=[u]);else{c(`must provide one or more modules to patch`),c(Error().stack);return}if(!(p&&Array.isArray(p))){c(`must provide one or more functions to unwrap on modules`);return}u.forEach(c=>{p.forEach(u=>{(0,n.unwrap)(c,u)})})};function p(n){n&&n.logger&&(typeof n.logger==`function`?c=n.logger:c(`new logger isn't a function, not replacing`))}n.default=p,p.wrap=n.wrap,p.massWrap=n.massWrap,p.unwrap=n.unwrap,p.massUnwrap=n.massUnwrap})),require_instrumentation$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationAbstract=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$32(),p=require_shimmer$1();n.InstrumentationAbstract=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(n,p,h){this.instrumentationName=n,this.instrumentationVersion=p,this.setConfig(h),this._diag=c.diag.createComponentLogger({namespace:n}),this._tracer=c.trace.getTracer(n,p),this._meter=c.metrics.getMeter(n,p),this._logger=u.logs.getLogger(n,p),this._updateMetricInstruments()}_wrap=p.wrap;_unwrap=p.unwrap;_massWrap=p.massWrap;_massUnwrap=p.massUnwrap;get meter(){return this._meter}setMeterProvider(n){this._meter=n.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(n){this._logger=n.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let n=this.init()??[];return Array.isArray(n)?n:[n]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(n){this._config={enabled:!0,...n}}setTracerProvider(n){this._tracer=n.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(n,c,u,p){if(n)try{n(u,p)}catch(n){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:c},n)}}}})),require_ModuleNameTrie$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ModuleNameTrie=n.ModuleNameSeparator=void 0,n.ModuleNameSeparator=`/`;var c=class{hooks=[];children=new Map};n.ModuleNameTrie=class{_trie=new c;_counter=0;insert(u){let p=this._trie;for(let h of u.moduleName.split(n.ModuleNameSeparator)){let n=p.children.get(h);n||(n=new c,p.children.set(h,n)),p=n}p.hooks.push({hook:u,insertedId:this._counter++})}search(c,{maintainInsertionOrder:u,fullOnly:p}={}){let h=this._trie,x=[],w=!0;for(let u of c.split(n.ModuleNameSeparator)){let n=h.children.get(u);if(!n){w=!1;break}p||x.push(...n.hooks),h=n}return p&&w&&x.push(...h.hooks),x.length===0?[]:x.length===1?[x[0].hook]:(u&&x.sort((n,c)=>n.insertedId-c.insertedId),x.map(({hook:n})=>n))}}})),require_RequireInTheMiddleSingleton$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RequireInTheMiddleSingleton=void 0;let c=require_require_in_the_middle(),u=__require(`path`),p=require_ModuleNameTrie$1(),h=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(n=>typeof global[n]==`function`);n.RequireInTheMiddleSingleton=class n{_moduleNameTrie=new p.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new c.Hook(null,{internals:!0},(n,c,u)=>{let p=x(c),h=this._moduleNameTrie.search(p,{maintainInsertionOrder:!0,fullOnly:u===void 0});for(let{onRequire:p}of h)n=p(n,c,u);return n})}register(n,c){let u={moduleName:n,onRequire:c};return this._moduleNameTrie.insert(u),u}static getInstance(){return h?new n:this._instance=this._instance??new n}};function x(n){return u.sep===p.ModuleNameSeparator?n:n.split(u.sep).join(p.ModuleNameSeparator)}})),require_register=__commonJSMin$1((n=>{let c=[],u=new WeakMap,p=new WeakMap,h=new Map,x=[],w={set(n,c,p){let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p):!0},get(n,c){if(c===Symbol.toStringTag)return`Module`;let u=p.get(n)[c];if(typeof u==`function`)return u()},defineProperty(n,c,p){if(!(`value`in p))throw Error(`Getters/setters are not supported for exports property descriptors.`);let h=u.get(n),x=h&&h[c];return typeof x==`function`?x(p.value):!0}};function T(n,T,O,A,j){h.set(n,j),u.set(T,O),p.set(T,A);let N=new Proxy(T,w);c.forEach(c=>c(n,N,j)),x.push([n,N,j])}n.register=T,n.importHooks=c,n.specifiers=h,n.toHook=x})),require_import_in_the_middle=__commonJSMin$1(((n,c)=>{let u=__require(`path`),p=require_module_details_from_path(),{fileURLToPath:h}=__require(`url`),{MessageChannel:x}=__require(`worker_threads`),{isBuiltin:w}=__require(`module`);w||=()=>!0;let{importHooks:T,specifiers:O,toHook:A}=require_register();function j(n){T.push(n),A.forEach(([c,u,p])=>n(c,u,p))}function N(n){let c=T.indexOf(n);c>-1&&T.splice(c,1)}function I(n,c,u,p){let h=n(c,u,p);h&&h!==c&&`default`in c&&(c.default=h)}let L;function z(){let{port1:n,port2:c}=new x,u=0,p;L=c=>{u++,n.postMessage(c)},n.on(`message`,()=>{u--,p&&u<=0&&p()}).unref();function h(){let n=setInterval(()=>{},1e3),c=new Promise(n=>{p=n}).then(()=>{clearInterval(n)});return u===0&&p(),c}let w=c;return{registerOptions:{data:{addHookMessagePort:w,include:[]},transferList:[w]},addHookMessagePort:w,waitForAllMessagesAcknowledged:h}}function B(n,c,x){if(!(this instanceof B))return new B(n,c,x);typeof n==`function`?(x=n,n=null,c=null):typeof c==`function`&&(x=c,c=null);let T=c?c.internals===!0:!1;L&&Array.isArray(n)&&L(n),this._iitmHook=(c,A,j)=>{let N=c,L=N.startsWith(`node:`),z,B;if(L){let n=c.slice(5);w(n)&&(c=n)}else if(N.startsWith(`file://`)){let n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{z=h(c),c=z}catch{}if(Error.stackTraceLimit=n,z){let n=p(z);n&&(c=n.name,B=n.basedir)}}if(n)for(let p of n)if(z&&p===z)I(x,A,z,void 0);else if(p===c){if(!B)I(x,A,c,B);else if(B.endsWith(O.get(N)))I(x,A,c,B);else if(T){let n=c+u.sep+u.relative(B,z);I(x,A,n,B)}}else p===j&&I(x,A,j,B);else I(x,A,c,B)},j(this._iitmHook)}B.prototype.unhook=function(){N(this._iitmHook)},c.exports=B,c.exports.Hook=B,c.exports.addHook=j,c.exports.removeHook=N,c.exports.createAddHookMessageChannel=z})),require_utils$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isWrapped=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=void 0;function c(n,c,u){let p,h;try{h=n()}catch(n){p=n}finally{if(c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddle=c;async function u(n,c,u){let p,h;try{h=await n()}catch(n){p=n}finally{if(c(p,h),p&&!u)throw p;return h}}n.safeExecuteInTheMiddleAsync=u;function p(n){return typeof n==`function`&&typeof n.__original==`function`&&typeof n.__unwrap==`function`&&n.__wrapped===!0}n.isWrapped=p})),require_instrumentation$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationBase=void 0;let c=__require(`path`),u=__require(`util`),p=require_semver$1(),h=require_shimmer$1(),x=require_instrumentation$8(),w=require_RequireInTheMiddleSingleton$1(),T=require_import_in_the_middle(),O=(init_esm$2(),__toCommonJS(esm_exports$2)),A=require_require_in_the_middle(),j=__require(`fs`),N=require_utils$25();n.InstrumentationBase=class extends x.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=w.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(n,c,u){super(n,c,u);let p=this.init();p&&!Array.isArray(p)&&(p=[p]),this._modules=p||[],this._config.enabled&&this.enable()}_wrap=(n,c,p)=>{if((0,N.isWrapped)(n[c])&&this._unwrap(n,c),u.types.isProxy(n)){let u=(0,h.wrap)(Object.assign({},n),c,p);return Object.defineProperty(n,c,{value:u}),u}else return(0,h.wrap)(n,c,p)};_unwrap=(n,c)=>u.types.isProxy(n)?Object.defineProperty(n,c,{value:n[c]}):(0,h.unwrap)(n,c);_massWrap=(n,c,u)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._wrap(n,c,u)})})};_massUnwrap=(n,c)=>{if(n)Array.isArray(n)||(n=[n]);else{O.diag.error(`must provide one or more modules to patch`);return}if(!(c&&Array.isArray(c))){O.diag.error(`must provide one or more functions to wrap on modules`);return}n.forEach(n=>{c.forEach(c=>{this._unwrap(n,c)})})};_warnOnPreloadedModules(){this._modules.forEach(n=>{let{name:c}=n;try{let n=__require.resolve(c);__require.cache[n]&&this._diag.warn(`Module ${c} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${c}`)}catch{}})}_extractPackageVersion(n){try{let u=(0,j.readFileSync)(c.join(n,`package.json`),{encoding:`utf8`}),p=JSON.parse(u).version;return typeof p==`string`?p:void 0}catch{O.diag.warn(`Failed extracting version`,n)}}_onRequire(n,u,p,h){if(!h)return typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:n.name}),n.patch(u)):u;let x=this._extractPackageVersion(h);if(n.moduleVersion=x,n.name===p)return I(n.supportedVersions,x,n.includePrerelease)&&typeof n.patch==`function`&&(n.moduleExports=u,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:n.name,version:n.moduleVersion,baseDir:h}),n.patch(u,n.moduleVersion)):u;let w=n.files??[],T=c.normalize(p);return w.filter(n=>n.name===T).filter(c=>I(c.supportedVersions,x,n.includePrerelease)).reduce((c,u)=>(u.moduleExports=c,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:n.name,version:n.moduleVersion,fileName:u.name,baseDir:h}),u.patch(c,n.moduleVersion)):c),u)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let n of this._modules){typeof n.patch==`function`&&n.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:n.name,version:n.moduleVersion}),n.patch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.patch(c.moduleExports,n.moduleVersion))}return}this._warnOnPreloadedModules();for(let n of this._modules){let u=(u,p,h)=>{if(!h&&c.isAbsolute(p)){let n=c.parse(p);p=n.name,h=n.dir}return this._onRequire(n,u,p,h)},p=(c,u,p)=>this._onRequire(n,c,u,p),h=c.isAbsolute(n.name)?new A.Hook([n.name],{internals:!0},p):this._requireInTheMiddleSingleton.register(n.name,p);this._hooks.push(h);let x=new T.Hook([n.name],{internals:!1},u);this._hooks.push(x)}}}disable(){if(this._enabled){this._enabled=!1;for(let n of this._modules){typeof n.unpatch==`function`&&n.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:n.name,version:n.moduleVersion}),n.unpatch(n.moduleExports,n.moduleVersion));for(let c of n.files)c.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:n.name,version:n.moduleVersion,fileName:c.name}),c.unpatch(c.moduleExports,n.moduleVersion))}}}isEnabled(){return this._enabled}};function I(n,c,u){return c===void 0?n.includes(`*`):n.some(n=>(0,p.satisfies)(c,n,{includePrerelease:u}))}})),require_normalize$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=void 0;var c=__require(`path`);Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_node$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_instrumentation$7();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}});var u=require_normalize$1();Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return u.normalize}})})),require_platform$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalize=n.InstrumentationBase=void 0;var c=require_node$19();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return c.InstrumentationBase}}),Object.defineProperty(n,`normalize`,{enumerable:!0,get:function(){return c.normalize}})})),require_instrumentationNodeModuleDefinition$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleDefinition=void 0,n.InstrumentationNodeModuleDefinition=class{name;supportedVersions;patch;unpatch;files;constructor(n,c,u,p,h){this.name=n,this.supportedVersions=c,this.patch=u,this.unpatch=p,this.files=h||[]}}})),require_instrumentationNodeModuleFile$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentationNodeModuleFile=void 0;let c=require_platform$19();n.InstrumentationNodeModuleFile=class{supportedVersions;patch;unpatch;name;constructor(n,u,p,h){this.supportedVersions=u,this.patch=p,this.unpatch=h,this.name=(0,c.normalize)(n)}}})),require_semconvStability$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=void 0;var c;(function(n){n[n.STABLE=1]=`STABLE`,n[n.OLD=2]=`OLD`,n[n.DUPLICATE=3]=`DUPLICATE`})(c=n.SemconvStability||={});function u(n,u){let p=c.OLD,h=u?.split(`,`).map(n=>n.trim()).filter(n=>n!==``);for(let u of h??[])if(u.toLowerCase()===n+`/dup`){p=c.DUPLICATE;break}else u.toLowerCase()===n&&(p=c.STABLE);return p}n.semconvStabilityFromStr=u})),require_src$31=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.semconvStabilityFromStr=n.SemconvStability=n.safeExecuteInTheMiddleAsync=n.safeExecuteInTheMiddle=n.isWrapped=n.InstrumentationNodeModuleFile=n.InstrumentationNodeModuleDefinition=n.InstrumentationBase=n.registerInstrumentations=void 0;var c=require_autoLoader$1();Object.defineProperty(n,`registerInstrumentations`,{enumerable:!0,get:function(){return c.registerInstrumentations}});var u=require_platform$19();Object.defineProperty(n,`InstrumentationBase`,{enumerable:!0,get:function(){return u.InstrumentationBase}});var p=require_instrumentationNodeModuleDefinition$1();Object.defineProperty(n,`InstrumentationNodeModuleDefinition`,{enumerable:!0,get:function(){return p.InstrumentationNodeModuleDefinition}});var h=require_instrumentationNodeModuleFile$1();Object.defineProperty(n,`InstrumentationNodeModuleFile`,{enumerable:!0,get:function(){return h.InstrumentationNodeModuleFile}});var x=require_utils$25();Object.defineProperty(n,`isWrapped`,{enumerable:!0,get:function(){return x.isWrapped}}),Object.defineProperty(n,`safeExecuteInTheMiddle`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddle}}),Object.defineProperty(n,`safeExecuteInTheMiddleAsync`,{enumerable:!0,get:function(){return x.safeExecuteInTheMiddleAsync}});var w=require_semconvStability$1();Object.defineProperty(n,`SemconvStability`,{enumerable:!0,get:function(){return w.SemconvStability}}),Object.defineProperty(n,`semconvStabilityFromStr`,{enumerable:!0,get:function(){return w.semconvStabilityFromStr}})}));init_esm$2();var import_src$22=require_src$31(),majorVersion={name:`@prisma/instrumentation-contract`,version:`7.6.0`,description:`Shared types and utilities for Prisma instrumentation`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.mts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation-contract`},bugs:`https://github.com/prisma/prisma/issues`,scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},files:[`dist`],sideEffects:!1,devDependencies:{"@opentelemetry/api":`1.9.0`},peerDependencies:{"@opentelemetry/api":`^1.8`}}.version.split(`.`)[0],GLOBAL_INSTRUMENTATION_KEY=`PRISMA_INSTRUMENTATION`,GLOBAL_VERSIONED_INSTRUMENTATION_KEY=`V${majorVersion}_PRISMA_INSTRUMENTATION`,globalThisWithPrismaInstrumentation=globalThis;function getGlobalTracingHelper(){let n=globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];return n?.helper?n.helper:globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]?.helper}function setGlobalTracingHelper(n){let c={helper:n};globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY]=c,globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]=c}function clearGlobalTracingHelper(){delete globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY],delete globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY]}var showAllTraces=process.env.PRISMA_SHOW_ALL_TRACES===`true`,nonSampledTraceParent=`00-10-10-00`;function engineSpanKindToOtelSpanKind(n){switch(n){case`client`:return SpanKind.CLIENT;default:return SpanKind.INTERNAL}}var ActiveTracingHelper=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:n,ignoreSpanTypes:c}){this.tracerProvider=n,this.ignoreSpanTypes=c}isEnabled(){return!0}getTraceParent(n){let c=trace.getSpanContext(n??context$1.active());return c?`00-${c.traceId}-${c.spanId}-0${c.traceFlags}`:nonSampledTraceParent}dispatchEngineSpans(n){let c=this.tracerProvider.getTracer(`prisma`),u=new Map,p=n.filter(n=>n.parentId===null);for(let h of p)dispatchEngineSpan(c,h,n,u,this.ignoreSpanTypes)}getActiveContext(){return context$1.active()}runInChildSpan(n,c){if(typeof n==`string`&&(n={name:n}),n.internal&&!showAllTraces)return c();let u=this.tracerProvider.getTracer(`prisma`),p=n.context??this.getActiveContext(),h=`prisma:client:${n.name}`;if(shouldIgnoreSpan(h,this.ignoreSpanTypes))return c();if(n.active===!1){let x=u.startSpan(h,n,p);return endSpan(x,c(x,p))}return u.startActiveSpan(h,n,n=>endSpan(n,c(n,p)))}};function dispatchEngineSpan(n,c,u,p,h){if(shouldIgnoreSpan(c.name,h))return;let x={attributes:c.attributes,kind:engineSpanKindToOtelSpanKind(c.kind),startTime:c.startTime};n.startActiveSpan(c.name,x,x=>{p.set(c.id,x.spanContext().spanId),c.links&&x.addLinks(c.links.flatMap(n=>{let c=p.get(n);return c?{context:{spanId:c,traceId:x.spanContext().traceId,traceFlags:x.spanContext().traceFlags}}:[]}));let w=u.filter(n=>n.parentId===c.id);for(let c of w)dispatchEngineSpan(n,c,u,p,h);x.end(c.endTime)})}function endSpan(n,c){return isPromiseLike(c)?c.then(c=>(n.end(),c),c=>{throw n.end(),c}):(n.end(),c)}function isPromiseLike(n){return n!=null&&typeof n.then==`function`}function shouldIgnoreSpan(n,c){return c.some(c=>typeof c==`string`?c===n:c.test(n))}var package_default2={name:`@prisma/instrumentation`,version:`7.6.0`,description:`OpenTelemetry compliant instrumentation for Prisma Client`,main:`dist/index.js`,module:`dist/index.mjs`,types:`dist/index.d.ts`,exports:{".":{require:{types:`./dist/index.d.ts`,default:`./dist/index.js`},import:{types:`./dist/index.d.ts`,default:`./dist/index.mjs`}}},license:`Apache-2.0`,homepage:`https://www.prisma.io`,repository:{type:`git`,url:`https://github.com/prisma/prisma.git`,directory:`packages/instrumentation`},bugs:`https://github.com/prisma/prisma/issues`,devDependencies:{"@opentelemetry/api":`1.9.0`,"@prisma/instrumentation-contract":`workspace:*`,"@types/node":`~20.19.24`,typescript:`5.4.5`},dependencies:{"@opentelemetry/instrumentation":`^0.207.0`},peerDependencies:{"@opentelemetry/api":`^1.8`},files:[`dist`],keywords:[`prisma`,`instrumentation`,`opentelemetry`,`otel`],scripts:{dev:`DEV=true tsx helpers/build.ts`,build:`tsx helpers/build.ts`,prepublishOnly:`pnpm run build`,test:`vitest run`},sideEffects:!1},VERSION$1=package_default2.version,NAME=package_default2.name,MODULE_NAME=`@prisma/client`,PrismaInstrumentation=class extends import_src$22.InstrumentationBase{tracerProvider;constructor(n={}){super(NAME,VERSION$1,n)}setTracerProvider(n){this.tracerProvider=n}init(){return[new import_src$22.InstrumentationNodeModuleDefinition(MODULE_NAME,[VERSION$1])]}enable(){let n=this._config;setGlobalTracingHelper(new ActiveTracingHelper({tracerProvider:this.tracerProvider??trace.getTracerProvider(),ignoreSpanTypes:n.ignoreSpanTypes??[]}))}disable(){clearGlobalTracingHelper()}isEnabled(){return getGlobalTracingHelper()!==void 0}};init_esm$2();const INTEGRATION_NAME$9=`Prisma`;function isPrismaV6TracingHelper(n){return!!n&&typeof n==`object`&&`dispatchEngineSpans`in n}function getPrismaTracingHelper(){let n=globalThis.PRISMA_INSTRUMENTATION;return n&&typeof n==`object`&&`helper`in n?n.helper:void 0}var SentryPrismaInteropInstrumentation=class extends PrismaInstrumentation{constructor(n){super(n?.instrumentationConfig)}enable(){super.enable();let n=getPrismaTracingHelper();isPrismaV6TracingHelper(n)&&(n.createEngineSpan=n=>{let c=trace.getTracer(`prismaV5Compatibility`),u=c._idGenerator;if(!u){consoleSandbox(()=>{console.warn(`[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!`)});return}try{n.spans.forEach(n=>{let p=engineSpanKindToOTELSpanKind(n.kind),h=n.parent_span_id,x=n.span_id,w=n.trace_id,T=n.links?.map(n=>({context:{traceId:n.trace_id,spanId:n.span_id,traceFlags:TraceFlags.SAMPLED}})),O=trace.setSpanContext(context$1.active(),{traceId:w,spanId:h,traceFlags:TraceFlags.SAMPLED});context$1.with(O,()=>{c._idGenerator={generateTraceId:()=>w,generateSpanId:()=>x},c.startSpan(n.name,{kind:p,links:T,startTime:n.start_time,attributes:n.attributes}).end(n.end_time),c._idGenerator=u})})}finally{c._idGenerator=u}})}};function engineSpanKindToOTELSpanKind(n){switch(n){case`client`:return SpanKind.CLIENT;default:return SpanKind.INTERNAL}}const instrumentPrisma=generateInstrumentOnce(INTEGRATION_NAME$9,n=>new SentryPrismaInteropInstrumentation(n)),prismaIntegration=defineIntegration(n=>({name:INTEGRATION_NAME$9,setupOnce(){instrumentPrisma(n)},setup(n){getPrismaTracingHelper()&&n.on(`spanStart`,n=>{let c=spanToJSON(n);c.description?.startsWith(`prisma:`)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.prisma`),(c.description===`prisma:engine:db_query`||c.description===`prisma:client:db_query`)&&c.data[`db.query.text`]&&n.updateName(c.data[`db.query.text`]),c.description===`prisma:engine:db_query`&&!c.data[`db.system`]&&n.setAttribute(`db.system`,`prisma`)})}}));var require_suppress_tracing$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$7();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6(),p=require_constants$7(),h=require_utils$24();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$6().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$15(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$16();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$6();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$6();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$6();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$18();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$18(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$6(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6(),p=require_TraceState$6();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$6(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$6();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$6();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$30=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$6();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$6();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$6();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$6();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$6();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$6();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$6();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$6();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$24();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$18();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$6();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$6();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$6();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$6();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$6();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$6();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$6();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$6();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$6();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$6();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$6()._export}})),require_version$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.60.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-hapi`})),require_internal_types$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.HapiLifecycleMethodNames=n.HapiLayerType=n.handlerPatched=n.HapiComponentName=void 0,n.HapiComponentName=`@hapi/hapi`,n.handlerPatched=Symbol(`hapi-handler-patched`),n.HapiLayerType={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},n.HapiLifecycleMethodNames=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`])})),require_semconv$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_HTTP_METHOD=void 0,n.ATTR_HTTP_METHOD=`http.method`})),require_AttributeNames$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.HAPI_TYPE=`hapi.type`,n.PLUGIN_NAME=`hapi.plugin.name`,n.EXT_TYPE=`server.ext.type`})(n.AttributeNames||={})})),require_utils$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getPluginFromInput=n.getExtMetadata=n.getRouteMetadata=n.isPatchableExtMethod=n.isDirectExtInput=n.isLifecycleExtEventObj=n.isLifecycleExtType=n.getPluginName=void 0;let c=(init_esm$1(),__toCommonJS(esm_exports$1)),u=require_semconv$15(),p=require_internal_types$3(),h=require_AttributeNames$2(),x=require_src$52();function w(n){return n.name?n.name:n.pkg.name}n.getPluginName=w,n.isLifecycleExtType=n=>typeof n==`string`&&p.HapiLifecycleMethodNames.has(n),n.isLifecycleExtEventObj=c=>{let u=c?.type;return u!==void 0&&(0,n.isLifecycleExtType)(u)},n.isDirectExtInput=c=>Array.isArray(c)&&c.length<=3&&(0,n.isLifecycleExtType)(c[0])&&typeof c[1]==`function`,n.isPatchableExtMethod=n=>!Array.isArray(n),n.getRouteMetadata=(n,w,T)=>{let O={[c.ATTR_HTTP_ROUTE]:n.path};w&x.SemconvStability.OLD&&(O[u.ATTR_HTTP_METHOD]=n.method),w&x.SemconvStability.STABLE&&(O[c.ATTR_HTTP_REQUEST_METHOD]=n.method);let A;return T?(O[h.AttributeNames.HAPI_TYPE]=p.HapiLayerType.PLUGIN,O[h.AttributeNames.PLUGIN_NAME]=T,A=`${T}: route - ${n.path}`):(O[h.AttributeNames.HAPI_TYPE]=p.HapiLayerType.ROUTER,A=`route - ${n.path}`),{attributes:O,name:A}},n.getExtMetadata=(n,c,u)=>{let x=`ext - ${n}`;return u&&u!==`method`&&(x=`ext - ${n} - ${u}`),c?{attributes:{[h.AttributeNames.EXT_TYPE]:n,[h.AttributeNames.HAPI_TYPE]:p.HapiLayerType.EXT,[h.AttributeNames.PLUGIN_NAME]:c},name:`${c}: ${x}`}:{attributes:{[h.AttributeNames.EXT_TYPE]:n,[h.AttributeNames.HAPI_TYPE]:p.HapiLayerType.EXT},name:x}},n.getPluginFromInput=n=>`plugin`in n?`plugin`in n.plugin?n.plugin.plugin:n.plugin:n})),require_instrumentation$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.HapiInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$30(),p=require_src$52(),h=require_version$14(),x=require_internal_types$3(),w=require_utils$23();n.HapiInstrumentation=class extends p.InstrumentationBase{_semconvStability;constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n),this._semconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new p.InstrumentationNodeModuleDefinition(x.HapiComponentName,[`>=17.0.0 <22`],n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;return(0,p.isWrapped)(c.server)||this._wrap(c,`server`,this._getServerPatch.bind(this)),(0,p.isWrapped)(c.Server)||this._wrap(c,`Server`,this._getServerPatch.bind(this)),c},n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;this._massUnwrap([c],[`server`,`Server`])})}_getServerPatch(n){let c=this,u=this;return function(p){let h=n.apply(this,[p]);return u._wrap(h,`route`,n=>c._getServerRoutePatch.bind(c)(n)),u._wrap(h,`ext`,n=>c._getServerExtPatch.bind(c)(n)),u._wrap(h,`register`,c._getServerRegisterPatch.bind(c)),h}}_getServerRegisterPatch(n){let c=this;return function(u,p){if(Array.isArray(u))for(let n of u){let u=(0,w.getPluginFromInput)(n);c._wrapRegisterHandler(u)}else{let n=(0,w.getPluginFromInput)(u);c._wrapRegisterHandler(n)}return n.apply(this,[u,p])}}_getServerExtPatch(n,c){let u=this;return function(...p){if(Array.isArray(p[0])){let h=p[0];for(let n=0;n<h.length;n++){let p=h[n];if((0,w.isLifecycleExtType)(p.type)){let x=p;x.method=u._wrapExtMethods(x.method,p.type,c),h[n]=x}}return n.apply(this,p)}else if((0,w.isDirectExtInput)(p)){let h=p,x=h[1],w=u._wrapExtMethods(x,h[0],c);return n.apply(this,[h[0],w,h[2]])}else if((0,w.isLifecycleExtEventObj)(p[0])){let h=p[0];return h.method=u._wrapExtMethods(h.method,h.type,c),n.call(this,h)}return n.apply(this,p)}}_getServerRoutePatch(n,c){let u=this;return function(p){if(Array.isArray(p))for(let n=0;n<p.length;n++){let h=u._wrapRouteHandler.call(u,p[n],c);p[n]=h}else p=u._wrapRouteHandler.call(u,p,c);return n.apply(this,[p])}}_wrapRegisterHandler(n){let c=this,u=(0,w.getPluginName)(n),p=n.register,h=this;n.register=function(n,x){return h._wrap(n,`route`,n=>c._getServerRoutePatch.bind(c)(n,u)),h._wrap(n,`ext`,n=>c._getServerExtPatch.bind(c)(n,u)),p.call(this,n,x)}}_wrapExtMethods(n,u,p){let h=this;if(n instanceof Array){for(let c=0;c<n.length;c++)n[c]=h._wrapExtMethods(n[c],u);return n}else if((0,w.isPatchableExtMethod)(n))return n[x.handlerPatched]===!0?n:(n[x.handlerPatched]=!0,async function(...x){if(c.trace.getSpan(c.context.active())===void 0)return await n.apply(this,x);let T=(0,w.getExtMetadata)(u,p,n.name),O=h.tracer.startSpan(T.name,{attributes:T.attributes});try{return await c.context.with(c.trace.setSpan(c.context.active(),O),n,void 0,...x)}catch(n){throw O.recordException(n),O.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),n}finally{O.end()}});return n}_wrapRouteHandler(n,p){let h=this;if(n[x.handlerPatched]===!0)return n;n[x.handlerPatched]=!0;let T=x=>async function(...T){if(c.trace.getSpan(c.context.active())===void 0)return await x.call(this,...T);let O=(0,u.getRPCMetadata)(c.context.active());O?.type===u.RPCType.HTTP&&(O.route=n.path);let A=(0,w.getRouteMetadata)(n,h._semconvStability,p),j=h.tracer.startSpan(A.name,{attributes:A.attributes});try{return await c.context.with(c.trace.setSpan(c.context.active(),j),()=>x.call(this,...T))}catch(n){throw j.recordException(n),j.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),n}finally{j.end()}};if(typeof n.handler==`function`)n.handler=T(n.handler);else if(typeof n.options==`function`){let c=n.options;n.options=function(n){let u=c(n);return typeof u.handler==`function`&&(u.handler=T(u.handler)),u}}else typeof n.options?.handler==`function`&&(n.options.handler=T(n.options.handler));return n}}})),require_src$29=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=n.HapiInstrumentation=void 0;var c=require_instrumentation$6();Object.defineProperty(n,`HapiInstrumentation`,{enumerable:!0,get:function(){return c.HapiInstrumentation}});var u=require_AttributeNames$2();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}})})),import_src$21=require_src$29();const INTEGRATION_NAME$8=`Hapi`,instrumentHapi=generateInstrumentOnce(INTEGRATION_NAME$8,()=>new import_src$21.HapiInstrumentation),_hapiIntegration=(()=>({name:INTEGRATION_NAME$8,setupOnce(){instrumentHapi()}})),hapiIntegration=defineIntegration(_hapiIntegration),AttributeNames={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},HonoTypes={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};init_esm$2();const PACKAGE_NAME=`@sentry/instrumentation-hono`,PACKAGE_VERSION=`0.0.1`;var HonoInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(PACKAGE_NAME,PACKAGE_VERSION,n)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`hono`,[`>=4.0.0 <5`],n=>this._patch(n))]}_patch(n){let c=this;class u extends n.Hono{constructor(...n){super(...n),c._wrap(this,`get`,c._patchHandler()),c._wrap(this,`post`,c._patchHandler()),c._wrap(this,`put`,c._patchHandler()),c._wrap(this,`delete`,c._patchHandler()),c._wrap(this,`options`,c._patchHandler()),c._wrap(this,`patch`,c._patchHandler()),c._wrap(this,`all`,c._patchHandler()),c._wrap(this,`on`,c._patchOnHandler()),c._wrap(this,`use`,c._patchMiddlewareHandler())}}try{n.Hono=u}catch{return{...n,Hono:u}}return n}_patchHandler(){let n=this;return function(c){return function(...u){if(typeof u[0]==`string`){let p=u[0];if(u.length===1)return c.apply(this,[p]);let h=u.slice(1);return c.apply(this,[p,...h.map(c=>n._wrapHandler(c))])}return c.apply(this,u.map(c=>n._wrapHandler(c)))}}}_patchOnHandler(){let n=this;return function(c){return function(...u){let p=u.slice(2);return c.apply(this,[...u.slice(0,2),...p.map(c=>n._wrapHandler(c))])}}}_patchMiddlewareHandler(){let n=this;return function(c){return function(...u){if(typeof u[0]==`string`){let p=u[0];if(u.length===1)return c.apply(this,[p]);let h=u.slice(1);return c.apply(this,[p,...h.map(c=>n._wrapHandler(c))])}return c.apply(this,u.map(c=>n._wrapHandler(c)))}}}_wrapHandler(n){let c=this;return function(u,p){if(!c.isEnabled())return n.apply(this,[u,p]);let h=u.req.path,x=c.tracer.startSpan(h);return context$1.with(trace.setSpan(context$1.active(),x),()=>c._safeExecute(()=>{let w=n.apply(this,[u,p]);if(isThenable(w))return w.then(u=>{let p=c._determineHandlerType(u);return x.setAttributes({[AttributeNames.HONO_TYPE]:p,[AttributeNames.HONO_NAME]:p===HonoTypes.REQUEST_HANDLER?h:n.name||`anonymous`}),c.getConfig().responseHook?.(x),u});{let u=c._determineHandlerType(w);return x.setAttributes({[AttributeNames.HONO_TYPE]:u,[AttributeNames.HONO_NAME]:u===HonoTypes.REQUEST_HANDLER?h:n.name||`anonymous`}),c.getConfig().responseHook?.(x),w}},()=>x.end(),n=>{c._handleError(x,n),x.end()}))}}_safeExecute(n,c,u){try{let p=n();return isThenable(p)?p.then(()=>c(),n=>u(n)):c(),p}catch(n){throw u(n),n}}_determineHandlerType(n){return n===void 0?HonoTypes.MIDDLEWARE:HonoTypes.REQUEST_HANDLER}_handleError(n,c){c instanceof Error&&(n.setStatus({code:SpanStatusCode.ERROR,message:c.message}),n.recordException(c))}};init_esm$1();const INTEGRATION_NAME$7=`Hono`;function addHonoSpanAttributes(n){let c=spanToJSON(n).data,u=c[AttributeNames.HONO_TYPE];if(c[`sentry.op`]||!u)return;n.setAttributes({[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:`auto.http.otel.hono`,[SEMANTIC_ATTRIBUTE_SENTRY_OP]:`${u}.hono`});let p=c[AttributeNames.HONO_NAME];if(typeof p==`string`&&n.updateName(p),getIsolationScope()===getDefaultIsolationScope()){DEBUG_BUILD&&debug.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let h=c[ATTR_HTTP_ROUTE],x=c[ATTR_HTTP_REQUEST_METHOD];typeof h==`string`&&typeof x==`string`&&getIsolationScope().setTransactionName(`${x} ${h}`)}const instrumentHono=generateInstrumentOnce(INTEGRATION_NAME$7,()=>new HonoInstrumentation({responseHook:n=>{addHonoSpanAttributes(n)}})),_honoIntegration=(()=>({name:INTEGRATION_NAME$7,setupOnce(){instrumentHono()}})),honoIntegration=defineIntegration(_honoIntegration);var require_types$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaLayerType=void 0,(function(n){n.ROUTER=`router`,n.MIDDLEWARE=`middleware`})(n.KoaLayerType||={})})),require_version$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.62.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-koa`})),require_AttributeNames$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AttributeNames=void 0,(function(n){n.KOA_TYPE=`koa.type`,n.KOA_NAME=`koa.name`})(n.AttributeNames||={})})),require_utils$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isLayerIgnored=n.getMiddlewareMetadata=void 0;let c=require_types$5(),u=require_AttributeNames$1(),p=(init_esm$1(),__toCommonJS(esm_exports$1));n.getMiddlewareMetadata=(n,h,x,w)=>x?{attributes:{[u.AttributeNames.KOA_NAME]:w?.toString(),[u.AttributeNames.KOA_TYPE]:c.KoaLayerType.ROUTER,[p.ATTR_HTTP_ROUTE]:w?.toString()},name:n._matchedRouteName||`router - ${w}`}:{attributes:{[u.AttributeNames.KOA_NAME]:h.name??`middleware`,[u.AttributeNames.KOA_TYPE]:c.KoaLayerType.MIDDLEWARE},name:`middleware - ${h.name}`},n.isLayerIgnored=(n,c)=>!!(Array.isArray(c?.ignoreLayersType)&&c?.ignoreLayersType?.includes(n))})),require_suppress_tracing$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$6();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5(),p=require_constants$6(),h=require_utils$21();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$5().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$12(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$14();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$5();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$5();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$5();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$17();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$17(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$5(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5(),p=require_TraceState$5();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$5(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$5();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$5();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$28=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$5();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$5();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$5();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$5();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$5();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$5();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$5();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$5();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$21();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$17();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$5();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$5();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$5();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$5();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$5();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$5();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$5();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$5();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$5();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$5();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$5()._export}})),require_internal_types$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.kLayerPatched=void 0,n.kLayerPatched=Symbol(`koa-layer-patched`)})),require_instrumentation$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_types$5(),h=require_version$13(),x=require_utils$22(),w=require_src$28(),T=require_internal_types$2();n.KoaInstrumentation=class extends u.InstrumentationBase{constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n)}init(){return new u.InstrumentationNodeModuleDefinition(`koa`,[`>=2.0.0 <4`],n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;return c==null?c:((0,u.isWrapped)(c.prototype.use)&&this._unwrap(c.prototype,`use`),this._wrap(c.prototype,`use`,this._getKoaUsePatch.bind(this)),n)},n=>{let c=n[Symbol.toStringTag]===`Module`?n.default:n;(0,u.isWrapped)(c.prototype.use)&&this._unwrap(c.prototype,`use`)})}_getKoaUsePatch(n){let c=this;return function(u){let p;return p=u.router?c._patchRouterDispatch(u):c._patchLayer(u,!1),n.apply(this,[p])}}_patchRouterDispatch(n){c.diag.debug(`Patching @koa/router dispatch`);let u=n.router?.stack??[];for(let n of u){let c=n.path,u=n.stack;for(let n=0;n<u.length;n++){let p=u[n];u[n]=this._patchLayer(p,!0,c)}}return n}_patchLayer(n,h,O){let A=h?p.KoaLayerType.ROUTER:p.KoaLayerType.MIDDLEWARE;return n[T.kLayerPatched]===!0||(0,x.isLayerIgnored)(A,this.getConfig())?n:n.constructor.name===`GeneratorFunction`||n.constructor.name===`AsyncGeneratorFunction`?(c.diag.debug(`ignoring generator-based Koa middleware layer`),n):(n[T.kLayerPatched]=!0,c.diag.debug(`patching Koa middleware layer`),async(p,T)=>{if(c.trace.getSpan(c.context.active())===void 0)return n(p,T);let j=(0,x.getMiddlewareMetadata)(p,n,h,O),N=this.tracer.startSpan(j.name,{attributes:j.attributes}),I=(0,w.getRPCMetadata)(c.context.active());I?.type===w.RPCType.HTTP&&p._matchedRoute&&(I.route=p._matchedRoute.toString());let{requestHook:L}=this.getConfig();L&&(0,u.safeExecuteInTheMiddle)(()=>L(N,{context:p,middlewareLayer:n,layerType:A}),n=>{n&&c.diag.error(`koa instrumentation: request hook failed`,n)},!0);let z=c.trace.setSpan(c.context.active(),N);return c.context.with(z,async()=>{try{return await n(p,T)}catch(n){throw N.recordException(n),n}finally{N.end()}})})}}})),require_src$27=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.KoaLayerType=n.AttributeNames=n.KoaInstrumentation=void 0;var c=require_instrumentation$5();Object.defineProperty(n,`KoaInstrumentation`,{enumerable:!0,get:function(){return c.KoaInstrumentation}});var u=require_AttributeNames$1();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}});var p=require_types$5();Object.defineProperty(n,`KoaLayerType`,{enumerable:!0,get:function(){return p.KoaLayerType}})})),import_src$20=require_src$27();init_esm$1();const INTEGRATION_NAME$6=`Koa`,instrumentKoa=generateInstrumentOnce(INTEGRATION_NAME$6,import_src$20.KoaInstrumentation,(n={})=>({ignoreLayersType:n.ignoreLayersType,requestHook(n,c){addOriginToSpan(n,`auto.http.otel.koa`);let u=spanToJSON(n).data,p=u[`koa.type`];p&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`${p}.koa`);let h=u[`koa.name`];if(typeof h==`string`&&n.updateName(h||`< unknown >`),getIsolationScope()===getDefaultIsolationScope()){DEBUG_BUILD&&debug.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let x=u[ATTR_HTTP_ROUTE],w=c.context?.request?.method?.toUpperCase()||`GET`;x&&getIsolationScope().setTransactionName(`${w} ${x}`)}})),_koaIntegration=((n={})=>({name:INTEGRATION_NAME$6,setupOnce(){instrumentKoa(n)}})),koaIntegration=defineIntegration(_koaIntegration);var require_suppress_tracing$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$5();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4(),p=require_constants$5(),h=require_utils$20();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$4().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$11(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$13();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$4();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$4();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$4();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$16();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$16(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$4(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4(),p=require_TraceState$4();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$4(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$4();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$4();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$26=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$4();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$4();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$4();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$4();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$4();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$4();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$4();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$4();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$20();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$16();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$4();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$4();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$4();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$4();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$4();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$4();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$4();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$4();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$4();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$4();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$4()._export}})),require_AttributeNames=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectNames=n.ConnectTypes=n.AttributeNames=void 0,(function(n){n.CONNECT_TYPE=`connect.type`,n.CONNECT_NAME=`connect.name`})(n.AttributeNames||={}),(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request_handler`})(n.ConnectTypes||={}),(function(n){n.MIDDLEWARE=`middleware`,n.REQUEST_HANDLER=`request handler`})(n.ConnectNames||={})})),require_version$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.57.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-connect`})),require_internal_types$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._LAYERS_STORE_PROPERTY=void 0,n._LAYERS_STORE_PROPERTY=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`)})),require_utils$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.generateRoute=n.replaceCurrentStackRoute=n.addNewStackLayer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_internal_types$1();n.addNewStackLayer=n=>{Array.isArray(n[u._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(n,u._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),n[u._LAYERS_STORE_PROPERTY].push(`/`);let p=n[u._LAYERS_STORE_PROPERTY].length;return()=>{p===n[u._LAYERS_STORE_PROPERTY].length?n[u._LAYERS_STORE_PROPERTY].pop():c.diag.warn(`Connect: Trying to pop the stack multiple time`)}},n.replaceCurrentStackRoute=(n,c)=>{c&&n[u._LAYERS_STORE_PROPERTY].splice(-1,1,c)},n.generateRoute=n=>n[u._LAYERS_STORE_PROPERTY].reduce((n,c)=>n.replace(/\/+$/,``)+c)})),require_instrumentation$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectInstrumentation=n.ANONYMOUS_NAME=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$26(),p=require_AttributeNames(),h=require_version$10(),x=require_src$52(),w=(init_esm$1(),__toCommonJS(esm_exports$1)),T=require_utils$19();n.ANONYMOUS_NAME=`anonymous`,n.ConnectInstrumentation=class extends x.InstrumentationBase{constructor(n={}){super(h.PACKAGE_NAME,h.PACKAGE_VERSION,n)}init(){return[new x.InstrumentationNodeModuleDefinition(`connect`,[`>=3.0.0 <4`],n=>this._patchConstructor(n))]}_patchApp(n){(0,x.isWrapped)(n.use)||this._wrap(n,`use`,this._patchUse.bind(this)),(0,x.isWrapped)(n.handle)||this._wrap(n,`handle`,this._patchHandle.bind(this))}_patchConstructor(n){let c=this;return function(...u){let p=n.apply(this,u);return c._patchApp(p),p}}_patchNext(n,c){return function(u){let p=n.apply(this,[u]);return c(),p}}_startSpan(c,u){let h,x,T;c?(h=p.ConnectTypes.REQUEST_HANDLER,T=p.ConnectNames.REQUEST_HANDLER,x=c):(h=p.ConnectTypes.MIDDLEWARE,T=p.ConnectNames.MIDDLEWARE,x=u.name||n.ANONYMOUS_NAME);let O=`${T} - ${x}`,A={attributes:{[w.ATTR_HTTP_ROUTE]:c.length>0?c:`/`,[p.AttributeNames.CONNECT_TYPE]:h,[p.AttributeNames.CONNECT_NAME]:x}};return this.tracer.startSpan(O,A)}_patchMiddleware(p,h){let x=this,w=h.length===4;function O(){if(!x.isEnabled())return h.apply(this,arguments);let[O,A,j]=w?[1,2,3]:[0,1,2],N=arguments[O],I=arguments[A],L=arguments[j];(0,T.replaceCurrentStackRoute)(N,p);let z=(0,u.getRPCMetadata)(c.context.active());p&&z?.type===u.RPCType.HTTP&&(z.route=(0,T.generateRoute)(N));let B=``;B=p?`request handler - ${p}`:`middleware - ${h.name||n.ANONYMOUS_NAME}`;let V=x._startSpan(p,h);x._diag.debug(`start span`,B);let H=!1;function U(){H?x._diag.debug(`span ${V.name} - already finished`):(H=!0,x._diag.debug(`finishing span ${V.name}`),V.end()),I.removeListener(`close`,U)}return I.addListener(`close`,U),arguments[j]=x._patchNext(L,U),h.apply(this,arguments)}return Object.defineProperty(O,`length`,{value:h.length,writable:!1,configurable:!0}),O}_patchUse(n){let c=this;return function(...u){let p=u[u.length-1],h=u[u.length-2]||``;return u[u.length-1]=c._patchMiddleware(h,p),n.apply(this,u)}}_patchHandle(n){let c=this;return function(){let[u,p]=[0,2],h=arguments[u],x=arguments[p],w=(0,T.addNewStackLayer)(h);return typeof x==`function`&&(arguments[p]=c._patchOut(x,w)),n.apply(this,arguments)}}_patchOut(n,c){return function(...u){return c(),Reflect.apply(n,this,u)}}}})),require_src$25=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConnectTypes=n.ConnectNames=n.AttributeNames=n.ANONYMOUS_NAME=n.ConnectInstrumentation=void 0;var c=require_instrumentation$4();Object.defineProperty(n,`ConnectInstrumentation`,{enumerable:!0,get:function(){return c.ConnectInstrumentation}}),Object.defineProperty(n,`ANONYMOUS_NAME`,{enumerable:!0,get:function(){return c.ANONYMOUS_NAME}});var u=require_AttributeNames();Object.defineProperty(n,`AttributeNames`,{enumerable:!0,get:function(){return u.AttributeNames}}),Object.defineProperty(n,`ConnectNames`,{enumerable:!0,get:function(){return u.ConnectNames}}),Object.defineProperty(n,`ConnectTypes`,{enumerable:!0,get:function(){return u.ConnectTypes}})})),import_src$19=require_src$25();const INTEGRATION_NAME$5=`Connect`,instrumentConnect=generateInstrumentOnce(INTEGRATION_NAME$5,()=>new import_src$19.ConnectInstrumentation),_connectIntegration=(()=>({name:INTEGRATION_NAME$5,setupOnce(){instrumentConnect()}})),connectIntegration=defineIntegration(_connectIntegration);var require_semconv$12=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DB_SYSTEM_VALUE_MSSQL=n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_DB_USER=n.ATTR_DB_SYSTEM=n.ATTR_DB_STATEMENT=n.ATTR_DB_SQL_TABLE=n.ATTR_DB_NAME=void 0,n.ATTR_DB_NAME=`db.name`,n.ATTR_DB_SQL_TABLE=`db.sql.table`,n.ATTR_DB_STATEMENT=`db.statement`,n.ATTR_DB_SYSTEM=`db.system`,n.ATTR_DB_USER=`db.user`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`,n.DB_SYSTEM_VALUE_MSSQL=`mssql`})),require_utils$18=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.once=n.getSpanName=void 0;function c(n,c,u,p){return n===`execBulkLoad`&&p&&c?`${n} ${p} ${c}`:n===`callProcedure`?c?`${n} ${u} ${c}`:`${n} ${u}`:c?`${n} ${c}`:`${n}`}n.getSpanName=c,n.once=n=>{let c=!1;return(...u)=>{if(!c)return c=!0,n(...u)}}})),require_version$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.33.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-tedious`})),require_instrumentation$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TediousInstrumentation=n.INJECTED_CTX=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`events`),p=require_src$52(),h=(init_esm$1(),__toCommonJS(esm_exports$1)),x=require_semconv$12(),w=require_utils$18(),T=require_version$9(),O=Symbol(`opentelemetry.instrumentation-tedious.current-database`);n.INJECTED_CTX=Symbol(`opentelemetry.instrumentation-tedious.context-info-injected`);let A=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function j(n){Object.defineProperty(this,O,{value:n,writable:!0})}n.TediousInstrumentation=class N extends p.InstrumentationBase{static COMPONENT=`tedious`;_netSemconvStability;_dbSemconvStability;constructor(n={}){super(T.PACKAGE_NAME,T.PACKAGE_VERSION,n),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,p.semconvStabilityFromStr)(`database`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new p.InstrumentationNodeModuleDefinition(N.COMPONENT,[`>=1.11.0 <20`],n=>{let c=n.Connection.prototype;for(let u of A)(0,p.isWrapped)(c[u])&&this._unwrap(c,u),this._wrap(c,u,this._patchQuery(u,n));return(0,p.isWrapped)(c.connect)&&this._unwrap(c,`connect`),this._wrap(c,`connect`,this._patchConnect),n},n=>{if(n===void 0)return;let c=n.Connection.prototype;for(let n of A)this._unwrap(c,n);this._unwrap(c,`connect`)})]}_patchConnect(n){return function(){return j.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,j),this.on(`databaseChange`,j),this.once(`end`,()=>{this.removeListener(`databaseChange`,j)}),n.apply(this,arguments)}}_buildTraceparent(n){let u=n.spanContext();return`00-${u.traceId}-${u.spanId}-0${Number(u.traceFlags||c.TraceFlags.NONE).toString(16)}`}_injectContextInfo(c,u,p){return new Promise(h=>{try{let x=new u.Request(`set context_info @opentelemetry_traceparent`,n=>{h()});Object.defineProperty(x,n.INJECTED_CTX,{value:!0});let w=Buffer.from(p,`utf8`);x.addParameter(`opentelemetry_traceparent`,u.TYPES.VarBinary,w,{length:w.length}),c.execSql(x)}catch{h()}})}_shouldInjectFor(n){return n===`execSql`||n===`execSqlBatch`||n===`callProcedure`||n===`execute`}_patchQuery(T,A){return j=>{let N=this;function I(I){if(I?.[n.INJECTED_CTX])return j.apply(this,arguments);if(!(I instanceof u.EventEmitter))return N._diag.warn(`Unexpected invocation of patched ${T} method. Span not recorded`),j.apply(this,arguments);let L=0,z=0,B=()=>z++,V=()=>L++,H=this[O],U=(n=>n.sqlTextOrProcedure===`sp_prepare`&&n.parametersByName?.stmt?.value?n.parametersByName.stmt.value:n.sqlTextOrProcedure)(I),W={};N._dbSemconvStability&p.SemconvStability.OLD&&(W[x.ATTR_DB_SYSTEM]=x.DB_SYSTEM_VALUE_MSSQL,W[x.ATTR_DB_NAME]=H,W[x.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,W[x.ATTR_DB_STATEMENT]=U,W[x.ATTR_DB_SQL_TABLE]=I.table),N._dbSemconvStability&p.SemconvStability.STABLE&&(W[h.ATTR_DB_NAMESPACE]=H,W[h.ATTR_DB_SYSTEM_NAME]=h.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,W[h.ATTR_DB_QUERY_TEXT]=U,W[h.ATTR_DB_COLLECTION_NAME]=I.table),N._netSemconvStability&p.SemconvStability.OLD&&(W[x.ATTR_NET_PEER_NAME]=this.config?.server,W[x.ATTR_NET_PEER_PORT]=this.config?.options?.port),N._netSemconvStability&p.SemconvStability.STABLE&&(W[h.ATTR_SERVER_ADDRESS]=this.config?.server,W[h.ATTR_SERVER_PORT]=this.config?.options?.port);let G=N.tracer.startSpan((0,w.getSpanName)(T,H,U,I.table),{kind:c.SpanKind.CLIENT,attributes:W}),K=(0,w.once)(n=>{I.removeListener(`done`,B),I.removeListener(`doneInProc`,B),I.removeListener(`doneProc`,V),I.removeListener(`error`,K),this.removeListener(`end`,K),G.setAttribute(`tedious.procedure_count`,L),G.setAttribute(`tedious.statement_count`,z),n&&G.setStatus({code:c.SpanStatusCode.ERROR,message:n.message}),G.end()});I.on(`done`,B),I.on(`doneInProc`,B),I.on(`doneProc`,V),I.once(`error`,K),this.on(`end`,K),typeof I.callback==`function`?N._wrap(I,`callback`,N._patchCallbackQuery(K)):N._diag.error(`Expected request.callback to be a function`);let ee=()=>c.context.with(c.trace.setSpan(c.context.active(),G),j,this,...arguments);if(!(N.getConfig().enableTraceContextPropagation&&N._shouldInjectFor(T)))return ee();let te=N._buildTraceparent(G);N._injectContextInfo(this,A,te).finally(ee)}return Object.defineProperty(I,`length`,{value:j.length,writable:!1}),I}}_patchCallbackQuery(n){return c=>function(u,p,h){return n(u),c.apply(this,arguments)}}}})),require_src$24=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TediousInstrumentation=void 0;var c=require_instrumentation$3();Object.defineProperty(n,`TediousInstrumentation`,{enumerable:!0,get:function(){return c.TediousInstrumentation}})})),import_src$18=require_src$24();const TEDIUS_INSTRUMENTED_METHODS=new Set([`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`]),INTEGRATION_NAME$4=`Tedious`,instrumentTedious=generateInstrumentOnce(INTEGRATION_NAME$4,()=>new import_src$18.TediousInstrumentation({})),_tediousIntegration=(()=>{let n;return{name:INTEGRATION_NAME$4,setupOnce(){n=instrumentWhenWrapped(instrumentTedious())},setup(c){n?.(()=>c.on(`spanStart`,n=>{let{description:c,data:u}=spanToJSON(n);if(!c||u[`db.system`]!==`mssql`)return;let p=c.split(` `)[0]||``;TEDIUS_INSTRUMENTED_METHODS.has(p)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.tedious`)}))}}}),tediousIntegration=defineIntegration(_tediousIntegration);var require_version$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.57.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-generic-pool`})),require_instrumentation$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GenericPoolInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=require_version$8(),h=`generic-pool`;n.GenericPoolInstrumentation=class extends u.InstrumentationBase{_isDisabled=!1;constructor(n={}){super(p.PACKAGE_NAME,p.PACKAGE_VERSION,n)}init(){return[new u.InstrumentationNodeModuleDefinition(h,[`>=3.0.0 <4`],n=>{let c=n.Pool;return(0,u.isWrapped)(c.prototype.acquire)&&this._unwrap(c.prototype,`acquire`),this._wrap(c.prototype,`acquire`,this._acquirePatcher.bind(this)),n},n=>{let c=n.Pool;return this._unwrap(c.prototype,`acquire`),n}),new u.InstrumentationNodeModuleDefinition(h,[`>=2.4.0 <3`],n=>{let c=n.Pool;return(0,u.isWrapped)(c.prototype.acquire)&&this._unwrap(c.prototype,`acquire`),this._wrap(c.prototype,`acquire`,this._acquireWithCallbacksPatcher.bind(this)),n},n=>{let c=n.Pool;return this._unwrap(c.prototype,`acquire`),n}),new u.InstrumentationNodeModuleDefinition(h,[`>=2.0.0 <2.4`],n=>(this._isDisabled=!1,(0,u.isWrapped)(n.Pool)&&this._unwrap(n,`Pool`),this._wrap(n,`Pool`,this._poolWrapper.bind(this)),n),n=>(this._isDisabled=!0,n))]}_acquirePatcher(n){let u=this;return function(...p){let h=c.context.active(),x=u.tracer.startSpan(`generic-pool.acquire`,{},h);return c.context.with(c.trace.setSpan(h,x),()=>n.call(this,...p).then(n=>(x.end(),n),n=>{throw x.recordException(n),x.end(),n}))}}_poolWrapper(n){let c=this;return function(){let u=n.apply(this,arguments);return c._wrap(u,`acquire`,c._acquireWithCallbacksPatcher.bind(c)),u}}_acquireWithCallbacksPatcher(n){let u=this;return function(p,h){if(u._isDisabled)return n.call(this,p,h);let x=c.context.active(),w=u.tracer.startSpan(`generic-pool.acquire`,{},x);return c.context.with(c.trace.setSpan(x,w),()=>{n.call(this,(n,c)=>{if(w.end(),p)return p(n,c)},h)})}}}})),require_src$23=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.GenericPoolInstrumentation=void 0;var c=require_instrumentation$2();Object.defineProperty(n,`GenericPoolInstrumentation`,{enumerable:!0,get:function(){return c.GenericPoolInstrumentation}})})),import_src$17=require_src$23();const INTEGRATION_NAME$3=`GenericPool`,instrumentGenericPool=generateInstrumentOnce(INTEGRATION_NAME$3,()=>new import_src$17.GenericPoolInstrumentation({})),_genericPoolIntegration=(()=>{let n;return{name:INTEGRATION_NAME$3,setupOnce(){n=instrumentWhenWrapped(instrumentGenericPool())},setup(c){n?.(()=>c.on(`spanStart`,n=>{let c=spanToJSON(n).description;(c===`generic-pool.aquire`||c===`generic-pool.acquire`)&&n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,`auto.db.otel.generic_pool`)}))}}}),genericPoolIntegration=defineIntegration(_genericPoolIntegration);var require_suppress_tracing$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$17=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants$4();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3(),p=require_constants$4(),h=require_utils$17();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler$3().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$7=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$11=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$7(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$11();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment$3();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis$3();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info$3();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$15();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$15(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators$3(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3(),p=require_TraceState$3();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge$3(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise$3();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing$3();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$22=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator$3();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock$3();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes$3();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler$3();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler$3();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time$3();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util$3();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult$3();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$17();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$15();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite$3();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator$3();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata$3();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing$3();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState$3();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge$3();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout$3();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url$3();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback$3();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration$3();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter$3()._export}})),require_semconv$10=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_NET_PEER_PORT=n.ATTR_NET_PEER_NAME=n.ATTR_MESSAGING_SYSTEM=n.ATTR_MESSAGING_OPERATION=void 0,n.ATTR_MESSAGING_OPERATION=`messaging.operation`,n.ATTR_MESSAGING_SYSTEM=`messaging.system`,n.ATTR_NET_PEER_NAME=`net.peer.name`,n.ATTR_NET_PEER_PORT=`net.peer.port`})),require_semconv_obsolete=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_MESSAGING_CONVERSATION_ID=n.OLD_ATTR_MESSAGING_MESSAGE_ID=n.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=n.ATTR_MESSAGING_URL=n.ATTR_MESSAGING_PROTOCOL_VERSION=n.ATTR_MESSAGING_PROTOCOL=n.MESSAGING_OPERATION_VALUE_PROCESS=n.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=n.ATTR_MESSAGING_DESTINATION_KIND=n.ATTR_MESSAGING_DESTINATION=void 0,n.ATTR_MESSAGING_DESTINATION=`messaging.destination`,n.ATTR_MESSAGING_DESTINATION_KIND=`messaging.destination_kind`,n.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=`messaging.rabbitmq.routing_key`,n.MESSAGING_OPERATION_VALUE_PROCESS=`process`,n.ATTR_MESSAGING_PROTOCOL=`messaging.protocol`,n.ATTR_MESSAGING_PROTOCOL_VERSION=`messaging.protocol_version`,n.ATTR_MESSAGING_URL=`messaging.url`,n.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=`topic`,n.OLD_ATTR_MESSAGING_MESSAGE_ID=`messaging.message_id`,n.ATTR_MESSAGING_CONVERSATION_ID=`messaging.conversation_id`})),require_types$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.DEFAULT_CONFIG=n.EndOperation=void 0,(function(n){n.AutoAck=`auto ack`,n.Ack=`ack`,n.AckAll=`ackAll`,n.Reject=`reject`,n.Nack=`nack`,n.NackAll=`nackAll`,n.ChannelClosed=`channel closed`,n.ChannelError=`channel error`,n.InstrumentationTimeout=`instrumentation timeout`})(n.EndOperation||={}),n.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}})),require_utils$16=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isConfirmChannelTracing=n.unmarkConfirmChannelTracing=n.markConfirmChannelTracing=n.getConnectionAttributesFromUrl=n.getConnectionAttributesFromServer=n.normalizeExchange=n.CONNECTION_ATTRIBUTES=n.CHANNEL_CONSUME_TIMEOUT_TIMER=n.CHANNEL_SPANS_NOT_ENDED=n.MESSAGE_STORED_SPAN=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$52(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_semconv$10(),x=require_semconv_obsolete();n.MESSAGE_STORED_SPAN=Symbol(`opentelemetry.amqplib.message.stored-span`),n.CHANNEL_SPANS_NOT_ENDED=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),n.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),n.CONNECTION_ATTRIBUTES=Symbol(`opentelemetry.amqplib.connection.attributes`);let w=(0,c.createContextKey)(`opentelemetry.amqplib.channel.is-confirm-channel`);n.normalizeExchange=n=>n===``?`<default>`:n;let T=n=>n.replace(/:[^:@/]*@/,`:***@`),O=(n,c)=>n||(c===`AMQP`?5672:5671),A=n=>{let c=n||`amqp`;return(c.endsWith(`:`)?c.substring(0,c.length-1):c).toUpperCase()},j=n=>n||`localhost`,N=(n,u,p,h)=>p?{[u]:p}:(c.diag.error(`amqplib instrumentation: could not extract connection attribute ${h} from user supplied url`,{url:n}),{});n.getConnectionAttributesFromServer=n=>{let c=n.serverProperties.product?.toLowerCase?.();return c?{[h.ATTR_MESSAGING_SYSTEM]:c}:{}},n.getConnectionAttributesFromUrl=(n,w)=>{let I={[x.ATTR_MESSAGING_PROTOCOL_VERSION]:`0.9.1`};if(n||=`amqp://localhost`,typeof n==`object`){let c=n,T=A(c?.protocol);Object.assign(I,{...N(n,x.ATTR_MESSAGING_PROTOCOL,T,`protocol`)});let L=j(c?.hostname);w&u.SemconvStability.OLD&&Object.assign(I,{...N(n,h.ATTR_NET_PEER_NAME,L,`hostname`)}),w&u.SemconvStability.STABLE&&Object.assign(I,{...N(n,p.ATTR_SERVER_ADDRESS,L,`hostname`)});let z=O(c.port,T);w&u.SemconvStability.OLD&&Object.assign(I,N(n,h.ATTR_NET_PEER_PORT,z,`port`)),w&u.SemconvStability.STABLE&&Object.assign(I,N(n,p.ATTR_SERVER_PORT,z,`port`))}else{let L=T(n);I[x.ATTR_MESSAGING_URL]=L;try{let n=new URL(L),c=A(n.protocol);Object.assign(I,{...N(L,x.ATTR_MESSAGING_PROTOCOL,c,`protocol`)});let T=j(n.hostname);w&u.SemconvStability.OLD&&Object.assign(I,{...N(L,h.ATTR_NET_PEER_NAME,T,`hostname`)}),w&u.SemconvStability.STABLE&&Object.assign(I,{...N(L,p.ATTR_SERVER_ADDRESS,T,`hostname`)});let z=O(n.port?parseInt(n.port):void 0,c);w&u.SemconvStability.OLD&&Object.assign(I,N(L,h.ATTR_NET_PEER_PORT,z,`port`)),w&u.SemconvStability.STABLE&&Object.assign(I,N(L,p.ATTR_SERVER_PORT,z,`port`))}catch(n){c.diag.error(`amqplib instrumentation: error while extracting connection details from connection url`,{censoredUrl:L,err:n})}}return I},n.markConfirmChannelTracing=n=>n.setValue(w,!0),n.unmarkConfirmChannelTracing=n=>n.deleteValue(w),n.isConfirmChannelTracing=n=>n.getValue(w)===!0})),require_version$6=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.PACKAGE_NAME=n.PACKAGE_VERSION=void 0,n.PACKAGE_VERSION=`0.61.0`,n.PACKAGE_NAME=`@opentelemetry/instrumentation-amqplib`})),require_amqplib=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AmqplibInstrumentation=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$22(),p=require_src$52(),h=require_semconv$10(),x=require_semconv_obsolete(),w=require_types$4(),T=require_utils$16(),O=require_version$6(),A=[`>=0.5.5 <1`];n.AmqplibInstrumentation=class extends p.InstrumentationBase{_netSemconvStability;constructor(n={}){super(O.PACKAGE_NAME,O.PACKAGE_VERSION,{...w.DEFAULT_CONFIG,...n}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,p.semconvStabilityFromStr)(`http`,process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(n={}){super.setConfig({...w.DEFAULT_CONFIG,...n})}init(){let n=new p.InstrumentationNodeModuleFile(`amqplib/lib/channel_model.js`,A,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),c=new p.InstrumentationNodeModuleFile(`amqplib/lib/callback_model.js`,A,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),u=new p.InstrumentationNodeModuleFile(`amqplib/lib/connect.js`,A,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new p.InstrumentationNodeModuleDefinition(`amqplib`,A,void 0,void 0,[n,u,c])}patchConnect(n){return n=this.unpatchConnect(n),(0,p.isWrapped)(n.connect)||this._wrap(n,`connect`,this.getConnectPatch.bind(this)),n}unpatchConnect(n){return(0,p.isWrapped)(n.connect)&&this._unwrap(n,`connect`),n}patchChannelModel(n,c){return(0,p.isWrapped)(n.Channel.prototype.publish)||this._wrap(n.Channel.prototype,`publish`,this.getPublishPatch.bind(this,c)),(0,p.isWrapped)(n.Channel.prototype.consume)||this._wrap(n.Channel.prototype,`consume`,this.getConsumePatch.bind(this,c)),(0,p.isWrapped)(n.Channel.prototype.ack)||this._wrap(n.Channel.prototype,`ack`,this.getAckPatch.bind(this,!1,w.EndOperation.Ack)),(0,p.isWrapped)(n.Channel.prototype.nack)||this._wrap(n.Channel.prototype,`nack`,this.getAckPatch.bind(this,!0,w.EndOperation.Nack)),(0,p.isWrapped)(n.Channel.prototype.reject)||this._wrap(n.Channel.prototype,`reject`,this.getAckPatch.bind(this,!0,w.EndOperation.Reject)),(0,p.isWrapped)(n.Channel.prototype.ackAll)||this._wrap(n.Channel.prototype,`ackAll`,this.getAckAllPatch.bind(this,!1,w.EndOperation.AckAll)),(0,p.isWrapped)(n.Channel.prototype.nackAll)||this._wrap(n.Channel.prototype,`nackAll`,this.getAckAllPatch.bind(this,!0,w.EndOperation.NackAll)),(0,p.isWrapped)(n.Channel.prototype.emit)||this._wrap(n.Channel.prototype,`emit`,this.getChannelEmitPatch.bind(this)),(0,p.isWrapped)(n.ConfirmChannel.prototype.publish)||this._wrap(n.ConfirmChannel.prototype,`publish`,this.getConfirmedPublishPatch.bind(this,c)),n}unpatchChannelModel(n){return(0,p.isWrapped)(n.Channel.prototype.publish)&&this._unwrap(n.Channel.prototype,`publish`),(0,p.isWrapped)(n.Channel.prototype.consume)&&this._unwrap(n.Channel.prototype,`consume`),(0,p.isWrapped)(n.Channel.prototype.ack)&&this._unwrap(n.Channel.prototype,`ack`),(0,p.isWrapped)(n.Channel.prototype.nack)&&this._unwrap(n.Channel.prototype,`nack`),(0,p.isWrapped)(n.Channel.prototype.reject)&&this._unwrap(n.Channel.prototype,`reject`),(0,p.isWrapped)(n.Channel.prototype.ackAll)&&this._unwrap(n.Channel.prototype,`ackAll`),(0,p.isWrapped)(n.Channel.prototype.nackAll)&&this._unwrap(n.Channel.prototype,`nackAll`),(0,p.isWrapped)(n.Channel.prototype.emit)&&this._unwrap(n.Channel.prototype,`emit`),(0,p.isWrapped)(n.ConfirmChannel.prototype.publish)&&this._unwrap(n.ConfirmChannel.prototype,`publish`),n}getConnectPatch(n){let c=this;return function(u,p,h){return n.call(this,u,p,function(n,p){if(n==null){let n=(0,T.getConnectionAttributesFromUrl)(u,c._netSemconvStability),h=(0,T.getConnectionAttributesFromServer)(p);p[T.CONNECTION_ATTRIBUTES]={...n,...h}}h.apply(this,arguments)})}}getChannelEmitPatch(n){let c=this;return function(u){if(u===`close`){c.endAllSpansOnChannel(this,!0,w.EndOperation.ChannelClosed,void 0);let n=this[T.CHANNEL_CONSUME_TIMEOUT_TIMER];n&&clearInterval(n),this[T.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else u===`error`&&c.endAllSpansOnChannel(this,!0,w.EndOperation.ChannelError,void 0);return n.apply(this,arguments)}}getAckAllPatch(n,c,u){let p=this;return function(h){return p.endAllSpansOnChannel(this,n,c,h),u.apply(this,arguments)}}getAckPatch(n,c,u){let p=this;return function(h,x,O){let A=this,j=c===w.EndOperation.Reject?x:O,N=A[T.CHANNEL_SPANS_NOT_ENDED]??[],I=N.findIndex(n=>n.msg===h);if(I<0)p.endConsumerSpan(h,n,c,j);else if(c!==w.EndOperation.Reject&&x){for(let u=0;u<=I;u++)p.endConsumerSpan(N[u].msg,n,c,j);N.splice(0,I+1)}else p.endConsumerSpan(h,n,c,j),N.splice(I,1);return u.apply(this,arguments)}}getConsumePatch(n,O){let A=this;return function(j,N,I){let L=this;if(!Object.prototype.hasOwnProperty.call(L,T.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:n}=A.getConfig();if(n){let c=setInterval(()=>{A.checkConsumeTimeoutOnChannel(L)},n);c.unref(),L[T.CHANNEL_CONSUME_TIMEOUT_TIMER]=c}L[T.CHANNEL_SPANS_NOT_ENDED]=[]}let z=function(O){if(!O)return N.call(this,O);let z=O.properties.headers??{},B=c.propagation.extract(c.ROOT_CONTEXT,z),V=O.fields?.exchange,H;if(A._config.useLinksForConsume){let n=B?c.trace.getSpan(B)?.spanContext():void 0;B=void 0,n&&(H=[{context:n}])}let U=A.tracer.startSpan(`${j} process`,{kind:c.SpanKind.CONSUMER,attributes:{...L?.connection?.[T.CONNECTION_ATTRIBUTES],[x.ATTR_MESSAGING_DESTINATION]:V,[x.ATTR_MESSAGING_DESTINATION_KIND]:x.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[x.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:O.fields?.routingKey,[h.ATTR_MESSAGING_OPERATION]:x.MESSAGING_OPERATION_VALUE_PROCESS,[x.OLD_ATTR_MESSAGING_MESSAGE_ID]:O?.properties.messageId,[x.ATTR_MESSAGING_CONVERSATION_ID]:O?.properties.correlationId},links:H},B),{consumeHook:W}=A.getConfig();W&&(0,p.safeExecuteInTheMiddle)(()=>W(U,{moduleVersion:n,msg:O}),n=>{n&&c.diag.error(`amqplib instrumentation: consumerHook error`,n)},!0),I?.noAck||(L[T.CHANNEL_SPANS_NOT_ENDED].push({msg:O,timeOfConsume:(0,u.hrTime)()}),O[T.MESSAGE_STORED_SPAN]=U);let G=B||c.ROOT_CONTEXT;c.context.with(c.trace.setSpan(G,U),()=>{N.call(this,O)}),I?.noAck&&(A.callConsumeEndHook(U,O,!1,w.EndOperation.AutoAck),U.end())};return arguments[1]=z,O.apply(this,arguments)}}getConfirmedPublishPatch(n,u){let h=this;return function(x,w,O,A,j){let N=this,{span:I,modifiedOptions:L}=h.createPublishSpan(h,x,w,N,A),{publishHook:z}=h.getConfig();z&&(0,p.safeExecuteInTheMiddle)(()=>z(I,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:L,isConfirmChannel:!0}),n=>{n&&c.diag.error(`amqplib instrumentation: publishHook error`,n)},!0);let B=function(u,T){try{j?.call(this,u,T)}finally{let{publishConfirmHook:T}=h.getConfig();T&&(0,p.safeExecuteInTheMiddle)(()=>T(I,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:A,isConfirmChannel:!0,confirmError:u}),n=>{n&&c.diag.error(`amqplib instrumentation: publishConfirmHook error`,n)},!0),u&&I.setStatus({code:c.SpanStatusCode.ERROR,message:`message confirmation has been nack'ed`}),I.end()}},V=(0,T.markConfirmChannelTracing)(c.context.active()),H=[...arguments];return H[3]=L,H[4]=c.context.bind((0,T.unmarkConfirmChannelTracing)(c.trace.setSpan(V,I)),B),c.context.with(V,u.bind(this,...H))}}getPublishPatch(n,u){let h=this;return function(x,w,O,A){if((0,T.isConfirmChannelTracing)(c.context.active()))return u.apply(this,arguments);{let T=this,{span:j,modifiedOptions:N}=h.createPublishSpan(h,x,w,T,A),{publishHook:I}=h.getConfig();I&&(0,p.safeExecuteInTheMiddle)(()=>I(j,{moduleVersion:n,exchange:x,routingKey:w,content:O,options:N,isConfirmChannel:!1}),n=>{n&&c.diag.error(`amqplib instrumentation: publishHook error`,n)},!0);let L=[...arguments];L[3]=N;let z=u.apply(this,L);return j.end(),z}}}createPublishSpan(n,u,p,h,w){let O=(0,T.normalizeExchange)(u),A=n.tracer.startSpan(`publish ${O}`,{kind:c.SpanKind.PRODUCER,attributes:{...h.connection[T.CONNECTION_ATTRIBUTES],[x.ATTR_MESSAGING_DESTINATION]:u,[x.ATTR_MESSAGING_DESTINATION_KIND]:x.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[x.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p,[x.OLD_ATTR_MESSAGING_MESSAGE_ID]:w?.messageId,[x.ATTR_MESSAGING_CONVERSATION_ID]:w?.correlationId}}),j=w??{};return j.headers=j.headers??{},c.propagation.inject(c.trace.setSpan(c.context.active(),A),j.headers),{span:A,modifiedOptions:j}}endConsumerSpan(n,u,p,h){let x=n[T.MESSAGE_STORED_SPAN];x&&(u!==!1&&x.setStatus({code:c.SpanStatusCode.ERROR,message:p!==w.EndOperation.ChannelClosed&&p!==w.EndOperation.ChannelError?`${p} called on message${h===!0?` with requeue`:h===!1?` without requeue`:``}`:p}),this.callConsumeEndHook(x,n,u,p),x.end(),n[T.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(n,c,u,p){(n[T.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(n=>{this.endConsumerSpan(n.msg,c,u,p)}),n[T.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(n,u,h,x){let{consumeEndHook:w}=this.getConfig();w&&(0,p.safeExecuteInTheMiddle)(()=>w(n,{msg:u,rejected:h,endOperation:x}),n=>{n&&c.diag.error(`amqplib instrumentation: consumerEndHook error`,n)},!0)}checkConsumeTimeoutOnChannel(n){let c=(0,u.hrTime)(),p=n[T.CHANNEL_SPANS_NOT_ENDED]??[],h,{consumeTimeoutMs:x}=this.getConfig();for(h=0;h<p.length;h++){let n=p[h],T=(0,u.hrTimeDuration)(n.timeOfConsume,c);if((0,u.hrTimeToMilliseconds)(T)<x)break;this.endConsumerSpan(n.msg,null,w.EndOperation.InstrumentationTimeout,!0)}p.splice(0,h)}}})),require_src$21=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.EndOperation=n.DEFAULT_CONFIG=n.AmqplibInstrumentation=void 0;var c=require_amqplib();Object.defineProperty(n,`AmqplibInstrumentation`,{enumerable:!0,get:function(){return c.AmqplibInstrumentation}});var u=require_types$4();Object.defineProperty(n,`DEFAULT_CONFIG`,{enumerable:!0,get:function(){return u.DEFAULT_CONFIG}}),Object.defineProperty(n,`EndOperation`,{enumerable:!0,get:function(){return u.EndOperation}})})),import_src$16=require_src$21();const INTEGRATION_NAME$2=`Amqplib`,config$1={consumeEndHook:n=>{addOriginToSpan(n,`auto.amqplib.otel.consumer`)},publishHook:n=>{addOriginToSpan(n,`auto.amqplib.otel.publisher`)}},instrumentAmqplib=generateInstrumentOnce(INTEGRATION_NAME$2,()=>new import_src$16.AmqplibInstrumentation(config$1)),_amqplibIntegration=(()=>({name:INTEGRATION_NAME$2,setupOnce(){instrumentAmqplib()}})),amqplibIntegration=defineIntegration(_amqplibIntegration),INTEGRATION_NAME$1=`VercelAI`,SUPPORTED_VERSIONS=[`>=3.0.0 <7`],INSTRUMENTED_METHODS=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function isToolError(n){if(typeof n!=`object`||!n)return!1;let c=n;return`type`in c&&`error`in c&&`toolName`in c&&`toolCallId`in c&&c.type===`tool-error`&&c.error instanceof Error}function processToolCallResults(n){if(typeof n!=`object`||!n||!(`content`in n))return;let c=n;Array.isArray(c.content)&&(captureToolErrors(c.content),cleanupToolCallSpanContexts(c.content))}function captureToolErrors(n){for(let c of n){if(!isToolError(c))continue;let n=_INTERNAL_getSpanContextForToolCallId(c.toolCallId);withScope(n?u=>{u.setContext(`trace`,{trace_id:n.traceId,span_id:n.spanId}),u.setTag(`vercel.ai.tool.name`,c.toolName),u.setTag(`vercel.ai.tool.callId`,c.toolCallId),u.setLevel(`error`),captureException(c.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})}:n=>{n.setTag(`vercel.ai.tool.name`,c.toolName),n.setTag(`vercel.ai.tool.callId`,c.toolCallId),n.setLevel(`error`),captureException(c.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function cleanupToolCallSpanContexts(n){for(let c of n)typeof c==`object`&&c&&`toolCallId`in c&&typeof c.toolCallId==`string`&&_INTERNAL_cleanupToolCallSpanContext(c.toolCallId)}function determineRecordingSettings(n,c,u,p){return{recordInputs:n?.recordInputs===void 0?c.recordInputs===void 0?u===!0?!0:p:c.recordInputs:n.recordInputs,recordOutputs:n?.recordOutputs===void 0?c.recordOutputs===void 0?u===!0?!0:p:c.recordOutputs:n.recordOutputs}}var SentryVercelAiInstrumentation=class n extends import_src$35.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(c={}){super(`@sentry/instrumentation-vercel-ai`,SDK_VERSION,c),n.prototype.__init.call(this),n.prototype.__init2.call(this)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`ai`,SUPPORTED_VERSIONS,this._patch.bind(this))}callWhenPatched(n){this._isPatched?n():this._callbacks.push(n)}_patch(n){this._isPatched=!0,this._callbacks.forEach(n=>n()),this._callbacks=[];let c=n=>new Proxy(n,{apply:(n,c,u)=>{let p=u[0].experimental_telemetry||{},h=p.isEnabled,x=getClient(),w=x?.getIntegrationByName(INTEGRATION_NAME$1),T=w?.options,{recordInputs:O,recordOutputs:A}=determineRecordingSettings(T,p,h,w?!!x?.getOptions().sendDefaultPii:!1);return u[0].experimental_telemetry={...p,isEnabled:h===void 0?!0:h,recordInputs:O,recordOutputs:A},handleCallbackErrors(()=>Reflect.apply(n,c,u),n=>{n&&typeof n==`object`&&addNonEnumerableProperty(n,`_sentry_active_span`,getActiveSpan$1())},()=>{},n=>{processToolCallResults(n)})}});if(Object.prototype.toString.call(n)===`[object Module]`){for(let u of INSTRUMENTED_METHODS)n[u]!=null&&(n[u]=c(n[u]));return n}else{let u=INSTRUMENTED_METHODS.reduce((u,p)=>(n[p]!=null&&(u[p]=c(n[p])),u),{});return{...n,...u}}}};const instrumentVercelAi=generateInstrumentOnce(INTEGRATION_NAME$1,()=>new SentryVercelAiInstrumentation({}));function shouldForceIntegration(n){return!!n.getIntegrationByName(`Modules`)?.getModules?.()?.ai}const _vercelAIIntegration=((n={})=>{let c;return{name:INTEGRATION_NAME$1,options:n,setupOnce(){c=instrumentVercelAi()},afterAllSetup(u){n.force??shouldForceIntegration(u)?addVercelAiProcessors(u):c?.callWhenPatched(()=>addVercelAiProcessors(u))}}}),vercelAIIntegration=defineIntegration(_vercelAIIntegration),supportedVersions$4=[`>=4.0.0 <7`];var SentryOpenAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-openai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`openai`,supportedVersions$4,this._patch.bind(this))}_patch(n){let c=n;return c=this._patchClient(c,`OpenAI`),c=this._patchClient(c,`AzureOpenAI`),c}_patchClient(n,c){let u=n[c];if(!u)return n;let p=this.getConfig(),h=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`OpenAI`)?Reflect.construct(u,n):instrumentOpenAiClient(Reflect.construct(u,n),p)};Object.setPrototypeOf(h,u),Object.setPrototypeOf(h.prototype,u.prototype);for(let n of Object.getOwnPropertyNames(u))if(![`length`,`name`,`prototype`].includes(n)){let c=Object.getOwnPropertyDescriptor(u,n);c&&Object.defineProperty(h,n,c)}try{n[c]=h}catch{Object.defineProperty(n,c,{value:h,writable:!0,configurable:!0,enumerable:!0})}if(n.default===u)try{n.default=h}catch{Object.defineProperty(n,`default`,{value:h,writable:!0,configurable:!0,enumerable:!0})}return n}};const instrumentOpenAi=generateInstrumentOnce(OPENAI_INTEGRATION_NAME,n=>new SentryOpenAiInstrumentation(n)),_openAiIntegration=((n={})=>({name:OPENAI_INTEGRATION_NAME,setupOnce(){instrumentOpenAi(n)}})),openAIIntegration=defineIntegration(_openAiIntegration),supportedVersions$3=[`>=0.19.2 <1.0.0`];var SentryAnthropicAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-anthropic-ai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`@anthropic-ai/sdk`,supportedVersions$3,this._patch.bind(this))}_patch(n){let c=n.Anthropic,u=this.getConfig(),p=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`Anthropic_AI`)?Reflect.construct(c,n):instrumentAnthropicAiClient(Reflect.construct(c,n),u)};Object.setPrototypeOf(p,c),Object.setPrototypeOf(p.prototype,c.prototype);for(let n of Object.getOwnPropertyNames(c))if(![`length`,`name`,`prototype`].includes(n)){let u=Object.getOwnPropertyDescriptor(c,n);u&&Object.defineProperty(p,n,u)}try{n.Anthropic=p}catch{Object.defineProperty(n,`Anthropic`,{value:p,writable:!0,configurable:!0,enumerable:!0})}if(n.default===c)try{n.default=p}catch{Object.defineProperty(n,`default`,{value:p,writable:!0,configurable:!0,enumerable:!0})}return n}};const instrumentAnthropicAi=generateInstrumentOnce(ANTHROPIC_AI_INTEGRATION_NAME,n=>new SentryAnthropicAiInstrumentation(n)),_anthropicAIIntegration=((n={})=>({name:ANTHROPIC_AI_INTEGRATION_NAME,options:n,setupOnce(){instrumentAnthropicAi(n)}})),anthropicAIIntegration=defineIntegration(_anthropicAIIntegration),supportedVersions$2=[`>=0.10.0 <2`];var SentryGoogleGenAiInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-google-genai`,SDK_VERSION,n)}init(){return new import_src$35.InstrumentationNodeModuleDefinition(`@google/genai`,supportedVersions$2,n=>this._patch(n),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@google/genai/dist/node/index.cjs`,supportedVersions$2,n=>this._patch(n),n=>n)])}_patch(n){let c=n.GoogleGenAI,u=this.getConfig();if(typeof c!=`function`)return n;let p=function(...n){return _INTERNAL_shouldSkipAiProviderWrapping(`Google_GenAI`)?Reflect.construct(c,n):instrumentGoogleGenAIClient(Reflect.construct(c,n),u)};Object.setPrototypeOf(p,c),Object.setPrototypeOf(p.prototype,c.prototype);for(let n of Object.getOwnPropertyNames(c))if(![`length`,`name`,`prototype`].includes(n)){let u=Object.getOwnPropertyDescriptor(c,n);u&&Object.defineProperty(p,n,u)}return replaceExports(n,`GoogleGenAI`,p),n}};const instrumentGoogleGenAI=generateInstrumentOnce(GOOGLE_GENAI_INTEGRATION_NAME,n=>new SentryGoogleGenAiInstrumentation(n)),_googleGenAIIntegration=((n={})=>({name:GOOGLE_GENAI_INTEGRATION_NAME,setupOnce(){instrumentGoogleGenAI(n)}})),googleGenAIIntegration=defineIntegration(_googleGenAIIntegration),supportedVersions$1=[`>=0.1.0 <2.0.0`];function augmentCallbackHandlers(n,c){return n?Array.isArray(n)?n.includes(c)?n:[...n,c]:typeof n==`object`?[n,c]:n:[c]}function wrapRunnableMethod(n,c,u){return new Proxy(n,{apply(n,u,p){let h=1,x=p[1];(!x||typeof x!=`object`||Array.isArray(x))&&(x={},p[1]=x);let w=x.callbacks,T=augmentCallbackHandlers(w,c);return x.callbacks=T,Reflect.apply(n,u,p)}})}var SentryLangChainInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-langchain`,SDK_VERSION,n)}init(){let n=[];for(let c of[`@langchain/anthropic`,`@langchain/openai`,`@langchain/google-genai`,`@langchain/mistralai`,`@langchain/google-vertexai`,`@langchain/groq`])n.push(new import_src$35.InstrumentationNodeModuleDefinition(c,supportedVersions$1,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`${c}/dist/index.cjs`,supportedVersions$1,this._patch.bind(this),n=>n)]));return n.push(new import_src$35.InstrumentationNodeModuleDefinition(`langchain`,supportedVersions$1,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`langchain/dist/chat_models/universal.cjs`,supportedVersions$1,this._patch.bind(this),n=>n)])),n}_patch(n){_INTERNAL_skipAiProviderWrapping([OPENAI_INTEGRATION_NAME,ANTHROPIC_AI_INTEGRATION_NAME,GOOGLE_GENAI_INTEGRATION_NAME]);let c=this.getConfig(),u=createLangChainCallbackHandler(c);return this._patchRunnableMethods(n,u),this._patchEmbeddingsMethods(n,c),n}_patchRunnableMethods(n,c){let u=[`ChatAnthropic`,`ChatOpenAI`,`ChatGoogleGenerativeAI`,`ChatMistralAI`,`ChatVertexAI`,`ChatGroq`,`ConfigurableModel`],p=n.universal_exports??n,h=Object.values(p).find(n=>typeof n==`function`&&u.includes(n.name));if(!h)return;let x=h.prototype;if(!x.__sentry_patched__){x.__sentry_patched__=!0;for(let n of[`invoke`,`stream`,`batch`]){let u=x[n];typeof u==`function`&&(x[n]=wrapRunnableMethod(u,c))}}}_patchEmbeddingsMethods(n,c){let u=n.universal_exports??n;for(let n of Object.values(u)){if(typeof n!=`function`||!n.prototype)continue;let u=n.prototype;typeof u.embedQuery!=`function`||typeof u.embedDocuments!=`function`||u.__sentry_patched__||(u.__sentry_patched__=!0,instrumentLangChainEmbeddings(u,c))}}};const instrumentLangChain=generateInstrumentOnce(LANGCHAIN_INTEGRATION_NAME,n=>new SentryLangChainInstrumentation(n)),_langChainIntegration=((n={})=>({name:LANGCHAIN_INTEGRATION_NAME,setupOnce(){instrumentLangChain(n)}})),langChainIntegration=defineIntegration(_langChainIntegration),supportedVersions=[`>=0.0.0 <2.0.0`];var SentryLangGraphInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n={}){super(`@sentry/instrumentation-langgraph`,SDK_VERSION,n)}init(){return[new import_src$35.InstrumentationNodeModuleDefinition(`@langchain/langgraph`,supportedVersions,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/index.cjs`,supportedVersions,this._patch.bind(this),n=>n),new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/prebuilt/index.cjs`,supportedVersions,this._patch.bind(this),n=>n)]),new import_src$35.InstrumentationNodeModuleDefinition(`@langchain/langgraph/prebuilt`,supportedVersions,this._patch.bind(this),n=>n,[new import_src$35.InstrumentationNodeModuleFile(`@langchain/langgraph/dist/prebuilt/index.cjs`,supportedVersions,this._patch.bind(this),n=>n)])]}_patch(n){let c=getClient(),u={...this.getConfig(),recordInputs:this.getConfig().recordInputs??c?.getOptions().sendDefaultPii,recordOutputs:this.getConfig().recordOutputs??c?.getOptions().sendDefaultPii};if(n.StateGraph&&typeof n.StateGraph==`function`&&instrumentLangGraph$1(n.StateGraph.prototype,u),n.createReactAgent&&typeof n.createReactAgent==`function`){let c=n.createReactAgent;Object.defineProperty(n,`createReactAgent`,{value:instrumentCreateReactAgent(c,u),writable:!0,enumerable:!0,configurable:!0})}return n}};const instrumentLangGraph=generateInstrumentOnce(LANGGRAPH_INTEGRATION_NAME,n=>new SentryLangGraphInstrumentation(n)),_langGraphIntegration=((n={})=>({name:LANGGRAPH_INTEGRATION_NAME,setupOnce(){instrumentLangGraph(n)}})),langGraphIntegration=defineIntegration(_langGraphIntegration);init_esm$2(),init_esm$1();function patchFirestore(n,c,u,p,h){let x=()=>{},w=h.firestoreSpanCreationHook;typeof w==`function`&&(x=n=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>w(n),n=>{n&&diag.error(n?.message)},!0)});let T=new import_src$35.InstrumentationNodeModuleDefinition(`@firebase/firestore`,c,c=>wrapMethods(c,u,p,n,x));for(let h of[`@firebase/firestore/dist/lite/index.node.cjs.js`,`@firebase/firestore/dist/lite/index.node.mjs.js`,`@firebase/firestore/dist/lite/index.rn.esm2017.js`,`@firebase/firestore/dist/lite/index.cjs.js`])T.files.push(new import_src$35.InstrumentationNodeModuleFile(h,c,c=>wrapMethods(c,u,p,n,x),n=>unwrapMethods(n,p)));return T}function wrapMethods(n,c,u,p,h){return unwrapMethods(n,u),c(n,`addDoc`,patchAddDoc(p,h)),c(n,`getDocs`,patchGetDocs(p,h)),c(n,`setDoc`,patchSetDoc(p,h)),c(n,`deleteDoc`,patchDeleteDoc(p,h)),n}function unwrapMethods(n,c){for(let u of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])(0,import_src$35.isWrapped)(n[u])&&c(n,u);return n}function patchAddDoc(n,c){return function(u){return function(p,h){let x=startDBSpan(n,`addDoc`,p);return c(x),executeContextWithSpan(x,()=>u(p,h))}}}function patchDeleteDoc(n,c){return function(u){return function(p){let h=startDBSpan(n,`deleteDoc`,p.parent||p);return c(h),executeContextWithSpan(h,()=>u(p))}}}function patchGetDocs(n,c){return function(u){return function(p){let h=startDBSpan(n,`getDocs`,p);return c(h),executeContextWithSpan(h,()=>u(p))}}}function patchSetDoc(n,c){return function(u){return function(p,h,x){let w=startDBSpan(n,`setDoc`,p.parent||p);return c(w),executeContextWithSpan(w,()=>x===void 0?u(p,h):u(p,h,x))}}}function executeContextWithSpan(n,c){return context$1.with(trace.setSpan(context$1.active(),n),()=>(0,import_src$35.safeExecuteInTheMiddle)(()=>c(),c=>{c&&n.recordException(c),n.end()},!0))}function startDBSpan(n,c,u){let p=n.startSpan(`${c} ${u.path}`,{kind:SpanKind.CLIENT});return addAttributes(p,u),p.setAttribute(ATTR_DB_OPERATION_NAME,c),p}function getPortAndAddress(n){let c,u;if(typeof n.host==`string`)if(n.host.startsWith(`[`)){if(n.host.endsWith(`]`))c=n.host.replace(/^\[|\]$/g,``);else if(n.host.includes(`]:`)){let p=n.host.lastIndexOf(`:`);p!==-1&&(c=n.host.slice(1,p).replace(/^\[|\]$/g,``),u=n.host.slice(p+1))}}else if(net.isIPv6(n.host))c=n.host;else{let p=n.host.lastIndexOf(`:`);p===-1?c=n.host:(c=n.host.slice(0,p),u=n.host.slice(p+1))}return{address:c,port:u?parseInt(u,10):void 0}}function addAttributes(n,c){let u=c.firestore.app,p=u.options,h=(c.firestore.toJSON()||{}).settings||{},x={[ATTR_DB_COLLECTION_NAME]:c.path,[ATTR_DB_NAMESPACE]:u.name,[ATTR_DB_SYSTEM_NAME]:`firebase.firestore`,"firebase.firestore.type":c.type,"firebase.firestore.options.projectId":p.projectId,"firebase.firestore.options.appId":p.appId,"firebase.firestore.options.messagingSenderId":p.messagingSenderId,"firebase.firestore.options.storageBucket":p.storageBucket},{address:w,port:T}=getPortAndAddress(h);w&&(x[ATTR_SERVER_ADDRESS]=w),T&&(x[ATTR_SERVER_PORT]=T),n.setAttributes(x)}init_esm$2();function patchFunctions(n,c,u,p,h){let x=()=>{},w=()=>{},T=h.functions?.errorHook,O=h.functions?.requestHook,A=h.functions?.responseHook;typeof A==`function`&&(w=(n,c)=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>A(n,c),n=>{n&&diag.error(n?.message)},!0)}),typeof O==`function`&&(x=n=>{(0,import_src$35.safeExecuteInTheMiddle)(()=>O(n),n=>{n&&diag.error(n?.message)},!0)});let j=new import_src$35.InstrumentationNodeModuleDefinition(`firebase-functions`,c);return[{name:`firebase-functions/lib/v2/providers/https.js`,triggerType:`function`},{name:`firebase-functions/lib/v2/providers/firestore.js`,triggerType:`firestore`},{name:`firebase-functions/lib/v2/providers/scheduler.js`,triggerType:`scheduler`},{name:`firebase-functions/lib/v2/storage.js`,triggerType:`storage`}].forEach(({name:h,triggerType:O})=>{j.files.push(new import_src$35.InstrumentationNodeModuleFile(h,c,c=>wrapCommonFunctions(c,u,p,n,{requestHook:x,responseHook:w,errorHook:T},O),n=>unwrapCommonFunctions(n,p)))}),j}function patchV2Functions(n,c,u){return function(p){return function(...h){let x=typeof h[0]==`function`?h[0]:h[1],w=typeof h[0]==`function`?void 0:h[0];if(!x)return p.call(this,...h);let T=async function(...p){let h=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,w=n.startSpan(`firebase.function.${u}`,{kind:SpanKind.SERVER}),T={"faas.name":h,"faas.trigger":u,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(T[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(T[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),w.setAttributes(T),c?.requestHook?.(w),context$1.with(trace.setSpan(context$1.active(),w),async()=>{let n,u;try{u=await x.apply(this,p)}catch(c){n=c}if(c?.responseHook?.(w,n),n&&w.recordException(n),w.end(),n)throw await c?.errorHook?.(w,n),n;return u})};return w?p.call(this,w,T):p.call(this,T)}}}function wrapCommonFunctions(n,c,u,p,h,x){switch(unwrapCommonFunctions(n,u),x){case`function`:c(n,`onRequest`,patchV2Functions(p,h,`http.request`)),c(n,`onCall`,patchV2Functions(p,h,`http.call`));break;case`firestore`:c(n,`onDocumentCreated`,patchV2Functions(p,h,`firestore.document.created`)),c(n,`onDocumentUpdated`,patchV2Functions(p,h,`firestore.document.updated`)),c(n,`onDocumentDeleted`,patchV2Functions(p,h,`firestore.document.deleted`)),c(n,`onDocumentWritten`,patchV2Functions(p,h,`firestore.document.written`)),c(n,`onDocumentCreatedWithAuthContext`,patchV2Functions(p,h,`firestore.document.created`)),c(n,`onDocumentUpdatedWithAuthContext`,patchV2Functions(p,h,`firestore.document.updated`)),c(n,`onDocumentDeletedWithAuthContext`,patchV2Functions(p,h,`firestore.document.deleted`)),c(n,`onDocumentWrittenWithAuthContext`,patchV2Functions(p,h,`firestore.document.written`));break;case`scheduler`:c(n,`onSchedule`,patchV2Functions(p,h,`scheduler.scheduled`));break;case`storage`:c(n,`onObjectFinalized`,patchV2Functions(p,h,`storage.object.finalized`)),c(n,`onObjectArchived`,patchV2Functions(p,h,`storage.object.archived`)),c(n,`onObjectDeleted`,patchV2Functions(p,h,`storage.object.deleted`)),c(n,`onObjectMetadataUpdated`,patchV2Functions(p,h,`storage.object.metadataUpdated`));break}return n}function unwrapCommonFunctions(n,c){for(let u of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])(0,import_src$35.isWrapped)(n[u])&&c(n,u);return n}const DefaultFirebaseInstrumentationConfig={},firestoreSupportedVersions=[`>=3.0.0 <5`],functionsSupportedVersions=[`>=6.0.0 <7`];var FirebaseInstrumentation=class extends import_src$35.InstrumentationBase{constructor(n=DefaultFirebaseInstrumentationConfig){super(`@sentry/instrumentation-firebase`,SDK_VERSION,n)}setConfig(n={}){super.setConfig({...DefaultFirebaseInstrumentationConfig,...n})}init(){let n=[];return n.push(patchFirestore(this.tracer,firestoreSupportedVersions,this._wrap,this._unwrap,this.getConfig())),n.push(patchFunctions(this.tracer,functionsSupportedVersions,this._wrap,this._unwrap,this.getConfig())),n}};const INTEGRATION_NAME=`Firebase`,config={firestoreSpanCreationHook:n=>{addOriginToSpan(n,`auto.firebase.otel.firestore`),n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`db.query`)},functions:{requestHook:n=>{addOriginToSpan(n,`auto.firebase.otel.functions`),n.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,`http.request`)},errorHook:async(n,c)=>{c&&(captureException(c,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),await flush(2e3))}}},instrumentFirebase=generateInstrumentOnce(INTEGRATION_NAME,()=>new FirebaseInstrumentation(config)),_firebaseIntegration=(()=>({name:INTEGRATION_NAME,setupOnce(){instrumentFirebase()}})),firebaseIntegration=defineIntegration(_firebaseIntegration);function getAutoPerformanceIntegrations(){return[expressIntegration(),fastifyIntegration(),graphqlIntegration(),honoIntegration(),mongoIntegration(),mongooseIntegration(),mysqlIntegration(),mysql2Integration(),redisIntegration(),postgresIntegration(),prismaIntegration(),hapiIntegration(),koaIntegration(),connectIntegration(),tediousIntegration(),genericPoolIntegration(),kafkaIntegration(),amqplibIntegration(),lruMemoizerIntegration(),langChainIntegration(),langGraphIntegration(),vercelAIIntegration(),openAIIntegration(),anthropicAIIntegration(),googleGenAIIntegration(),postgresJsIntegration(),firebaseIntegration()]}var require_default_service_name$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._clearDefaultServiceNameCache=n.defaultServiceName=void 0;let c;function u(){if(c===void 0)try{let n=globalThis.process.argv0;c=n?`unknown_service:${n}`:`unknown_service`}catch{c=`unknown_service`}return c}n.defaultServiceName=u;function p(){c=void 0}n._clearDefaultServiceNameCache=p})),require_utils$15=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPromiseLike=void 0,n.isPromiseLike=n=>typeof n==`object`&&!!n&&typeof n.then==`function`})),require_ResourceImpl$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultResource=n.emptyResource=n.resourceFromDetectedResource=n.resourceFromAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_default_service_name$3(),x=require_utils$15();var w=class n{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(c,u){let p=new n({},u);return p._rawAttributes=N(c),p._asyncAttributesPending=c.filter(([n,c])=>(0,x.isPromiseLike)(c)).length>0,p}constructor(n,c){let u=n.attributes??{};this._rawAttributes=Object.entries(u).map(([n,c])=>((0,x.isPromiseLike)(c)&&(this._asyncAttributesPending=!0),[n,c])),this._rawAttributes=N(this._rawAttributes),this._schemaUrl=I(c?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let n=0;n<this._rawAttributes.length;n++){let[c,u]=this._rawAttributes[n];this._rawAttributes[n]=[c,(0,x.isPromiseLike)(u)?await u:u]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&c.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let n={};for(let[u,p]of this._rawAttributes){if((0,x.isPromiseLike)(p)){c.diag.debug(`Unsettled resource attribute ${u} skipped`);continue}p!=null&&(n[u]??=p)}return this._asyncAttributesPending||(this._memoizedAttributes=n),n}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(c){if(c==null)return this;let u=L(this,c),p=u?{schemaUrl:u}:void 0;return n.FromAttributeList([...c.getRawAttributes(),...this.getRawAttributes()],p)}};function T(n,c){return w.FromAttributeList(Object.entries(n),c)}n.resourceFromAttributes=T;function O(n,c){return new w(n,c)}n.resourceFromDetectedResource=O;function A(){return T({})}n.emptyResource=A;function j(){return T({[p.ATTR_SERVICE_NAME]:(0,h.defaultServiceName)(),[p.ATTR_TELEMETRY_SDK_LANGUAGE]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_LANGUAGE],[p.ATTR_TELEMETRY_SDK_NAME]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_NAME],[p.ATTR_TELEMETRY_SDK_VERSION]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_VERSION]})}n.defaultResource=j;function N(n){return n.map(([n,u])=>(0,x.isPromiseLike)(u)?[n,u.catch(u=>{c.diag.debug(`promise rejection for resource attribute: %s - %s`,n,u)})]:[n,u])}function I(n){if(typeof n==`string`||n===void 0)return n;c.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,n)}function L(n,u){let p=n?.schemaUrl,h=u?.schemaUrl,x=p===void 0||p===``,w=h===void 0||h===``;if(x)return h;if(w||p===h)return p;c.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,p,h)}})),require_detect_resources$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.detectResources=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_ResourceImpl$3();n.detectResources=(n={})=>(n.detectors||[]).map(p=>{try{let h=(0,u.resourceFromDetectedResource)(p.detect(n));return c.diag.debug(`${p.constructor.name} found resource.`,h),h}catch(n){return c.diag.debug(`${p.constructor.name} failed: ${n.message}`),(0,u.emptyResource)()}}).reduce((n,c)=>n.merge(c),(0,u.emptyResource)())})),require_EnvDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.envDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_src$47();n.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(n){let h={},x=(0,p.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),w=(0,p.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(x)try{let n=this._parseResourceAttributes(x);Object.assign(h,n)}catch(n){c.diag.debug(`EnvDetector failed: ${n instanceof Error?n.message:n}`)}return w&&(h[u.ATTR_SERVICE_NAME]=w),{attributes:h}}_parseResourceAttributes(n){if(!n)return{};let c={},u=n.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!==``);for(let n of u){let u=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(u.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[p,h]=u,x=p.trim(),w=h.trim();if(x.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let T,O;try{T=decodeURIComponent(x),O=decodeURIComponent(w)}catch(c){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${c instanceof Error?c.message:c}`)}if(T.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${T}".`);if(O.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${T}".`);c[T]=O}return c}}})),require_semconv$9=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_WEBENGINE_VERSION=n.ATTR_WEBENGINE_NAME=n.ATTR_WEBENGINE_DESCRIPTION=n.ATTR_SERVICE_NAMESPACE=n.ATTR_SERVICE_INSTANCE_ID=n.ATTR_PROCESS_RUNTIME_VERSION=n.ATTR_PROCESS_RUNTIME_NAME=n.ATTR_PROCESS_RUNTIME_DESCRIPTION=n.ATTR_PROCESS_PID=n.ATTR_PROCESS_OWNER=n.ATTR_PROCESS_EXECUTABLE_PATH=n.ATTR_PROCESS_EXECUTABLE_NAME=n.ATTR_PROCESS_COMMAND_ARGS=n.ATTR_PROCESS_COMMAND=n.ATTR_OS_VERSION=n.ATTR_OS_TYPE=n.ATTR_K8S_POD_NAME=n.ATTR_K8S_NAMESPACE_NAME=n.ATTR_K8S_DEPLOYMENT_NAME=n.ATTR_K8S_CLUSTER_NAME=n.ATTR_HOST_TYPE=n.ATTR_HOST_NAME=n.ATTR_HOST_IMAGE_VERSION=n.ATTR_HOST_IMAGE_NAME=n.ATTR_HOST_IMAGE_ID=n.ATTR_HOST_ID=n.ATTR_HOST_ARCH=n.ATTR_CONTAINER_NAME=n.ATTR_CONTAINER_IMAGE_TAGS=n.ATTR_CONTAINER_IMAGE_NAME=n.ATTR_CONTAINER_ID=n.ATTR_CLOUD_REGION=n.ATTR_CLOUD_PROVIDER=n.ATTR_CLOUD_AVAILABILITY_ZONE=n.ATTR_CLOUD_ACCOUNT_ID=void 0,n.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,n.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,n.ATTR_CLOUD_PROVIDER=`cloud.provider`,n.ATTR_CLOUD_REGION=`cloud.region`,n.ATTR_CONTAINER_ID=`container.id`,n.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,n.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,n.ATTR_CONTAINER_NAME=`container.name`,n.ATTR_HOST_ARCH=`host.arch`,n.ATTR_HOST_ID=`host.id`,n.ATTR_HOST_IMAGE_ID=`host.image.id`,n.ATTR_HOST_IMAGE_NAME=`host.image.name`,n.ATTR_HOST_IMAGE_VERSION=`host.image.version`,n.ATTR_HOST_NAME=`host.name`,n.ATTR_HOST_TYPE=`host.type`,n.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,n.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,n.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,n.ATTR_K8S_POD_NAME=`k8s.pod.name`,n.ATTR_OS_TYPE=`os.type`,n.ATTR_OS_VERSION=`os.version`,n.ATTR_PROCESS_COMMAND=`process.command`,n.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,n.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,n.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,n.ATTR_PROCESS_OWNER=`process.owner`,n.ATTR_PROCESS_PID=`process.pid`,n.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,n.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,n.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,n.ATTR_SERVICE_NAMESPACE=`service.namespace`,n.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,n.ATTR_WEBENGINE_NAME=`webengine.name`,n.ATTR_WEBENGINE_VERSION=`webengine.version`})),require_getMachineId$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getMachineId=void 0;let c=__require(`process`),u;async function p(){if(!u)switch(c.platform){case`darwin`:u=(await import(`./getMachineId-darwin-Bh0FW8Yj.js`).then(n=>__toESM(n.default))).getMachineId;break;case`linux`:u=(await import(`./getMachineId-linux-BNh9bxS-.js`).then(n=>__toESM(n.default))).getMachineId;break;case`freebsd`:u=(await import(`./getMachineId-bsd-BrlN6PEO.js`).then(n=>__toESM(n.default))).getMachineId;break;case`win32`:u=(await import(`./getMachineId-win-IRvYdsh7.js`).then(n=>__toESM(n.default))).getMachineId;break;default:u=(await import(`./getMachineId-unsupported-BynWzgul.js`).then(n=>__toESM(n.default))).getMachineId;break}return u()}n.getMachineId=p})),require_utils$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalizeType=n.normalizeArch=void 0,n.normalizeArch=n=>{switch(n){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return n}},n.normalizeType=n=>{switch(n){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return n}}})),require_HostDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.hostDetector=void 0;let c=require_semconv$9(),u=__require(`os`),p=require_getMachineId$3(),h=require_utils$14();n.hostDetector=new class{detect(n){return{attributes:{[c.ATTR_HOST_NAME]:(0,u.hostname)(),[c.ATTR_HOST_ARCH]:(0,h.normalizeArch)((0,u.arch)()),[c.ATTR_HOST_ID]:(0,p.getMachineId)()}}}}})),require_OSDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.osDetector=void 0;let c=require_semconv$9(),u=__require(`os`),p=require_utils$14();n.osDetector=new class{detect(n){return{attributes:{[c.ATTR_OS_TYPE]:(0,p.normalizeType)((0,u.platform)()),[c.ATTR_OS_VERSION]:(0,u.release)()}}}}})),require_ProcessDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_semconv$9(),p=__require(`os`);n.processDetector=new class{detect(n){let h={[u.ATTR_PROCESS_PID]:process.pid,[u.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[u.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[u.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[u.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[u.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[u.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(h[u.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=p.userInfo();h[u.ATTR_PROCESS_OWNER]=n.username}catch(n){c.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:h}}}})),require_ServiceInstanceIdDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=void 0;let c=require_semconv$9(),u=__require(`crypto`);n.serviceInstanceIdDetector=new class{detect(n){return{attributes:{[c.ATTR_SERVICE_INSTANCE_ID]:(0,u.randomUUID)()}}}}})),require_node$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_HostDetector$3();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}});var u=require_OSDetector$3();Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}});var p=require_ProcessDetector$3();Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return p.processDetector}});var h=require_ServiceInstanceIdDetector$3();Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return h.serviceInstanceIdDetector}})})),require_platform$14=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_node$14();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return c.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return c.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return c.serviceInstanceIdDetector}})})),require_NoopDetector$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.NoopDetector=void 0;var c=class{detect(){return{attributes:{}}}};n.NoopDetector=c,n.noopDetector=new c})),require_detectors$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=void 0;var c=require_EnvDetector$3();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return c.envDetector}});var u=require_platform$14();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_NoopDetector$3();Object.defineProperty(n,`noopDetector`,{enumerable:!0,get:function(){return p.noopDetector}})})),require_src$20=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultServiceName=n.emptyResource=n.defaultResource=n.resourceFromAttributes=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=n.detectResources=void 0;var c=require_detect_resources$3();Object.defineProperty(n,`detectResources`,{enumerable:!0,get:function(){return c.detectResources}});var u=require_detectors$3();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return u.envDetector}}),Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_ResourceImpl$3();Object.defineProperty(n,`resourceFromAttributes`,{enumerable:!0,get:function(){return p.resourceFromAttributes}}),Object.defineProperty(n,`defaultResource`,{enumerable:!0,get:function(){return p.defaultResource}}),Object.defineProperty(n,`emptyResource`,{enumerable:!0,get:function(){return p.emptyResource}});var h=require_default_service_name$3();Object.defineProperty(n,`defaultServiceName`,{enumerable:!0,get:function(){return h.defaultServiceName}})})),require_enums$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums$2();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler$2();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler$2();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_AlwaysOffSampler$2(),h=require_AlwaysOnSampler$2();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler$2();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_AlwaysOffSampler$2(),h=require_AlwaysOnSampler$2(),x=require_ParentBasedSampler$2(),w=require_TraceIdRatioBasedSampler$2();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config$2(),u=require_src$47();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase$2();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor$2();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator$2();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform$13=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node$13();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv$8=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler$2(),u=require_semconv$8();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47(),p=require_Span$2(),h=require_utility$2(),x=require_platform$13(),w=require_TracerMetrics$2(),T=require_version$5();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$47();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$47(),u=require_src$20(),p=require_Tracer$2(),h=require_config$2(),x=require_MultiSpanProcessor$2(),w=require_utility$2();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$47();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$47();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$47();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$19=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider$2();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform$13();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter$2();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter$2();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor$2();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor$2();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler$2();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler$2();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler$2();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler$2();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler$2();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})}));init_esm$2();var import_src$15=require_src$19();const MAX_MAX_SPAN_WAIT_DURATION=1e6;function initOpenTelemetry(n,c={}){n.getOptions().debug&&setupOpenTelemetryLogger();let[u,p]=setupOtel(n,c);n.traceProvider=u,n.asyncLocalStorageLookup=p}function setupOtel(n,c={}){let u=new import_src$15.BasicTracerProvider({sampler:new SentrySampler(n),resource:getSentryResource(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new SentrySpanProcessor({timeout:_clampSpanProcessorTimeout(n.getOptions().maxSpanWaitDuration)}),...c.spanProcessors||[]]});trace.setGlobalTracerProvider(u),propagation.setGlobalPropagator(new SentryPropagator);let p=new SentryContextManager;return context$1.setGlobalContextManager(p),[u,p.getAsyncLocalStorageLookup()]}function _clampSpanProcessorTimeout(n){if(n!=null){if(n>MAX_MAX_SPAN_WAIT_DURATION)return DEBUG_BUILD&&debug.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${MAX_MAX_SPAN_WAIT_DURATION}`),MAX_MAX_SPAN_WAIT_DURATION;if(n<=0||Number.isNaN(n)){DEBUG_BUILD&&debug.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return n}}function getDefaultIntegrationsWithoutPerformance(){return getDefaultIntegrations$1().filter(n=>n.name!==`Http`&&n.name!==`NodeFetch`).concat(httpIntegration(),nativeNodeFetchIntegration())}function getDefaultIntegrations(n){return[...getDefaultIntegrationsWithoutPerformance(),...hasSpansEnabled(n)?getAutoPerformanceIntegrations():[]]}function init(n={}){return _init(n,getDefaultIntegrations)}function _init(n={},c){applySdkMetadata(n,`node`);let u=init$1({...n,defaultIntegrations:n.defaultIntegrations??c(n)});return u&&!n.skipOpenTelemetrySetup&&(initOpenTelemetry(u,{spanProcessors:n.openTelemetrySpanProcessors}),validateOpenTelemetrySetup()),u}const createNodeSentrySink=n=>initSentryAndCreateSink({config:n,dsn:n.dsn,sentry:{addBreadcrumb:n=>addBreadcrumb(n),captureException:n=>captureException(n),flush:n=>flush(n),init:n=>init(n),startInactiveSpan:n=>startInactiveSpan$1(toSentrySpanOptions(n)),withScope:n=>withScope(n)}}),parseBoolean$1=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`};let cachedRuntime=null,cliScopeSnapshot={};const supportedCliNodeSinkNames=new Set([ObservabilitySinkName.NOOP,ObservabilitySinkName.SENTRY]),parseCliNodeSinkNames=()=>{let n=process.env.OBSERVABILITY_ADAPTERS_CLI?.trim();if(!n)return{names:[]};let{invalidNames:c,names:u}=parseObservabilitySinkNames(n),p=u.filter(n=>!supportedCliNodeSinkNames.has(n));return c.length>0&&console.warn(`[observability] Ignoring unsupported CLI sinks: ${c.join(`, `)}`),p.length>0&&console.warn(`[observability] Ignoring unsupported CLI sinks: ${p.join(`, `)}`),{names:u.filter(n=>supportedCliNodeSinkNames.has(n))}},buildCliSink=n=>{let{names:c}=parseCliNodeSinkNames(),u=[];for(let p of c)try{switch(p){case ObservabilitySinkName.NOOP:u.push(createNoopSink());break;case ObservabilitySinkName.SENTRY:u.push(createNodeSentrySink({appVersion:resolveAppVersionFromRelease(n),clientApp:`echo-cli`,dsn:process.env.SENTRY_DSN_CLI,enabled:parseBoolean$1(process.env.OBSERVABILITY_ENABLED),environment:process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV||`development`,release:n,runtime:`cli`}));break}}catch(n){console.warn(`[observability] Failed to create CLI sink: ${p}`,n)}return createCompositeSink(u.length>0?u:[createNoopSink()])},resolveCliNodeObservabilityBackendName=()=>{let{names:n}=parseCliNodeSinkNames();return n.includes(ObservabilitySinkName.SENTRY)?`sentry`:n.length>0?`none`:parseBoolean$1(process.env.OTEL_ENABLED)?`otel`:`none`},getCliObservability=()=>{let n=process.env.OBSERVABILITY_RELEASE?.trim();return cachedRuntime??=createFrontendObservabilityRuntime({appVersion:resolveAppVersionFromRelease(n),clientApp:`echo-cli`,enabled:parseBoolean$1(process.env.OBSERVABILITY_ENABLED),environment:process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV||`development`,release:n,runtime:`cli`},buildCliSink(n)),cachedRuntime},syncCliScopeSnapshot=n=>{cliScopeSnapshot={...cliScopeSnapshot,...n},applyClientScopeSnapshot(getCliObservability(),cliScopeSnapshot)},createCliObservedFetch=n=>createObservedFetch({kind:n,observability:getCliObservability().createHttpPort()}),setCliPipelineScope=n=>{syncCliScopeSnapshot({pipelineId:n})},bindCliAuthObservabilityScope=n=>{let c=()=>{let c=n.useConnectionUIStore.getState(),u=c.status;syncCliScopeSnapshot({authPhase:u,userId:u===ConnectionUIStatus.SIGNED_OUT?null:c.user.userId||null})};return c(),n.useConnectionUIStore.subscribe(c)},runLogoutCommand=async()=>{let n=await loadBackendConfig();if(!n)throw Error(`No stored auth session found.`);let c=deriveCliEndpoints(n),u=await loadAuthSession(c);if(!u)throw Error(`No stored auth session found.`);await revokeCliSession(c.apiBaseUrl,{token:u.token},{fetchImpl:createCliObservedFetch(`cli.auth.logout`)}).catch(()=>{}),await clearAuthSession(c)},EXTERNAL_AUTH_KIND_CONFIG={oauth:{kind:`oauth`,label:`OAuth`},sso:{kind:`sso`,label:`SSO`}},EXTERNAL_AUTH_PROVIDER_CONFIG={github:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`github`,label:`GitHub`},google:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`google`,label:`Google`},slack:{kind:EXTERNAL_AUTH_KIND_CONFIG.oauth.kind,provider:`slack`,label:`Slack`},"google-workspace":{kind:EXTERNAL_AUTH_KIND_CONFIG.sso.kind,provider:`google-workspace`,label:`Google Workspace`}},PUBLIC_AUTH_PROVIDERS=[EXTERNAL_AUTH_PROVIDER_CONFIG.github.provider,EXTERNAL_AUTH_PROVIDER_CONFIG.google.provider],CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER={github:`github`,google:`google`,slack:`slack`,"google-workspace":`googleWorkspace`},LOGIN_METHOD_LABELS={github:`GitHub`,google:`Google`,slack:`Slack`,googleWorkspace:`Google Workspace`},isCliSupportedExternalAuthProvider=n=>n in CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER,readCliLoginMethod=n=>{if(!isCliSupportedExternalAuthProvider(n))throw Error(`CLI login does not support configured auth provider: ${n}`);return CLI_LOGIN_METHOD_BY_EXTERNAL_PROVIDER[n]},LOGIN_METHODS=PUBLIC_AUTH_PROVIDERS.map(readCliLoginMethod);if(LOGIN_METHODS.length===0)throw Error(`CLI login requires at least one configured customer-facing auth provider`);const DEFAULT_LOGIN_METHOD=LOGIN_METHODS[0],LOGIN_METHOD_OPTIONS_TEXT=LOGIN_METHODS.join(`|`),LOGIN_METHOD_GRID_COLUMN_COUNT=LOGIN_METHODS.length>1?2:1,getLoginMethodLabel=n=>LOGIN_METHOD_LABELS[n],isLoginMethod=n=>LOGIN_METHODS.includes(n),moveLoginMethodSelection=(n,c)=>{let u=Math.floor(n/LOGIN_METHOD_GRID_COLUMN_COUNT),p=n%LOGIN_METHOD_GRID_COLUMN_COUNT;switch(c){case`left`:return u*LOGIN_METHOD_GRID_COLUMN_COUNT+Math.max(p-1,0);case`right`:return Math.min(u*LOGIN_METHOD_GRID_COLUMN_COUNT+Math.min(p+1,LOGIN_METHOD_GRID_COLUMN_COUNT-1),LOGIN_METHODS.length-1);case`up`:return Math.max(n-LOGIN_METHOD_GRID_COLUMN_COUNT,0);case`down`:return Math.min(n+LOGIN_METHOD_GRID_COLUMN_COUNT,LOGIN_METHODS.length-1)}},LINE_BREAK_REGEX=/\r?\n/;function resolveExecutablePath(n){let c=n.configuredPath?.trim()||readExecutablePathFromEnv(n.envKeys??[]);return c?(assertExecutablePath(c),n.validate?.(c),c):findExecutablePath(n)}function assertExecutablePath(n){try{accessSync(n,constants.X_OK)}catch(c){throw Error(`Executable is not runnable at ${n}: ${c instanceof Error?c.message:String(c)}`)}}function readExecutablePathFromEnv(n){for(let c of n){let n=process.env[c]?.trim();if(n)return n}return null}function findExecutablePath(n){let c=new Set;for(let u of listPathEnvCandidates(n))if(!c.has(u)&&(c.add(u),isSupportedExecutablePath(u,n.validate)))return u;for(let u of listWhichCandidates(n.command))if(!c.has(u)&&(c.add(u),isSupportedExecutablePath(u,n.validate)))return u;return null}function listPathEnvCandidates(n){let c=process.platform===`win32`?n.windowsExecutableNames??[`${n.command}.cmd`,`${n.command}.exe`,`${n.command}.bat`,n.command]:[n.command],u=[];for(let n of(process.env.PATH??``).split(delimiter)){let p=normalizePathDirectory(n);if(p)for(let n of c)u.push(join(p,n))}return u}function listWhichCandidates(n){let c=process.platform===`win32`?`where`:`which`,u=process.platform===`win32`?[n]:[`-a`,n];try{return execFileSync(c,u,{encoding:`utf8`,timeout:2e3,stdio:[`ignore`,`pipe`,`ignore`]}).split(LINE_BREAK_REGEX).map(n=>n.trim()).filter(Boolean)}catch{return[]}}function normalizePathDirectory(n){let c=n.trim();return c?c.startsWith(`"`)&&c.endsWith(`"`)?c.slice(1,-1):c:null}function isSupportedExecutablePath(n,c){try{return assertExecutablePath(n),c?.(n),!0}catch{return!1}}const COMMAND_TOKEN_PATTERN=/^(?:"([^"]+)"|'([^']+)'|(\S+))/,LINE_BREAK_PATTERN=/\r?\n/;function probeExecutableCommand(n,c={}){let u=readExecutableCommand(n);if(!u)throw Error(`Executable command is required`);let p=readConfiguredPath(c);if(p)return assertExecutablePath(p),c.validate?.(p),{available:!0,command:u,path:p};let h=findExecutableCommandPath(u,c);return{available:h!==null,command:u,path:h}}function readExecutableCommand(n){let c=n.trim(),u=COMMAND_TOKEN_PATTERN.exec(c);return u?u[1]??u[2]??u[3]??``:``}function readConfiguredPath(n){let c=n.configuredPath?.trim();if(c)return c;for(let c of n.envKeys??[]){let n=process.env[c]?.trim();if(n)return n}return null}function findExecutableCommandPath(n,c){for(let u of listExecutableCommandPaths(n))try{return assertExecutablePath(u),c.validate?.(u),u}catch{continue}return null}function listExecutableCommandPaths(n){try{if(process.platform===`win32`){let c=new Set;try{let u=execFileSync(`where`,[n],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]});for(let n of u.split(LINE_BREAK_PATTERN).map(n=>n.trim()).filter(Boolean))c.add(n)}catch{return[]}return[...c]}return execFileSync(`/bin/sh`,[`-lc`,`command -v -- "$0"`,n],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).split(LINE_BREAK_PATTERN).map(n=>n.trim()).filter(Boolean)}catch{return[]}}const WS_RPC_DEVICES_CHANNELS={DEVICES_LIST:`devices.list`,DEVICES_RENAME:`devices.rename`,DEVICE_AGENT_SESSIONS_LIST:`device.agent.sessions.list`,DEVICE_AGENT_SESSION_METADATA:`device.agent.session.metadata`,DEVICE_AGENT_SESSION_CONFIG_GET:`device.agent.session.config.get`,DEVICE_AGENT_SESSION_CONFIG_SET:`device.agent.session.config.set`,DEVICE_AGENT_SESSION_MESSAGES:`device.agent.session.messages`,DEVICE_AGENT_SESSION_RENAME:`device.agent.session.rename`,DEVICE_AGENT_SESSION_RESUME:`device.agent.session.resume`,DEVICE_AGENT_SESSION_SNAPSHOT:`device.agent.session.snapshot`,DEVICE_AGENT_SESSION_SPAWN:`device.agent.session.spawn`,DEVICE_AGENT_RUN_INTERRUPT:`device.agent.run.interrupt`,DEVICE_TMUX_SESSIONS_LIST:`device.tmux.sessions.list`,DEVICE_TMUX_SESSION_CREATE:`device.tmux.session.create`,DEVICE_TMUX_SESSION_DELETE:`device.tmux.session.delete`,DEVICE_COMMAND_REQUEST_RUN:`device.command.request_run`,DEVICE_COMMAND_REPORT_OUTPUT:`device.command.report_output`,DEVICE_PUSH_TOKEN_UPSERT:`device.push_token.upsert`,DEVICE_PUSH_TOKEN_REVOKE:`device.push_token.revoke`},WS_RPC_FILE_CHANNELS={STAT_LOCAL_FILE:`stat_local_file`,REQUEST_SERVER_FILE:`request_server_file`,UPLOAD_FILE:`upload_file`,CHECK_UPLOAD_FILENAME:`check_upload_filename`,REQUEST_LOCAL_FILE:`request_local_file`,PUT_FILE_TO_LOCAL:`put_file_to_local`,LIST_LOCAL_FILES:`list_local_files`},WS_RPC_CHANNELS={CONNECTION_PING:`connection.ping`,CONNECTION_PONG:`connection.pong`};let ProjectTemplateIconName=function(n){return n.AUTOMATION=`automation`,n.BUG=`bug`,n.BUILD=`build`,n.CALENDAR=`calendar`,n.CODE=`code`,n.DEVICE=`device`,n.DOCUMENTS=`documents`,n.ENGINEERING=`engineering`,n.FINANCE=`finance`,n.IDEA=`idea`,n.INFORMATION=`information`,n.INBOX=`inbox`,n.INVITE=`invite`,n.MARKDOWN=`markdown`,n.PLANNING=`planning`,n.PRODUCT=`product`,n.REIMBURSEMENT=`reimbursement`,n.REQUIREMENTS=`requirements`,n.RESEARCH=`research`,n.REVIEW=`review`,n.SERVER=`server`,n.TEAM=`team`,n.TERMINAL=`terminal`,n.WEB=`web`,n}({}),ProjectTemplateBackgroundColor=function(n){return n.AMBER_SOFT=`#FFEAD5`,n.GREEN_LIGHT=`#E4FBCC`,n.MINT_LIGHT=`#D3F8DF`,n.SKY_LIGHT=`#E0F2FE`,n.BLUE_LIGHT=`#E0EAFF`,n.GRAY_LIGHT=`#EFF1F5`,n.PURPLE_LIGHT=`#FBE8FF`,n.PINK_LIGHT=`#FCE7F6`,n.YELLOW_LIGHT=`#FEF7C3`,n.LIME_LIGHT=`#E6F4D7`,n.CYAN_LIGHT=`#D5F5F6`,n.AZURE_LIGHT=`#D1E9FF`,n.INDIGO_LIGHT=`#D1E0FF`,n.SLATE_LIGHT=`#D5D9EB`,n.VIOLET_LIGHT=`#ECE9FE`,n.ROSE_LIGHT=`#FFE4E8`,n}({}),ProjectTemplateConversationOpenerFileType=function(n){return n.DOCUMENT=`document`,n.IMAGE=`image`,n.AUDIO=`audio`,n.VIDEO=`video`,n.OTHER=`other`,n}({});const richTextBlockSchema=object$1({type:string$2().trim().min(1)}).catchall(jsonValueSchema$1),richTextSchema=object$1({version:literal$1(1),blocks:array$3(richTextBlockSchema)}),projectTemplateConversationOpenerOptionSchema=object$1({type:literal$1(`opening-options`),data:object$1({text:string$2().trim().max(500),instruction:string$2().trim().max(2e3).optional(),file:object$1({types:array$3(nativeEnum(ProjectTemplateConversationOpenerFileType)).min(1).max(5),otherExtensions:array$3(string$2().trim().min(1).max(24)).max(50).optional()}).optional()})}),projectTemplateConversationOpenerSchema=object$1({hints:richTextSchema.optional(),options:array$3(projectTemplateConversationOpenerOptionSchema).max(20).optional()}),projectTemplateGraphSchema=object$1({version:literal$1(`1.0.0`),name:string$2().trim().max(128),description:string$2().trim().max(500),icon:nativeEnum(ProjectTemplateIconName),background:nativeEnum(ProjectTemplateBackgroundColor),nodes:array$3(object$1({id:string$2().trim().min(1),position:object$1({x:number$3().finite(),y:number$3().finite()}),data:object$1({type:literal$1(`task`),icon:nativeEnum(ProjectTemplateIconName),background:nativeEnum(ProjectTemplateBackgroundColor),title:string$2().trim().min(1).max(30),instructions:string$2().max(1e5),conversation_opener:projectTemplateConversationOpenerSchema.optional()})})),edges:array$3(object$1({id:string$2().trim().min(1),source:string$2().trim().min(1),target:string$2().trim().min(1)}))}).superRefine((n,c)=>{let u=new Set;for(let p of n.nodes)u.has(p.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate node id`,path:[`nodes`]}),u.add(p.id);let p=new Set,h=new Map,x=new Map;for(let w of n.edges){p.has(w.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate edge id`,path:[`edges`]}),p.add(w.id),w.source===w.target&&c.addIssue({code:ZodIssueCode.custom,message:`Edge cannot connect a node to itself`,path:[`edges`]}),(!u.has(w.source)||!u.has(w.target))&&c.addIssue({code:ZodIssueCode.custom,message:`Edge endpoint is missing`,path:[`edges`]});let n=(h.get(w.target)??0)+1;n>1&&c.addIssue({code:ZodIssueCode.custom,message:`A node cannot have multiple upstream nodes`,path:[`edges`]}),h.set(w.target,n),x.set(w.source,[...x.get(w.source)??[],w.target])}let w=new Set,T=new Set,O=n=>{if(!T.has(n)){if(w.has(n)){c.addIssue({code:ZodIssueCode.custom,message:`Graph cannot contain cycles`,path:[`edges`]});return}w.add(n);for(let c of x.get(n)??[])O(c);w.delete(n),T.add(n)}};for(let n of u)O(n)}),projectTemplateStarterTemplateSchema=object$1({id:string$2().trim().min(1),graph:projectTemplateGraphSchema}),WS_RPC_RELAY_CHANNELS={RELAY_SESSION_CREATE:`relay.session.create`,RELAY_SESSION_CLOSE:`relay.session.close`,RELAY_SESSION_CONNECT_REQUEST:`relay.session.connect_request`};let LlmScenarioName=function(n){return n.TRANSLATE=`translate`,n.FAST_MODE=`fast_mode`,n.BALANCED_MODE=`balanced_mode`,n.MAX_MODE=`max_mode`,n.DOWNSTREAM_COMPLETION_SUMMARY=`downstream_completion_summary`,n.PROJECT_TEMPLATE_INSTRUCTION_GENERATION=`project_template_instruction_generation`,n.TASK_TITLE_GENERATION=`task_title_generation`,n.GUARDRAIL=`guardrail`,n}({}),ModelApiProviderName=function(n){return n.OPENAI=`openai`,n.ANTHROPIC=`anthropic`,n.BEDROCK=`bedrock`,n.OPENROUTER=`openrouter`,n.OPENAI_COMPATIBLE=`openai-compatible`,n.DEEPSEEK=`deepseek`,n}({});const ProviderCredentialFieldName={API_KEY:`apiKey`,BASE_URL:`baseUrl`,ORGANIZATION:`organization`,REGION:`region`,VALIDATION_MODEL:`validationModel`},ProviderCredentialFieldType={SECURE:`secure`,TEXT:`text`,JSON:`json`},MODEL_API_PROVIDER_DEFINITIONS={openrouter:{provider:`openrouter`,label:`OpenRouter`,sortOrder:10,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://openrouter.ai/api/v1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`anthropic/claude-haiku-4.5`}]},openai:{provider:`openai`,label:`OpenAI`,sortOrder:20,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://api.openai.com/v1`},{name:ProviderCredentialFieldName.ORGANIZATION,label:`Organization`,type:ProviderCredentialFieldType.TEXT,required:!1},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`gpt-5.5`}]},anthropic:{provider:`anthropic`,label:`Anthropic`,sortOrder:30,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://api.anthropic.com`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`claude-haiku-4-5`}]},bedrock:{provider:`bedrock`,label:`Bedrock`,sortOrder:40,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,placeholder:`https://bedrock-runtime.{region}.amazonaws.com`},{name:ProviderCredentialFieldName.REGION,label:`AWS region`,type:ProviderCredentialFieldType.TEXT,required:!0,defaultValue:`us-east-1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`global.anthropic.claude-haiku-4-5-20251001-v1:0`}]},"openai-compatible":{provider:`openai-compatible`,label:`OpenAI Compatible`,sortOrder:50,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!0,placeholder:`https://api.example.com/v1`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!0,placeholder:`provider/model-id`}]},deepseek:{provider:`deepseek`,label:`DeepSeek`,sortOrder:60,fields:[{name:ProviderCredentialFieldName.API_KEY,label:`API key`,type:ProviderCredentialFieldType.SECURE,required:!0},{name:ProviderCredentialFieldName.BASE_URL,label:`Custom API endpoint URL`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`https://api.deepseek.com`},{name:ProviderCredentialFieldName.VALIDATION_MODEL,label:`Validation model`,type:ProviderCredentialFieldType.TEXT,required:!1,defaultValue:`deepseek-v4-flash`}]}},MODEL_API_PROVIDER_LIST=Object.values(MODEL_API_PROVIDER_DEFINITIONS).sort((n,c)=>n.sortOrder-c.sortOrder);let ModelPricingCalculatorMethod=function(n){return n.CLAUDE_TOKEN=`claude_token`,n.OPENAI_TOKEN=`openai_token`,n.DEEPSEEK_TOKEN=`deepseek_token`,n.GEMINI_TOKEN=`gemini_token`,n}({}),ModelFamily=function(n){return n.CLAUDE=`claude`,n.OPENAI=`openai`,n.GEMINI=`gemini`,n.DEEPSEEK=`deepseek`,n.CUSTOM=`custom`,n}({});const llmRequestParametersSchema=record$1(string$2(),jsonValueSchema$1),modelContextBaseSchema=object$1({contextWindowTokens:number$3().int().positive(),compactionThresholdRatio:number$3().min(0).max(1)}),llmPromptModelContextSchema=modelContextBaseSchema.extend({type:literal$1(`prompt`)}).strict(),llmNativeModelContextSchema=modelContextBaseSchema.extend({type:literal$1(`native`)}).strict(),llmModelContextSchema=discriminatedUnion$1(`type`,[llmPromptModelContextSchema,llmNativeModelContextSchema]),llmModelConfigSchema=object$1({modelId:string$2().trim().min(1),context:llmModelContextSchema,parameters:llmRequestParametersSchema.optional()}).strict(),knownLlmModelConfigSchema=llmModelConfigSchema.extend({family:nativeEnum(ModelFamily)}).strict(),llmBillingConfigSchema=object$1({calculatorMethod:nativeEnum(ModelPricingCalculatorMethod),pricing:record$1(string$2(),jsonValueSchema$1)}).strict(),llmProviderModelConfigSchema=object$1({provider:nativeEnum(ModelApiProviderName),modelConfig:knownLlmModelConfigSchema}).strict(),llmPlatformModelConfigSchema=llmProviderModelConfigSchema.extend({billingConfig:llmBillingConfigSchema}).strict(),llmScenarioConfigMapSchema=object$1({translate:string$2().trim().min(1),fast_mode:string$2().trim().min(1),balanced_mode:string$2().trim().min(1),max_mode:string$2().trim().min(1),downstream_completion_summary:string$2().trim().min(1),project_template_instruction_generation:string$2().trim().min(1),task_title_generation:string$2().trim().min(1),guardrail:string$2().trim().min(1)});function validatePlatformConfig(n,c){for(let[u,p]of Object.entries(n.scenarios))n.models[p]||c.addIssue({code:ZodIssueCode.custom,message:`Scenario references missing model config: ${p}`,path:[`scenarios`,u]});for(let[u,p]of Object.entries(n.models))p.modelConfig.family===`custom`&&c.addIssue({code:ZodIssueCode.custom,message:`Platform model config cannot use custom family`,path:[`models`,u,`modelConfig`,`family`]})}const llmPlatformConfigSchema=object$1({version:literal$1(1),scenarios:llmScenarioConfigMapSchema,models:record$1(string$2().trim().min(1),llmPlatformModelConfigSchema)}).strict().superRefine(validatePlatformConfig),putLlmPlatformConfigInputSchema=object$1({expectedRevision:string$2().nullable(),config:llmPlatformConfigSchema}),userCustomModelConfigSchema=object$1({temperature:number$3().min(0).max(2)}).strict(),workspaceScenarioModelConfigSchema=object$1({modelId:string$2().trim().min(1),context:llmPromptModelContextSchema.optional(),customConfig:userCustomModelConfigSchema.optional()}).strict(),workspaceLlmScenarioRouteSchema=object$1({credentialId:string$2().trim().min(1),modelConfig:workspaceScenarioModelConfigSchema}).strict(),workspaceLlmScenarioRouteMapSchema=object$1({translate:workspaceLlmScenarioRouteSchema.optional(),fast_mode:workspaceLlmScenarioRouteSchema.optional(),balanced_mode:workspaceLlmScenarioRouteSchema.optional(),max_mode:workspaceLlmScenarioRouteSchema.optional(),downstream_completion_summary:workspaceLlmScenarioRouteSchema.optional(),project_template_instruction_generation:workspaceLlmScenarioRouteSchema.optional(),task_title_generation:workspaceLlmScenarioRouteSchema.optional(),guardrail:workspaceLlmScenarioRouteSchema.optional()}).strict(),workspaceLlmSettingsSchema=object$1({enabled:boolean$1(),scenarioRoutes:workspaceLlmScenarioRouteMapSchema}).strict(),projectTemplateBlueprintsConfigValueSchema=object$1({templates:array$3(projectTemplateStarterTemplateSchema)}).superRefine((n,c)=>{validateProjectTemplateBlueprints(n.templates,c)}),putProjectTemplateBlueprintsConfigInputSchema=object$1({expectedRevision:string$2().nullable(),templates:array$3(projectTemplateStarterTemplateSchema)}).superRefine((n,c)=>{validateProjectTemplateBlueprints(n.templates,c)});function validateProjectTemplateBlueprints(n,c){let u=new Set;for(let p of n)u.has(p.id)&&c.addIssue({code:ZodIssueCode.custom,message:`Duplicate template blueprint id`,path:[`templates`]}),u.add(p.id)}const taskMessageOriginSchema=_enum$1([`human`,`agent`]),taskMessageLlmRouteMetadataBaseSchema=object$1({version:literal$1(1),scenario:nativeEnum(LlmScenarioName),provider:nativeEnum(ModelApiProviderName),model_id:string$2().trim().min(1),model_family:nativeEnum(ModelFamily),model_config:llmModelConfigSchema}),taskMessageLlmRouteMetadataSchema=discriminatedUnion$1(`owner`,[taskMessageLlmRouteMetadataBaseSchema.extend({owner:literal$1(`platform`),platform_model_config_id:string$2().trim().min(1)}).catchall(jsonValueSchema$1),taskMessageLlmRouteMetadataBaseSchema.extend({owner:literal$1(`workspace`),credential_id:string$2().trim().min(1)}).catchall(jsonValueSchema$1)]),taskMessageMetadataSchema=object$1({message_origin:taskMessageOriginSchema.optional(),llm_route:taskMessageLlmRouteMetadataSchema.optional()}).catchall(jsonValueSchema$1),taskSendTextBlockSchema=object$1({type:literal$1(`text`),text:string$2()});async function connectNodeTcpSocket(n){let c=new URL(n.relayUrl);c.searchParams.set(`token`,n.token);let u=new WebSocket(c);u.binaryType=`arraybuffer`,await onceConnected(u);let p=new Set,h=new Set,x=async n=>{if(typeof n.data==`string`)return;let c=await toUint8Array(n.data);p.forEach(n=>n(c))};return u.addEventListener(`message`,n=>{x(n)}),u.addEventListener(`close`,()=>{h.forEach(n=>n())}),u.addEventListener(`error`,n=>{h.forEach(c=>c(toWebSocketError(n)))}),new TcpSocket(n.sessionId,{write:async n=>{u.send(n)},close:async()=>{u.close()},onData:n=>(p.add(n),()=>p.delete(n)),onClose:n=>(h.add(n),()=>h.delete(n))})}function onceConnected(n){return new Promise((c,u)=>{let p=()=>{},h=()=>{p(),c()},x=n=>{p(),u(toWebSocketError(n))};p=()=>{n.removeEventListener(`open`,h),n.removeEventListener(`error`,x)},n.addEventListener(`open`,h,{once:!0}),n.addEventListener(`error`,x,{once:!0})})}function toWebSocketError(n){if(typeof ErrorEvent<`u`&&n instanceof ErrorEvent&&n.error instanceof Error)return n.error;if(typeof n==`object`&&n&&`error`in n){let c=n.error;if(c instanceof Error)return c;if(typeof c==`string`&&c.length>0)return Error(c)}return Error(`WebSocket connection error`)}async function toUint8Array(n){return n instanceof ArrayBuffer?new Uint8Array(n):n instanceof Blob?new Uint8Array(await n.arrayBuffer()):ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(Buffer$1.from(n))}async function acceptAgentRunRelaySession(n){let c=await connectNodeTcpSocket({relayUrl:n.relayUrl,sessionId:n.sessionId,token:n.token,role:`acceptor`}),u=await n.integration.subscribeRun(n.runId);(async()=>{try{for await(let n of u)await c.write(encodeFrame({kind:`live_event`,event:n}));await c.write(encodeFrame({kind:`terminal`}))}catch{await u.return?.(void 0)}finally{await c.close().catch(()=>{})}})(),(async()=>{try{for(;;)await c.read()}catch{await u.return?.(void 0),await c.close().catch(()=>{})}})()}function createAgentIntegrationHandlers(n){return{listSessions:async c=>({items:await getIntegration(n.integrations,c.agentType).listRecentSessions(c.limit)}),getSessionMetadata:async c=>{let u=getIntegration(n.integrations,c.agentType);return{metadata:await u.getSessionMetadata(c.sessionId),activeRunId:u.getActiveRunId(c.sessionId)}},getSessionConfig:async c=>({config:await getIntegration(n.integrations,c.agentType).getSessionConfig(c.sessionId)}),setSessionConfig:async c=>{await getIntegration(n.integrations,c.agentType).setSessionConfig(c.sessionId,c.config)},getSessionMessages:async c=>await getIntegration(n.integrations,c.agentType).getSessionMessages(c.sessionId,c.beforeMessageCursor,c.limit),getSessionSnapshot:async c=>({latestMessageCursor:(await getIntegration(n.integrations,c.agentType).getSessionSnapshot(c.sessionId)).latestMessageCursor}),spawnSession:async c=>await getIntegration(n.integrations,c.agentType).spawnSession(c.prompt,c.config,c.cwd),resumeSession:async c=>await getIntegration(n.integrations,c.agentType).resumeSession(c.sessionId,c.prompt),renameSession:async c=>{await getIntegration(n.integrations,c.agentType).renameSession(c.sessionId,c.displayName)},interruptRun:async c=>{getIntegration(n.integrations,c.agentType).interruptRun(c.runId)},acceptRunRelaySession:async c=>{await acceptAgentRunRelaySession({integration:getIntegration(n.integrations,c.agentType),relayUrl:c.relayUrl,sessionId:c.sessionId,runId:c.runId,token:c.token})}}}function getIntegration(n,c){let u=n[c];if(!u)throw Error(`Unsupported agent type: ${String(c)}`);return u}function registerAgentDeviceRpcHandlers(n,c){let u=createAgentIntegrationHandlers(c),p=[n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSIONS_LIST,async n=>await u.listSessions(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_METADATA,async n=>await u.getSessionMetadata(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_CONFIG_GET,async n=>await u.getSessionConfig(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_CONFIG_SET,async n=>(await u.setSessionConfig(n),{})),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_MESSAGES,async n=>await u.getSessionMessages(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_SNAPSHOT,async n=>await u.getSessionSnapshot(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_SPAWN,async n=>await u.spawnSession(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_RESUME,async n=>await u.resumeSession(n)),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_SESSION_RENAME,async n=>(await u.renameSession(n),{})),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_AGENT_RUN_INTERRUPT,async n=>(await u.interruptRun(n),{}))];return()=>{for(let c of p)n.removeRpcHandler(c)}}var AgentIntegrationRuntimeState=class{activeRunsById=new Map;activeRunIdBySessionId=new Map;subscribersByRunId=new Map;recordRunStarted(n){let c=randomUUID$1();return this.activeRunsById.set(c,{config:n.config,controller:n.controller,metadata:n.metadata,sessionId:n.sessionId}),n.sessionId!==void 0&&this.activeRunIdBySessionId.set(n.sessionId,c),c}hasActiveRunForSession(n){return this.activeRunIdBySessionId.has(n)}hasActiveRun(n){return this.activeRunsById.has(n)}getActiveRunId(n){return this.activeRunIdBySessionId.get(n)??null}getActiveSessionConfig(n){let c=this.readActiveRunForSession(n);return c?c.config:null}getActiveSessionMetadata(n){let c=this.readActiveRunForSession(n);return c?c.metadata:null}readOwnedRun(n,c){let u=this.activeRunsById.get(n);return!u||u.controller!==c?null:u}bindRunToSession(n,c,u){let p=this.readOwnedRun(n,c);p&&(p.sessionId=u,p.metadata={...p.metadata,sessionId:u},this.activeRunIdBySessionId.set(u,n))}updateActiveSessionConfig(n,c){let u=this.readActiveRunForSession(n);u&&(u.config=c)}updateActiveSessionMetadata(n){let c=this.readActiveRunForSession(n.sessionId);c&&(c.metadata={...c.metadata,...n.patch,sessionId:n.sessionId})}subscribeToRun(n,c){let u=this.subscribersByRunId.get(n)??new Set;return u.add(c),this.subscribersByRunId.set(n,u),()=>{let u=this.subscribersByRunId.get(n);u&&(u.delete(c),u.size===0&&this.subscribersByRunId.delete(n))}}createRunEventGenerator(n){if(!this.activeRunsById.has(n))return(async function*(){})();let c=[],u=!1,p=null,h=this.subscribeToRun(n,{onEvent:n=>{c.push(n.event);let u=p;p=null,u?.()},onTerminal:()=>{u=!0;let n=p;p=null,n?.()}});return(async function*(){try{for(;!(u&&c.length===0);){if(c.length===0){await new Promise(n=>{p=n});continue}let n=c.shift();n&&(yield n)}}finally{h()}})()}emitRunEvent(n){let c=this.subscribersByRunId.get(n.runId);if(!(!c||c.size===0))for(let u of c)u.onEvent(n)}emitRunTerminal(n){let c=this.subscribersByRunId.get(n.runId);if(!(!c||c.size===0))for(let u of c)u.onTerminal(n)}interruptRun(n){let c=this.activeRunsById.get(n);if(!c)throw Error(`Agent run is not running: ${n}`);c.controller.abort()}completeOwnedRun(n,c){let u=this.readOwnedRun(n,c);u&&(this.activeRunsById.delete(n),u.sessionId!==void 0&&this.activeRunIdBySessionId.get(u.sessionId)===n&&this.activeRunIdBySessionId.delete(u.sessionId))}readActiveRunForSession(n){let c=this.activeRunIdBySessionId.get(n);return c?this.activeRunsById.get(c)??null:null}};const DEVICE_REPORTED_OS_PLATFORM_ALIASES={android:`android`,darwin:`macos`,ios:`ios`,linux:`linux`,macos:`macos`,web:`web`,win32:`windows`,windows:`windows`},normalizeDeviceReportedOsPlatform=n=>{let c=typeof n==`string`?trimAndLowercase(n):``;return!c||!(c in DEVICE_REPORTED_OS_PLATFORM_ALIASES)?null:DEVICE_REPORTED_OS_PLATFORM_ALIASES[c]},HOST_DEVICE_INFO_TIMEOUT_MS=3e3,LINUX_OS_RELEASE_PATHS=[`/etc/os-release`,`/usr/lib/os-release`],LINUX_SYS_VENDOR_PATH=`/sys/devices/virtual/dmi/id/sys_vendor`,LINUX_PRODUCT_NAME_PATH=`/sys/devices/virtual/dmi/id/product_name`,LINUX_PRODUCT_VERSION_PATH=`/sys/devices/virtual/dmi/id/product_version`,LINE_SPLIT_REGEX=/\r?\n/,WINDOWS_POWERSHELL_COMMAND$1=[`$os = Get-CimInstance Win32_OperatingSystem`,`$cs = Get-CimInstance Win32_ComputerSystem`,`$csp = Get-CimInstance Win32_ComputerSystemProduct`,`[pscustomobject]@{`,` osVersion = $os.Version`,` osBuild = $os.BuildNumber`,` manufacturer = $cs.Manufacturer`,` modelName = $cs.Model`,` modelIdentifier = $csp.Version`,`} | ConvertTo-Json -Compress`].join(`; `),readTrimmedValue=n=>typeof n==`string`&&n.trim()?n.trim():null,normalizeHostOsPlatform=n=>normalizeDeviceReportedOsPlatform(n)??`linux`,normalizeCpuArchitecture=n=>{let c=readTrimmedValue(n);if(!c)return null;let u=c.toLowerCase();return u.includes(`arm64`)||u.includes(`aarch64`)?`arm64`:u===`arm`||u.startsWith(`armv`)?`arm`:u.includes(`x86_64`)||u.includes(`amd64`)||u===`x64`?`x64`:u===`ia32`||u===`x86`||u===`i386`||u===`i686`?`ia32`:c},readCommandStdout=async(n,c)=>{try{return readTrimmedValue(await new Promise((u,p)=>{execFile$1(n,c,{encoding:`utf8`,env:process.env,timeout:HOST_DEVICE_INFO_TIMEOUT_MS},(n,c)=>{if(n){p(n);return}u(c)})}))}catch{return null}},readCommandStdoutWithFallback=async n=>{for(let{command:c,args:u}of n){let n=await readCommandStdout(c,u);if(n)return n}return null},readFileValue=async n=>{try{return readTrimmedValue(await readFile$1(n,`utf8`))}catch{return null}},parseMacModelName=n=>{try{return readTrimmedValue(JSON.parse(n).SPHardwareDataType?.[0]?.machine_name)}catch{return null}},parseWindowsHostInfo=n=>{try{let c=JSON.parse(n);return{osVersion:readTrimmedValue(c.osVersion),osBuild:readTrimmedValue(c.osBuild),manufacturer:readTrimmedValue(c.manufacturer),modelName:readTrimmedValue(c.modelName),modelIdentifier:readTrimmedValue(c.modelIdentifier)}}catch{return null}},parseOsRelease=n=>{let c=new Map;for(let u of n.split(LINE_SPLIT_REGEX)){let n=u.trim();if(!n||n.startsWith(`#`))continue;let p=n.indexOf(`=`);if(p<=0)continue;let h=trimAndUppercase(n.slice(0,p)),x=n.slice(p+1).trim(),w=x.startsWith(`"`)&&x.endsWith(`"`)?x.slice(1,-1):x;c.set(h,w)}return{versionId:readTrimmedValue(c.get(`VERSION_ID`)),buildId:readTrimmedValue(c.get(`BUILD_ID`))}},readLinuxOsRelease=async()=>{for(let n of LINUX_OS_RELEASE_PATHS){let c=await readFileValue(n);if(c)return parseOsRelease(c)}return null},readMacModelName=async()=>{let n=await readCommandStdout(`system_profiler`,[`SPHardwareDataType`,`-json`]);return n?parseMacModelName(n):null},readMacModelIdentifier=async()=>await readCommandStdout(`sysctl`,[`-n`,`hw.model`]),readWindowsHostInfo=async()=>{let n=await readCommandStdoutWithFallback([{command:`powershell.exe`,args:[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-Command`,WINDOWS_POWERSHELL_COMMAND$1]},{command:`powershell`,args:[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-Command`,WINDOWS_POWERSHELL_COMMAND$1]}]);return n?parseWindowsHostInfo(n):null},createBaseDeviceInfo=n=>({osPlatform:n,osVersion:null,osBuild:null,cpuArchitecture:normalizeCpuArchitecture(process.arch),manufacturer:null,modelName:null,modelIdentifier:null}),readMacDeviceInfo=async()=>{let[n,c,u,p]=await Promise.all([readCommandStdout(`sw_vers`,[`-productVersion`]),readCommandStdout(`sw_vers`,[`-buildVersion`]),readMacModelName(),readMacModelIdentifier()]);return{...createBaseDeviceInfo(`macos`),osVersion:n,osBuild:c,manufacturer:`Apple`,modelName:u,modelIdentifier:p}},readLinuxDeviceInfo=async()=>{let[n,c,u,p,h]=await Promise.all([readLinuxOsRelease(),readCommandStdout(`uname`,[`-r`]),readFileValue(LINUX_SYS_VENDOR_PATH),readFileValue(LINUX_PRODUCT_NAME_PATH),readFileValue(LINUX_PRODUCT_VERSION_PATH)]);return{...createBaseDeviceInfo(`linux`),osVersion:n?.versionId??null,osBuild:n?.buildId??c,manufacturer:u,modelName:p,modelIdentifier:h}},readWindowsDeviceInfo=async()=>{let n=await readWindowsHostInfo();return{...createBaseDeviceInfo(`windows`),osVersion:n?.osVersion??null,osBuild:n?.osBuild??null,manufacturer:n?.manufacturer??null,modelName:n?.modelName??null,modelIdentifier:n?.modelIdentifier??null}},HOST_DEVICE_INFO_READERS={linux:readLinuxDeviceInfo,macos:readMacDeviceInfo,windows:readWindowsDeviceInfo},getHostDeviceInfo=async()=>{let n=normalizeHostOsPlatform(process.platform),c=HOST_DEVICE_INFO_READERS[n];return c?await c():createBaseDeviceInfo(n)},HOST_COMMAND_CAPABILITY_NAME={TMUX:`tmux`,CODEX:`codex`,CLAUDE:`claude`},CODEX_EXECUTABLE_ENV_KEYS$1=[`CODEX_EXECUTABLE`,`CODEX_EXECUTABLE_PATH`],CLAUDE_CODE_EXECUTABLE_ENV_KEYS$1=[`CLAUDE_CODE_EXECUTABLE`,`CLAUDE_CODE_EXECUTABLE_PATH`],HOST_COMMAND_CAPABILITY_DEFINITIONS={[HOST_COMMAND_CAPABILITY_NAME.TMUX]:{command:`tmux`},[HOST_COMMAND_CAPABILITY_NAME.CODEX]:{command:`codex`,probeOptions:{envKeys:CODEX_EXECUTABLE_ENV_KEYS$1}},[HOST_COMMAND_CAPABILITY_NAME.CLAUDE]:{command:`claude`,probeOptions:{envKeys:CLAUDE_CODE_EXECUTABLE_ENV_KEYS$1}}},buildCliDeviceName=()=>`Syncless CLI (${hostname()})`,readHostDeviceInfo=getHostDeviceInfo;let cliHostDeviceInfoPromise=null;const getCliHostDeviceInfo=async()=>(cliHostDeviceInfoPromise??=readHostDeviceInfo(),await cliHostDeviceInfoPromise),probeCliAgentCapability=n=>{try{let c=HOST_COMMAND_CAPABILITY_DEFINITIONS[n];return probeExecutableCommand(c.command,c.probeOptions).available}catch{return!1}},waitForRuntimeAuthentication=async n=>{let c=n.useConnectionUIStore.getState().status;if(c===ConnectionUIStatus.SIGNED_OUT){let c=n.useLoginCycleStore.getState().errorMessage;if(c)throw Error(c)}if(c===ConnectionUIStatus.ONLINE){await n.provider.sendRpc(WS_RPC_CHANNELS.CONNECTION_PING,{sentAt:new Date().toISOString()});return}await new Promise((c,u)=>{let p=()=>{},h=n.useConnectionUIStore.subscribe(async x=>{if(x.status===ConnectionUIStatus.ONLINE)try{await n.provider.sendRpc(WS_RPC_CHANNELS.CONNECTION_PING,{sentAt:new Date().toISOString()}),h(),p(),c()}catch(n){h(),p(),u(n)}});p=n.useLoginCycleStore.subscribe(n=>{n.status===LoginCycleStatus.ERROR&&(h(),p(),u(Error(n.errorMessage??`Authentication failed`)))})})},createCliNetworkRuntime=n=>{let c=createNetworkRuntime({apiBaseUrl:n.endpoints.apiBaseUrl,httpFetch:createCliObservedFetch(`cli.auth`),observability:getCliObservability().createNetworkPort(),wsBaseUrl:n.endpoints.wsBaseUrl,persistence:cliPersistenceStore,providers:{github:GitHubOAuthLoginAdapter,google:GoogleOAuthLoginAdapter,slack:SlackOAuthLoginAdapter,googleWorkspace:GoogleWorkspaceSSOLoginAdapter},hooks:{getDeviceCode:async()=>n.deviceCode,getDeviceInfo:async()=>await getCliHostDeviceInfo(),getDeviceMetadata:n.getDeviceMetadata??(async()=>null),getDeviceName:async()=>buildCliDeviceName(),getDeviceType:async()=>`cli_host`,getUserAgent:async()=>`echo-cli`,openExternalUrl:n.onExternalUrl,supportBrowser:async()=>!1,supportClaude:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.CLAUDE),supportCodex:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.CODEX),supportTmux:async()=>probeCliAgentCapability(HOST_COMMAND_CAPABILITY_NAME.TMUX)},callbacks:n.callbacks}),u=bindCliAuthObservabilityScope(c),p=c.stop;return c.stop=()=>{u(),p()},c},getRuntimeAuthError=n=>n.useLoginCycleStore.getState().status===LoginCycleStatus.ERROR?n.useLoginCycleStore.getState().errorMessage:null,loginWithBootstrapToken=async n=>{let c=await exchangeCliSessionBootstrap(n.endpoints.apiBaseUrl,{token:n.token,deviceCode:n.deviceCode,deviceName:buildCliDeviceName()},{fetchImpl:createCliObservedFetch(`cli.auth.bootstrap`)});await saveAuthSession({email:c.email,token:c.token,expiresAt:c.expiresAt,updatedAt:c.updatedAt,userId:c.userId,name:c.name,avatarUrl:c.avatarUrl??null,onboardingCompleted:!1,projectTemplateOnboardingCompleted:!1},n.endpoints)},toLogPayload=n=>n.map(n=>`${n}\n`).join(``),createCliLogFileWriter=()=>{let n=Promise.resolve(),c=null;return{appendLines:u=>{if(u.length===0)return;let p=toLogPayload(u);n=n.then(async()=>{await mkdir(getLogsDirectoryPath(),{recursive:!0}),await appendFile(getDailyLogPath(new Date),p,`utf8`)}).catch(n=>{c=n})},flush:async()=>{if(await n,!c)return;let u=c;throw c=null,u instanceof Error?u:Error(String(u))}}};var Nj=Object.create,{getPrototypeOf:Vj,defineProperty:D5,getOwnPropertyNames:wj}=Object,Oj=Object.prototype.hasOwnProperty;function Bj(n){return this[n]}var qj,Dj,VH=(n,c,u)=>{var p=typeof n==`object`&&!!n;if(p){var h=c?qj??=new WeakMap:Dj??=new WeakMap,x=h.get(n);if(x)return x}u=n==null?{}:Nj(Vj(n));let w=c||!n||!n.__esModule?D5(u,`default`,{value:n,enumerable:!0}):u;for(let c of wj(n))Oj.call(w,c)||D5(w,c,{get:Bj.bind(n,c),enumerable:!0});return p&&h.set(n,w),w},k=(n,c)=>()=>(c||n((c={exports:{}}).exports,c),c.exports),Lj=n=>n;function jj(n,c){this[n]=Lj.bind(null,c)}var z1=(n,c)=>{for(var u in c)D5(n,u,{get:c[u],enumerable:!0,configurable:!0,set:jj.bind(c,u)})},Fj=Symbol.dispose||Symbol.for(`Symbol.dispose`),Mj=Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`),w$=(n,c,u)=>{if(c!=null){if(typeof c!=`object`&&typeof c!=`function`)throw TypeError(`Object expected to be assigned to "using" declaration`);var p;if(u&&(p=c[Mj]),p===void 0&&(p=c[Fj]),typeof p!=`function`)throw TypeError(`Object not disposable`);n.push([u,p,c])}else u&&n.push([u]);return c},O$=(n,c,u)=>{var p=typeof SuppressedError==`function`?SuppressedError:function(n,c,u,p){return p=Error(u),p.name=`SuppressedError`,p.error=n,p.suppressed=c,p},h=n=>c=u?new p(n,c,`An error was suppressed during disposal`):(u=!0,n),x=p=>{for(;p=n.pop();)try{var w=p[1]&&p[1].call(p[2]);if(p[0])return Promise.resolve(w).then(x,n=>(h(n),x()))}catch(n){h(n)}if(u)throw c};return x()},v9=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class c{}n._CodeOrName=c,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class u extends c{constructor(c){if(super(),!n.IDENTIFIER.test(c))throw Error(`CodeGen: name must be a valid identifier`);this.str=c}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}n.Name=u;class p extends c{constructor(n){super(),this._items=typeof n==`string`?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===``||n===`""`}get str(){var n;return this._str??=this._items.reduce((n,c)=>`${n}${c}`,``)}get names(){var n;return this._names??=this._items.reduce((n,c)=>(c instanceof u&&(n[c.str]=(n[c.str]||0)+1),n),{})}}n._Code=p,n.nil=new p(``);function h(n,...c){let u=[n[0]],h=0;for(;h<c.length;)T(u,c[h]),u.push(n[++h]);return new p(u)}n._=h;var x=new p(`+`);function w(n,...c){let u=[L(n[0])],h=0;for(;h<c.length;)u.push(x),T(u,c[h]),u.push(x,L(n[++h]));return O(u),new p(u)}n.str=w;function T(n,c){c instanceof p?n.push(...c._items):c instanceof u?n.push(c):n.push(N(c))}n.addCodeArg=T;function O(n){let c=1;for(;c<n.length-1;){if(n[c]===x){let u=A(n[c-1],n[c+1]);if(u!==void 0){n.splice(c-1,3,u);continue}n[c++]=`+`}c++}}function A(n,c){if(c===`""`)return n;if(n===`""`)return c;if(typeof n==`string`)return c instanceof u||n[n.length-1]!==`"`?void 0:typeof c==`string`?c[0]===`"`?n.slice(0,-1)+c.slice(1):void 0:`${n.slice(0,-1)}${c}"`;if(typeof c==`string`&&c[0]===`"`&&!(n instanceof u))return`"${n}${c.slice(1)}`}function j(n,c){return c.emptyStr()?n:n.emptyStr()?c:w`${n}${c}`}n.strConcat=j;function N(n){return typeof n==`number`||typeof n==`boolean`||n===null?n:L(Array.isArray(n)?n.join(`,`):n)}function I(n){return new p(L(n))}n.stringify=I;function L(n){return JSON.stringify(n).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}n.safeStringify=L;function z(c){return typeof c==`string`&&n.IDENTIFIER.test(c)?new p(`.${c}`):h`[${c}]`}n.getProperty=z;function B(c){if(typeof c==`string`&&n.IDENTIFIER.test(c))return new p(`${c}`);throw Error(`CodeGen: invalid export name: ${c}, use explicit $id name mapping`)}n.getEsmExportName=B;function V(n){return new p(n.toString())}n.regexpCode=V}),d3=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;var c=v9();class u extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`),this.value=n.value}}var p;(function(n){n[n.Started=0]=`Started`,n[n.Completed=1]=`Completed`})(p||(n.UsedValueState=p={})),n.varKinds={const:new c.Name(`const`),let:new c.Name(`let`),var:new c.Name(`var`)};class h{constructor({prefixes:n,parent:c}={}){this._names={},this._prefixes=n,this._parent=c}toName(n){return n instanceof c.Name?n:this.name(n)}name(n){return new c.Name(this._newName(n))}_newName(n){let c=this._names[n]||this._nameGroup(n);return`${n}${c.index++}`}_nameGroup(n){var c,u;if((this._parent?._prefixes)?.has(n)||this._prefixes&&!this._prefixes.has(n))throw Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}}n.Scope=h;class x extends c.Name{constructor(n,c){super(c),this.prefix=n}setValue(n,{property:u,itemIndex:p}){this.value=n,this.scopePath=c._`.${new c.Name(u)}[${p}]`}}n.ValueScopeName=x;var w=c._`\n`;class T extends h{constructor(n){super(n),this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?w:c.nil}}get(){return this._scope}name(n){return new x(n,this._newName(n))}value(n,c){var u;if(c.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let p=this.toName(n),{prefix:h}=p,x=c.key??c.ref,w=this._values[h];if(w){let n=w.get(x);if(n)return n}else w=this._values[h]=new Map;w.set(x,p);let T=this._scope[h]||(this._scope[h]=[]),O=T.length;return T[O]=c.ref,p.setValue(c,{property:h,itemIndex:O}),p}getValue(n,c){let u=this._values[n];if(u)return u.get(c)}scopeRefs(n,u=this._values){return this._reduceValues(u,u=>{if(u.scopePath===void 0)throw Error(`CodeGen: name "${u}" has no value`);return c._`${n}${u.scopePath}`})}scopeCode(n=this._values,c,u){return this._reduceValues(n,n=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},c,u)}_reduceValues(h,x,w={},T){let O=c.nil;for(let A in h){let j=h[A];if(!j)continue;let N=w[A]=w[A]||new Map;j.forEach(h=>{if(N.has(h))return;N.set(h,p.Started);let w=x(h);if(w){let u=this.opts.es5?n.varKinds.var:n.varKinds.const;O=c._`${O}${u} ${h} = ${w};${this.opts._n}`}else if(w=T?.(h))O=c._`${O}${w}${this.opts._n}`;else throw new u(h);N.set(h,p.Completed)})}return O}}n.ValueScope=T}),a=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;var c=v9(),u=d3(),p=v9();Object.defineProperty(n,`_`,{enumerable:!0,get:function(){return p._}}),Object.defineProperty(n,`str`,{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(n,`strConcat`,{enumerable:!0,get:function(){return p.strConcat}}),Object.defineProperty(n,`nil`,{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(n,`getProperty`,{enumerable:!0,get:function(){return p.getProperty}}),Object.defineProperty(n,`stringify`,{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(n,`regexpCode`,{enumerable:!0,get:function(){return p.regexpCode}}),Object.defineProperty(n,`Name`,{enumerable:!0,get:function(){return p.Name}});var h=d3();Object.defineProperty(n,`Scope`,{enumerable:!0,get:function(){return h.Scope}}),Object.defineProperty(n,`ValueScope`,{enumerable:!0,get:function(){return h.ValueScope}}),Object.defineProperty(n,`ValueScopeName`,{enumerable:!0,get:function(){return h.ValueScopeName}}),Object.defineProperty(n,`varKinds`,{enumerable:!0,get:function(){return h.varKinds}}),n.operators={GT:new c._Code(`>`),GTE:new c._Code(`>=`),LT:new c._Code(`<`),LTE:new c._Code(`<=`),EQ:new c._Code(`===`),NEQ:new c._Code(`!==`),NOT:new c._Code(`!`),OR:new c._Code(`||`),AND:new c._Code(`&&`),ADD:new c._Code(`+`)};class x{optimizeNodes(){return this}optimizeNames(n,c){return this}}class w extends x{constructor(n,c,u){super(),this.varKind=n,this.name=c,this.rhs=u}render({es5:n,_n:c}){let p=n?u.varKinds.var:this.varKind,h=this.rhs===void 0?``:` = ${this.rhs}`;return`${p} ${this.name}${h};`+c}optimizeNames(n,c){if(n[this.name.str])return this.rhs&&=ae(this.rhs,n,c),this}get names(){return this.rhs instanceof c._CodeOrName?this.rhs.names:{}}}class T extends x{constructor(n,c,u){super(),this.lhs=n,this.rhs=c,this.sideEffects=u}render({_n:n}){return`${this.lhs} = ${this.rhs};`+n}optimizeNames(n,u){if(!(this.lhs instanceof c.Name&&!n[this.lhs.str]&&!this.sideEffects))return this.rhs=ae(this.rhs,n,u),this}get names(){return ie(this.lhs instanceof c.Name?{}:{...this.lhs.names},this.rhs)}}class O extends T{constructor(n,c,u,p){super(n,u,p),this.op=c}render({_n:n}){return`${this.lhs} ${this.op}= ${this.rhs};`+n}}class A extends x{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`${this.label}:`+n}}class j extends x{constructor(n){super(),this.label=n,this.names={}}render({_n:n}){return`break${this.label?` ${this.label}`:``};`+n}}class N extends x{constructor(n){super(),this.error=n}render({_n:n}){return`throw ${this.error};`+n}get names(){return this.error.names}}class I extends x{constructor(n){super(),this.code=n}render({_n:n}){return`${this.code};`+n}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(n,c){return this.code=ae(this.code,n,c),this}get names(){return this.code instanceof c._CodeOrName?this.code.names:{}}}class L extends x{constructor(n=[]){super(),this.nodes=n}render(n){return this.nodes.reduce((c,u)=>c+u.render(n),``)}optimizeNodes(){let{nodes:n}=this,c=n.length;for(;c--;){let u=n[c].optimizeNodes();Array.isArray(u)?n.splice(c,1,...u):u?n[c]=u:n.splice(c,1)}return n.length>0?this:void 0}optimizeNames(n,c){let{nodes:u}=this,p=u.length;for(;p--;){let h=u[p];h.optimizeNames(n,c)||(oe(n,h.names),u.splice(p,1))}return u.length>0?this:void 0}get names(){return this.nodes.reduce((n,c)=>X(n,c.names),{})}}class z extends L{render(n){return`{`+n._n+super.render(n)+`}`+n._n}}class B extends L{}class V extends z{}V.kind=`else`;class H extends z{constructor(n,c){super(c),this.condition=n}render(n){let c=`if(${this.condition})`+super.render(n);return this.else&&(c+=`else `+this.else.render(n)),c}optimizeNodes(){super.optimizeNodes();let n=this.condition;if(n===!0)return this.nodes;let c=this.else;if(c){let n=c.optimizeNodes();c=this.else=Array.isArray(n)?new V(n):n}if(c)return n===!1?c instanceof H?c:c.nodes:this.nodes.length?this:new H(se(n),c instanceof H?[c]:c.nodes);if(!(n===!1||!this.nodes.length))return this}optimizeNames(n,c){var u;if(this.else=this.else?.optimizeNames(n,c),super.optimizeNames(n,c)||this.else)return this.condition=ae(this.condition,n,c),this}get names(){let n=super.names;return ie(n,this.condition),this.else&&X(n,this.else.names),n}}H.kind=`if`;class U extends z{}U.kind=`for`;class W extends U{constructor(n){super(),this.iteration=n}render(n){return`for(${this.iteration})`+super.render(n)}optimizeNames(n,c){if(super.optimizeNames(n,c))return this.iteration=ae(this.iteration,n,c),this}get names(){return X(super.names,this.iteration.names)}}class G extends U{constructor(n,c,u,p){super(),this.varKind=n,this.name=c,this.from=u,this.to=p}render(n){let c=n.es5?u.varKinds.var:this.varKind,{name:p,from:h,to:x}=this;return`for(${c} ${p}=${h}; ${p}<${x}; ${p}++)`+super.render(n)}get names(){return ie(ie(super.names,this.from),this.to)}}class K extends U{constructor(n,c,u,p){super(),this.loop=n,this.varKind=c,this.name=u,this.iterable=p}render(n){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(n)}optimizeNames(n,c){if(super.optimizeNames(n,c))return this.iterable=ae(this.iterable,n,c),this}get names(){return X(super.names,this.iterable.names)}}class ee extends z{constructor(n,c,u){super(),this.name=n,this.args=c,this.async=u}render(n){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(n)}}ee.kind=`func`;class te extends L{render(n){return`return `+super.render(n)}}te.kind=`return`;class J extends z{render(n){let c=`try`+super.render(n);return this.catch&&(c+=this.catch.render(n)),this.finally&&(c+=this.finally.render(n)),c}optimizeNodes(){var n,c;return super.optimizeNodes(),(n=this.catch)==null||n.optimizeNodes(),(c=this.finally)==null||c.optimizeNodes(),this}optimizeNames(n,c){var u,p;return super.optimizeNames(n,c),(u=this.catch)==null||u.optimizeNames(n,c),(p=this.finally)==null||p.optimizeNames(n,c),this}get names(){let n=super.names;return this.catch&&X(n,this.catch.names),this.finally&&X(n,this.finally.names),n}}class Y extends z{constructor(n){super(),this.error=n}render(n){return`catch(${this.error})`+super.render(n)}}Y.kind=`catch`;class ne extends z{render(n){return`finally`+super.render(n)}}ne.kind=`finally`;class re{constructor(n,c={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...c,_n:c.lines?`
|
|
78
78
|
`:``},this._extScope=n,this._scope=new u.Scope({parent:n}),this._nodes=[new B]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,c){let u=this._extScope.value(n,c);return(this._values[u.prefix]||(this._values[u.prefix]=new Set)).add(u),u}getScopeValue(n,c){return this._extScope.getValue(n,c)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,c,u,p){let h=this._scope.toName(c);return u!==void 0&&p&&(this._constants[h.str]=u),this._leafNode(new w(n,h,u)),h}const(n,c,p){return this._def(u.varKinds.const,n,c,p)}let(n,c,p){return this._def(u.varKinds.let,n,c,p)}var(n,c,p){return this._def(u.varKinds.var,n,c,p)}assign(n,c,u){return this._leafNode(new T(n,c,u))}add(c,u){return this._leafNode(new O(c,n.operators.ADD,u))}code(n){return typeof n==`function`?n():n!==c.nil&&this._leafNode(new I(n)),this}object(...n){let u=[`{`];for(let[p,h]of n)u.length>1&&u.push(`,`),u.push(p),(p!==h||this.opts.es5)&&(u.push(`:`),(0,c.addCodeArg)(u,h));return u.push(`}`),new c._Code(u)}if(n,c,u){if(this._blockNode(new H(n)),c&&u)this.code(c).else().code(u).endIf();else if(c)this.code(c).endIf();else if(u)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(n){return this._elseNode(new H(n))}else(){return this._elseNode(new V)}endIf(){return this._endBlockNode(H,V)}_for(n,c){return this._blockNode(n),c&&this.code(c).endFor(),this}for(n,c){return this._for(new W(n),c)}forRange(n,c,p,h,x=this.opts.es5?u.varKinds.var:u.varKinds.let){let w=this._scope.toName(n);return this._for(new G(x,w,c,p),()=>h(w))}forOf(n,p,h,x=u.varKinds.const){let w=this._scope.toName(n);if(this.opts.es5){let n=p instanceof c.Name?p:this.var(`_arr`,p);return this.forRange(`_i`,0,c._`${n}.length`,u=>{this.var(w,c._`${n}[${u}]`),h(w)})}return this._for(new K(`of`,x,w,p),()=>h(w))}forIn(n,p,h,x=this.opts.es5?u.varKinds.var:u.varKinds.const){if(this.opts.ownProperties)return this.forOf(n,c._`Object.keys(${p})`,h);let w=this._scope.toName(n);return this._for(new K(`in`,x,w,p),()=>h(w))}endFor(){return this._endBlockNode(U)}label(n){return this._leafNode(new A(n))}break(n){return this._leafNode(new j(n))}return(n){let c=new te;if(this._blockNode(c),this.code(n),c.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(te)}try(n,c,u){if(!c&&!u)throw Error(`CodeGen: "try" without "catch" and "finally"`);let p=new J;if(this._blockNode(p),this.code(n),c){let n=this.name(`e`);this._currNode=p.catch=new Y(n),c(n)}return u&&(this._currNode=p.finally=new ne,this.code(u)),this._endBlockNode(Y,ne)}throw(n){return this._leafNode(new N(n))}block(n,c){return this._blockStarts.push(this._nodes.length),n&&this.code(n).endBlock(c),this}endBlock(n){let c=this._blockStarts.pop();if(c===void 0)throw Error(`CodeGen: not in self-balancing block`);let u=this._nodes.length-c;if(u<0||n!==void 0&&u!==n)throw Error(`CodeGen: wrong number of nodes: ${u} vs ${n} expected`);return this._nodes.length=c,this}func(n,u=c.nil,p,h){return this._blockNode(new ee(n,u,p)),h&&this.code(h).endFunc(),this}endFunc(){return this._endBlockNode(ee)}optimize(n=1){for(;n-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(n){return this._currNode.nodes.push(n),this}_blockNode(n){this._currNode.nodes.push(n),this._nodes.push(n)}_endBlockNode(n,c){let u=this._currNode;if(u instanceof n||c&&u instanceof c)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${c?`${n.kind}/${c.kind}`:n.kind}"`)}_elseNode(n){let c=this._currNode;if(!(c instanceof H))throw Error(`CodeGen: "else" without "if"`);return this._currNode=c.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let c=this._nodes;c[c.length-1]=n}}n.CodeGen=re;function X(n,c){for(let u in c)n[u]=(n[u]||0)+(c[u]||0);return n}function ie(n,u){return u instanceof c._CodeOrName?X(n,u.names):n}function ae(n,u,p){if(n instanceof c.Name)return h(n);if(!x(n))return n;return new c._Code(n._items.reduce((n,u)=>(u instanceof c.Name&&(u=h(u)),u instanceof c._Code?n.push(...u._items):n.push(u),n),[]));function h(n){let c=p[n.str];return c===void 0||u[n.str]!==1?n:(delete u[n.str],c)}function x(n){return n instanceof c._Code&&n._items.some(n=>n instanceof c.Name&&u[n.str]===1&&p[n.str]!==void 0)}}function oe(n,c){for(let u in c)n[u]=(n[u]||0)-(c[u]||0)}function se(n){return typeof n==`boolean`||typeof n==`number`||n===null?!n:c._`!${pe(n)}`}n.not=se;var ce=fe(n.operators.AND);function le(...n){return n.reduce(ce)}n.and=le;var ue=fe(n.operators.OR);function de(...n){return n.reduce(ue)}n.or=de;function fe(n){return(u,p)=>u===c.nil?p:p===c.nil?u:c._`${pe(u)} ${n} ${pe(p)}`}function pe(n){return n instanceof c.Name?n:c._`(${n})`}}),Q$=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.checkStrictMode=n.getErrorPath=n.Type=n.useFunc=n.setEvaluated=n.evaluatedPropsToName=n.mergeEvaluated=n.eachItem=n.unescapeJsonPointer=n.escapeJsonPointer=n.escapeFragment=n.unescapeFragment=n.schemaRefOrVal=n.schemaHasRulesButRef=n.schemaHasRules=n.checkUnknownRules=n.alwaysValidSchema=n.toHash=void 0;var c=a(),u=v9();function p(n){let c={};for(let u of n)c[u]=!0;return c}n.toHash=p;function h(n,c){return typeof c==`boolean`?c:Object.keys(c).length===0?!0:(x(n,c),!w(c,n.self.RULES.all))}n.alwaysValidSchema=h;function x(n,c=n.schema){let{opts:u,self:p}=n;if(!u.strictSchema||typeof c==`boolean`)return;let h=p.RULES.keywords;for(let u in c)h[u]||K(n,`unknown keyword: "${u}"`)}n.checkUnknownRules=x;function w(n,c){if(typeof n==`boolean`)return!n;for(let u in n)if(c[u])return!0;return!1}n.schemaHasRules=w;function T(n,c){if(typeof n==`boolean`)return!n;for(let u in n)if(u!==`$ref`&&c.all[u])return!0;return!1}n.schemaHasRulesButRef=T;function O({topSchemaRef:n,schemaPath:u},p,h,x){if(!x){if(typeof p==`number`||typeof p==`boolean`)return p;if(typeof p==`string`)return c._`${p}`}return c._`${n}${u}${(0,c.getProperty)(h)}`}n.schemaRefOrVal=O;function A(n){return I(decodeURIComponent(n))}n.unescapeFragment=A;function j(n){return encodeURIComponent(N(n))}n.escapeFragment=j;function N(n){return typeof n==`number`?`${n}`:n.replace(/~/g,`~0`).replace(/\//g,`~1`)}n.escapeJsonPointer=N;function I(n){return n.replace(/~1/g,`/`).replace(/~0/g,`~`)}n.unescapeJsonPointer=I;function L(n,c){if(Array.isArray(n))for(let u of n)c(u);else c(n)}n.eachItem=L;function z({mergeNames:n,mergeToName:u,mergeValues:p,resultToName:h}){return(x,w,T,O)=>{let A=T===void 0?w:T instanceof c.Name?(w instanceof c.Name?n(x,w,T):u(x,w,T),T):w instanceof c.Name?(u(x,T,w),w):p(w,T);return O===c.Name&&!(A instanceof c.Name)?h(x,A):A}}n.mergeEvaluated={props:z({mergeNames:(n,u,p)=>n.if(c._`${p} !== true && ${u} !== undefined`,()=>{n.if(c._`${u} === true`,()=>n.assign(p,!0),()=>n.assign(p,c._`${p} || {}`).code(c._`Object.assign(${p}, ${u})`))}),mergeToName:(n,u,p)=>n.if(c._`${p} !== true`,()=>{u===!0?n.assign(p,!0):(n.assign(p,c._`${p} || {}`),V(n,p,u))}),mergeValues:(n,c)=>n===!0?!0:{...n,...c},resultToName:B}),items:z({mergeNames:(n,u,p)=>n.if(c._`${p} !== true && ${u} !== undefined`,()=>n.assign(p,c._`${u} === true ? true : ${p} > ${u} ? ${p} : ${u}`)),mergeToName:(n,u,p)=>n.if(c._`${p} !== true`,()=>n.assign(p,u===!0?!0:c._`${p} > ${u} ? ${p} : ${u}`)),mergeValues:(n,c)=>n===!0?!0:Math.max(n,c),resultToName:(n,c)=>n.var(`items`,c)})};function B(n,u){if(u===!0)return n.var(`props`,!0);let p=n.var(`props`,c._`{}`);return u!==void 0&&V(n,p,u),p}n.evaluatedPropsToName=B;function V(n,u,p){Object.keys(p).forEach(p=>n.assign(c._`${u}${(0,c.getProperty)(p)}`,!0))}n.setEvaluated=V;var H={};function U(n,c){return n.scopeValue(`func`,{ref:c,code:H[c.code]||(H[c.code]=new u._Code(c.code))})}n.useFunc=U;var W;(function(n){n[n.Num=0]=`Num`,n[n.Str=1]=`Str`})(W||(n.Type=W={}));function G(n,u,p){if(n instanceof c.Name){let h=u===W.Num;return p?h?c._`"[" + ${n} + "]"`:c._`"['" + ${n} + "']"`:h?c._`"/" + ${n}`:c._`"/" + ${n}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return p?(0,c.getProperty)(n).toString():`/`+N(n)}n.getErrorPath=G;function K(n,c,u=n.opts.strictSchema){if(u){if(c=`strict mode: ${c}`,u===!0)throw Error(c);n.self.logger.warn(c)}}n.checkStrictMode=K}),A4=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0});var c=a();n.default={data:new c.Name(`data`),valCxt:new c.Name(`valCxt`),instancePath:new c.Name(`instancePath`),parentData:new c.Name(`parentData`),parentDataProperty:new c.Name(`parentDataProperty`),rootData:new c.Name(`rootData`),dynamicAnchors:new c.Name(`dynamicAnchors`),vErrors:new c.Name(`vErrors`),errors:new c.Name(`errors`),this:new c.Name(`this`),self:new c.Name(`self`),scope:new c.Name(`scope`),json:new c.Name(`json`),jsonPos:new c.Name(`jsonPos`),jsonLen:new c.Name(`jsonLen`),jsonPart:new c.Name(`jsonPart`)}}),k9=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;var c=a(),u=Q$(),p=A4();n.keywordError={message:({keyword:n})=>c.str`must pass "${n}" keyword validation`},n.keyword$DataError={message:({keyword:n,schemaType:u})=>u?c.str`"${n}" keyword must be ${u} ($data)`:c.str`"${n}" keyword is invalid ($data)`};function h(u,p=n.keywordError,h,x){let{it:w}=u,{gen:T,compositeRule:j,allErrors:I}=w,L=N(u,p,h);x??(j||I)?O(T,L):A(w,c._`[${L}]`)}n.reportError=h;function x(c,u=n.keywordError,h){let{it:x}=c,{gen:w,compositeRule:T,allErrors:j}=x;O(w,N(c,u,h)),!(T||j)&&A(x,p.default.vErrors)}n.reportExtraError=x;function w(n,u){n.assign(p.default.errors,u),n.if(c._`${p.default.vErrors} !== null`,()=>n.if(u,()=>n.assign(c._`${p.default.vErrors}.length`,u),()=>n.assign(p.default.vErrors,null)))}n.resetErrorsCount=w;function T({gen:n,keyword:u,schemaValue:h,data:x,errsCount:w,it:T}){if(w===void 0)throw Error(`ajv implementation error`);let O=n.name(`err`);n.forRange(`i`,w,p.default.errors,w=>{n.const(O,c._`${p.default.vErrors}[${w}]`),n.if(c._`${O}.instancePath === undefined`,()=>n.assign(c._`${O}.instancePath`,(0,c.strConcat)(p.default.instancePath,T.errorPath))),n.assign(c._`${O}.schemaPath`,c.str`${T.errSchemaPath}/${u}`),T.opts.verbose&&(n.assign(c._`${O}.schema`,h),n.assign(c._`${O}.data`,x))})}n.extendErrors=T;function O(n,u){let h=n.const(`err`,u);n.if(c._`${p.default.vErrors} === null`,()=>n.assign(p.default.vErrors,c._`[${h}]`),c._`${p.default.vErrors}.push(${h})`),n.code(c._`${p.default.errors}++`)}function A(n,u){let{gen:p,validateName:h,schemaEnv:x}=n;x.$async?p.throw(c._`new ${n.ValidationError}(${u})`):(p.assign(c._`${h}.errors`,u),p.return(!1))}var j={keyword:new c.Name(`keyword`),schemaPath:new c.Name(`schemaPath`),params:new c.Name(`params`),propertyName:new c.Name(`propertyName`),message:new c.Name(`message`),schema:new c.Name(`schema`),parentSchema:new c.Name(`parentSchema`)};function N(n,u,p){let{createErrors:h}=n.it;return h===!1?c._`{}`:I(n,u,p)}function I(n,c,u={}){let{gen:p,it:h}=n,x=[L(h,u),z(n,u)];return B(n,c,x),p.object(...x)}function L({errorPath:n},{instancePath:h}){let x=h?c.str`${n}${(0,u.getErrorPath)(h,u.Type.Str)}`:n;return[p.default.instancePath,(0,c.strConcat)(p.default.instancePath,x)]}function z({keyword:n,it:{errSchemaPath:p}},{schemaPath:h,parentSchema:x}){let w=x?p:c.str`${p}/${n}`;return h&&(w=c.str`${w}${(0,u.getErrorPath)(h,u.Type.Str)}`),[j.schemaPath,w]}function B(n,{params:u,message:h},x){let{keyword:w,data:T,schemaValue:O,it:A}=n,{opts:N,propertyName:I,topSchemaRef:L,schemaPath:z}=A;x.push([j.keyword,w],[j.params,typeof u==`function`?u(n):u||c._`{}`]),N.messages&&x.push([j.message,typeof h==`function`?h(n):h]),N.verbose&&x.push([j.schema,O],[j.parentSchema,c._`${L}${z}`],[p.default.data,T]),I&&x.push([j.propertyName,I])}}),kO=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;var c=k9(),u=a(),p=A4(),h={message:`boolean schema is false`};function x(n){let{gen:c,schema:h,validateName:x}=n;h===!1?T(n,!1):typeof h==`object`&&h.$async===!0?c.return(p.default.data):(c.assign(u._`${x}.errors`,null),c.return(!0))}n.topBoolOrEmptySchema=x;function w(n,c){let{gen:u,schema:p}=n;p===!1?(u.var(c,!1),T(n)):u.var(c,!0)}n.boolOrEmptySchema=w;function T(n,u){let{gen:p,data:x}=n,w={gen:p,keyword:`false schema`,data:x,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:n};(0,c.reportError)(w,h,void 0,u)}}),$U=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRules=n.isJSONType=void 0;var c=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function u(n){return typeof n==`string`&&c.has(n)}n.isJSONType=u;function p(){let n={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}n.getRules=p}),XU=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.shouldUseRule=n.shouldUseGroup=n.schemaHasRulesForType=void 0;function c({schema:n,self:c},p){let h=c.RULES.types[p];return h&&h!==!0&&u(n,h)}n.schemaHasRulesForType=c;function u(n,c){return c.rules.some(c=>p(n,c))}n.shouldUseGroup=u;function p(n,c){var u;return n[c.keyword]!==void 0||c.definition.implements?.some(c=>n[c]!==void 0)}n.shouldUseRule=p}),_9=k(n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;var c=$U(),u=XU(),p=k9(),h=a(),x=Q$(),w;(function(n){n[n.Correct=0]=`Correct`,n[n.Wrong=1]=`Wrong`})(w||(n.DataType=w={}));function T(n){let c=O(n.type);if(c.includes(`null`)){if(n.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!c.length&&n.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);n.nullable===!0&&c.push(`null`)}return c}n.getSchemaTypes=T;function O(n){let u=Array.isArray(n)?n:n?[n]:[];if(u.every(c.isJSONType))return u;throw Error(`type must be JSONType or JSONType[]: `+u.join(`,`))}n.getJSONTypes=O;function A(n,c){let{gen:p,data:h,opts:x}=n,T=N(c,x.coerceTypes),O=c.length>0&&!(T.length===0&&c.length===1&&(0,u.schemaHasRulesForType)(n,c[0]));if(O){let u=B(c,h,x.strictNumbers,w.Wrong);p.if(u,()=>{T.length?I(n,c,T):H(n)})}return O}n.coerceAndCheckDataType=A;var j=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function N(n,c){return c?n.filter(n=>j.has(n)||c===`array`&&n===`array`):[]}function I(n,c,u){let{gen:p,data:x,opts:w}=n,T=p.let(`dataType`,h._`typeof ${x}`),O=p.let(`coerced`,h._`undefined`);w.coerceTypes===`array`&&p.if(h._`${T} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>p.assign(x,h._`${x}[0]`).assign(T,h._`typeof ${x}`).if(B(c,x,w.strictNumbers),()=>p.assign(O,x))),p.if(h._`${O} !== undefined`);for(let n of u)(j.has(n)||n===`array`&&w.coerceTypes===`array`)&&A(n);p.else(),H(n),p.endIf(),p.if(h._`${O} !== undefined`,()=>{p.assign(x,O),L(n,O)});function A(n){switch(n){case`string`:p.elseIf(h._`${T} == "number" || ${T} == "boolean"`).assign(O,h._`"" + ${x}`).elseIf(h._`${x} === null`).assign(O,h._`""`);return;case`number`:p.elseIf(h._`${T} == "boolean" || ${x} === null
|
|
79
79
|
|| (${T} == "string" && ${x} && ${x} == +${x})`).assign(O,h._`+${x}`);return;case`integer`:p.elseIf(h._`${T} === "boolean" || ${x} === null
|
|
80
80
|
|| (${T} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(O,h._`+${x}`);return;case`boolean`:p.elseIf(h._`${x} === "false" || ${x} === 0 || ${x} === null`).assign(O,!1).elseIf(h._`${x} === "true" || ${x} === 1`).assign(O,!0);return;case`null`:p.elseIf(h._`${x} === "" || ${x} === 0 || ${x} === false`),p.assign(O,null);return;case`array`:p.elseIf(h._`${T} === "string" || ${T} === "number"
|
|
@@ -185,8 +185,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
185
185
|
`,n.VT=`\v`,n.FF=`\f`,n.CR=`\r`,n.SO=``,n.SI=``,n.DLE=``,n.DC1=``,n.DC2=``,n.DC3=``,n.DC4=``,n.NAK=``,n.SYN=``,n.ETB=``,n.CAN=``,n.EM=``,n.SUB=``,n.ESC=`\x1B`,n.FS=``,n.GS=``,n.RS=``,n.US=``,n.SP=` `,n.DEL=``}(u||(c.C0=u={})),function(n){n.PAD=``,n.HOP=``,n.BPH=``,n.NBH=``,n.IND=``,n.NEL=`
`,n.SSA=``,n.ESA=``,n.HTS=``,n.HTJ=``,n.VTS=``,n.PLD=``,n.PLU=``,n.RI=``,n.SS2=``,n.SS3=``,n.DCS=``,n.PU1=``,n.PU2=``,n.STS=``,n.CCH=``,n.MW=``,n.SPA=``,n.EPA=``,n.SOS=``,n.SGCI=``,n.SCI=``,n.CSI=``,n.ST=``,n.OSC=``,n.PM=``,n.APC=``}(p||(c.C1=p={})),function(n){n.ST=`${u.ESC}\\`}(h||(c.C1_ESCAPED=h={}))},482:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},c.utf32ToString=function(n,c=0,u=n.length){let p=``;for(let h=c;h<u;++h){let c=n[h];c>65535?(c-=65536,p+=String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):p+=String.fromCharCode(c)}return p},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,c){let u=n.length;if(!u)return 0;let p=0,h=0;if(this._interim){let u=n.charCodeAt(h++);56320<=u&&u<=57343?c[p++]=1024*(this._interim-55296)+u-56320+65536:(c[p++]=this._interim,c[p++]=u),this._interim=0}for(let x=h;x<u;++x){let h=n.charCodeAt(x);if(55296<=h&&h<=56319){if(++x>=u)return this._interim=h,p;let w=n.charCodeAt(x);56320<=w&&w<=57343?c[p++]=1024*(h-55296)+w-56320+65536:(c[p++]=h,c[p++]=w)}else h!==65279&&(c[p++]=h)}return p}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,c){let u=n.length;if(!u)return 0;let p,h,x,w,T=0,O=0,A=0;if(this.interim[0]){let p=!1,h=this.interim[0];h&=(224&h)==192?31:(240&h)==224?15:7;let x,w=0;for(;(x=63&this.interim[++w])&&w<4;)h<<=6,h|=x;let O=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,j=O-w;for(;A<j;){if(A>=u)return 0;if(x=n[A++],(192&x)!=128){A--,p=!0;break}this.interim[w++]=x,h<<=6,h|=63&x}p||(O===2?h<128?A--:c[T++]=h:O===3?h<2048||h>=55296&&h<=57343||h===65279||(c[T++]=h):h<65536||h>1114111||(c[T++]=h)),this.interim.fill(0)}let j=u-4,N=A;for(;N<u;){for(;!(!(N<j)||128&(p=n[N])||128&(h=n[N+1])||128&(x=n[N+2])||128&(w=n[N+3]));)c[T++]=p,c[T++]=h,c[T++]=x,c[T++]=w,N+=4;if(p=n[N++],p<128)c[T++]=p;else if((224&p)==192){if(N>=u)return this.interim[0]=p,T;if(h=n[N++],(192&h)!=128){N--;continue}if(O=(31&p)<<6|63&h,O<128){N--;continue}c[T++]=O}else if((240&p)==224){if(N>=u)return this.interim[0]=p,T;if(h=n[N++],(192&h)!=128){N--;continue}if(N>=u)return this.interim[0]=p,this.interim[1]=h,T;if(x=n[N++],(192&x)!=128){N--;continue}if(O=(15&p)<<12|(63&h)<<6|63&x,O<2048||O>=55296&&O<=57343||O===65279)continue;c[T++]=O}else if((248&p)==240){if(N>=u)return this.interim[0]=p,T;if(h=n[N++],(192&h)!=128){N--;continue}if(N>=u)return this.interim[0]=p,this.interim[1]=h,T;if(x=n[N++],(192&x)!=128){N--;continue}if(N>=u)return this.interim[0]=p,this.interim[1]=h,this.interim[2]=x,T;if(w=n[N++],(192&w)!=128){N--;continue}if(O=(7&p)<<18|(63&h)<<12|(63&x)<<6|63&w,O<65536||O>1114111)continue;c[T++]=O}}return T}}},225:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.UnicodeV6=void 0;let p=u(480),h=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],x=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],w;c.UnicodeV6=class{constructor(){if(this.version=`6`,!w){w=new Uint8Array(65536),w.fill(1),w[0]=0,w.fill(0,1,32),w.fill(0,127,160),w.fill(2,4352,4448),w[9001]=2,w[9002]=2,w.fill(2,11904,42192),w[12351]=1,w.fill(2,44032,55204),w.fill(2,63744,64256),w.fill(2,65040,65050),w.fill(2,65072,65136),w.fill(2,65280,65377),w.fill(2,65504,65511);for(let n=0;n<h.length;++n)w.fill(0,h[n][0],h[n][1]+1)}}wcwidth(n){return n<32?0:n<127?1:n<65536?w[n]:function(n,c){let u,p=0,h=c.length-1;if(n<c[0][0]||n>c[h][1])return!1;for(;h>=p;)if(u=p+h>>1,n>c[u][1])p=u+1;else{if(!(n<c[u][0]))return!0;h=u-1}return!1}(n,x)?0:n>=131072&&n<=196605||n>=196608&&n<=262141?2:1}charProperties(n,c){let u=this.wcwidth(n),h=u===0&&c!==0;if(h){let n=p.UnicodeService.extractWidth(c);n===0?h=!1:n>u&&(u=n)}return p.UnicodeService.createPropertyValue(0,u,h)}}},981:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.WriteBuffer=void 0;let p=u(460),h=u(844);class x extends h.Disposable{constructor(n){super(),this._action=n,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(n,c){if(c!==void 0&&this._syncCalls>c)return void(this._syncCalls=0);if(this._pendingData+=n.length,this._writeBuffer.push(n),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(n,c){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=n.length,this._writeBuffer.push(n),this._callbacks.push(c),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=n.length,this._writeBuffer.push(n),this._callbacks.push(c)}_innerWrite(n=0,c=!0){let u=n||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],p=this._action(n,c);if(p){p.catch((n=>(queueMicrotask((()=>{throw n})),Promise.resolve(!1)))).then(n=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,n))):this._innerWrite(u,n));return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=n.length,Date.now()-u>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}c.WriteBuffer=x},941:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.toRgbString=c.parseColor=void 0;let u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,p=/^[\da-f]+$/;function h(n,c){let u=n.toString(16),p=u.length<2?`0`+u:u;switch(c){case 4:return u[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}c.parseColor=function(n){if(!n)return;let c=n.toLowerCase();if(c.indexOf(`rgb:`)===0){c=c.slice(4);let n=u.exec(c);if(n){let c=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/c*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/c*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/c*255)]}}else if(c.indexOf(`#`)===0&&(c=c.slice(1),p.exec(c)&&[3,6,9,12].includes(c.length))){let n=c.length/3,u=[0,0,0];for(let p=0;p<3;++p){let h=parseInt(c.slice(n*p,n*p+n),16);u[p]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return u}},c.toRgbString=function(n,c=16){let[u,p,x]=n;return`rgb:${h(u,c)}/${h(p,c)}/${h(x,c)}`}},770:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},351:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.DcsHandler=c.DcsParser=void 0;let p=u(482),h=u(742),x=u(770),w=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=w}registerHandler(n,c){this._handlers[n]===void 0&&(this._handlers[n]=[]);let u=this._handlers[n];return u.push(c),{dispose:()=>{let n=u.indexOf(c);n!==-1&&u.splice(n,1)}}}clearHandler(n){this._handlers[n]&&delete this._handlers[n]}setHandlerFallback(n){this._handlerFb=n}reset(){if(this._active.length)for(let n=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;n>=0;--n)this._active[n].unhook(!1);this._stack.paused=!1,this._active=w,this._ident=0}hook(n,c){if(this.reset(),this._ident=n,this._active=this._handlers[n]||w,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(c);else this._handlerFb(this._ident,`HOOK`,c)}put(n,c,u){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(n,c,u);else this._handlerFb(this._ident,`PUT`,(0,p.utf32ToString)(n,c,u))}unhook(n,c=!0){if(this._active.length){let u=!1,p=this._active.length-1,h=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,u=c,h=this._stack.fallThrough,this._stack.paused=!1),!h&&!1===u){for(;p>=0&&(u=this._active[p].unhook(n),!0!==u);p--)if(u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,u;p--}for(;p>=0;p--)if(u=this._active[p].unhook(!1),u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,u}else this._handlerFb(this._ident,`UNHOOK`,n);this._active=w,this._ident=0}};let T=new h.Params;T.addParam(0),c.DcsHandler=class{constructor(n){this._handler=n,this._data=``,this._params=T,this._hitLimit=!1}hook(n){this._params=n.length>1||n.params[0]?n.clone():T,this._data=``,this._hitLimit=!1}put(n,c,u){this._hitLimit||(this._data+=(0,p.utf32ToString)(n,c,u),this._data.length>x.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(n){let c=!1;if(this._hitLimit)c=!1;else if(n&&(c=this._handler(this._data,this._params),c instanceof Promise))return c.then((n=>(this._params=T,this._data=``,this._hitLimit=!1,n)));return this._params=T,this._data=``,this._hitLimit=!1,c}}},15:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;let p=u(844),h=u(742),x=u(242),w=u(351);class T{constructor(n){this.table=new Uint8Array(n)}setDefault(n,c){this.table.fill(n<<4|c)}add(n,c,u,p){this.table[c<<8|n]=u<<4|p}addMany(n,c,u,p){for(let h=0;h<n.length;h++)this.table[c<<8|n[h]]=u<<4|p}}c.TransitionTable=T;let O=160;c.VT500_TRANSITION_TABLE=function(){let n=new T(4095),c=Array.apply(null,Array(256)).map(((n,c)=>c)),u=(n,u)=>c.slice(n,u),p=u(32,127),h=u(0,24);h.push(25),h.push.apply(h,u(28,32));let x=u(0,14),w;for(w in n.setDefault(1,0),n.addMany(p,0,2,0),x)n.addMany([24,26,153,154],w,3,0),n.addMany(u(128,144),w,3,0),n.addMany(u(144,152),w,3,0),n.add(156,w,0,0),n.add(27,w,11,1),n.add(157,w,4,8),n.addMany([152,158,159],w,0,7),n.add(155,w,11,3),n.add(144,w,11,9);return n.addMany(h,0,3,0),n.addMany(h,1,3,1),n.add(127,1,0,1),n.addMany(h,8,0,8),n.addMany(h,3,3,3),n.add(127,3,0,3),n.addMany(h,4,3,4),n.add(127,4,0,4),n.addMany(h,6,3,6),n.addMany(h,5,3,5),n.add(127,5,0,5),n.addMany(h,2,3,2),n.add(127,2,0,2),n.add(93,1,4,8),n.addMany(p,8,5,8),n.add(127,8,5,8),n.addMany([156,27,24,26,7],8,6,0),n.addMany(u(28,32),8,0,8),n.addMany([88,94,95],1,0,7),n.addMany(p,7,0,7),n.addMany(h,7,0,7),n.add(156,7,0,0),n.add(127,7,0,7),n.add(91,1,11,3),n.addMany(u(64,127),3,7,0),n.addMany(u(48,60),3,8,4),n.addMany([60,61,62,63],3,9,4),n.addMany(u(48,60),4,8,4),n.addMany(u(64,127),4,7,0),n.addMany([60,61,62,63],4,0,6),n.addMany(u(32,64),6,0,6),n.add(127,6,0,6),n.addMany(u(64,127),6,0,0),n.addMany(u(32,48),3,9,5),n.addMany(u(32,48),5,9,5),n.addMany(u(48,64),5,0,6),n.addMany(u(64,127),5,7,0),n.addMany(u(32,48),4,9,5),n.addMany(u(32,48),1,9,2),n.addMany(u(32,48),2,9,2),n.addMany(u(48,127),2,10,0),n.addMany(u(48,80),1,10,0),n.addMany(u(81,88),1,10,0),n.addMany([89,90,92],1,10,0),n.addMany(u(96,127),1,10,0),n.add(80,1,11,9),n.addMany(h,9,0,9),n.add(127,9,0,9),n.addMany(u(28,32),9,0,9),n.addMany(u(32,48),9,9,12),n.addMany(u(48,60),9,8,10),n.addMany([60,61,62,63],9,9,10),n.addMany(h,11,0,11),n.addMany(u(32,128),11,0,11),n.addMany(u(28,32),11,0,11),n.addMany(h,10,0,10),n.add(127,10,0,10),n.addMany(u(28,32),10,0,10),n.addMany(u(48,60),10,8,10),n.addMany([60,61,62,63],10,0,11),n.addMany(u(32,48),10,9,12),n.addMany(h,12,0,12),n.add(127,12,0,12),n.addMany(u(28,32),12,0,12),n.addMany(u(32,48),12,9,12),n.addMany(u(48,64),12,0,11),n.addMany(u(64,127),12,12,13),n.addMany(u(64,127),10,12,13),n.addMany(u(64,127),9,12,13),n.addMany(h,13,13,13),n.addMany(p,13,13,13),n.add(127,13,0,13),n.addMany([27,156,24,26],13,14,0),n.add(160,0,2,0),n.add(160,8,5,8),n.add(160,6,0,6),n.add(160,11,0,11),n.add(160,13,13,13),n}();class A extends p.Disposable{constructor(n=c.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new h.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(n,c,u)=>{},this._executeHandlerFb=n=>{},this._csiHandlerFb=(n,c)=>{},this._escHandlerFb=n=>{},this._errorHandlerFb=n=>n,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new x.OscParser),this._dcsParser=this.register(new w.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(n,c=[64,126]){let u=0;if(n.prefix){if(n.prefix.length>1)throw Error(`only one byte as prefix supported`);if(u=n.prefix.charCodeAt(0),u&&60>u||u>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(n.intermediates){if(n.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let c=0;c<n.intermediates.length;++c){let p=n.intermediates.charCodeAt(c);if(32>p||p>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);u<<=8,u|=p}}if(n.final.length!==1)throw Error(`final must be a single byte`);let p=n.final.charCodeAt(0);if(c[0]>p||p>c[1])throw Error(`final must be in range ${c[0]} .. ${c[1]}`);return u<<=8,u|=p,u}identToString(n){let c=[];for(;n;)c.push(String.fromCharCode(255&n)),n>>=8;return c.reverse().join(``)}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,c){let u=this._identifier(n,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let p=this._escHandlers[u];return p.push(c),{dispose:()=>{let n=p.indexOf(c);n!==-1&&p.splice(n,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,c){this._executeHandlers[n.charCodeAt(0)]=c}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,c){let u=this._identifier(n);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let p=this._csiHandlers[u];return p.push(c),{dispose:()=>{let n=p.indexOf(c);n!==-1&&p.splice(n,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,c){return this._dcsParser.registerHandler(this._identifier(n),c)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,c){return this._oscParser.registerHandler(n,c)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(n,c,u,p,h){this._parseStack.state=n,this._parseStack.handlers=c,this._parseStack.handlerPos=u,this._parseStack.transition=p,this._parseStack.chunkPos=h}parse(n,c,u){let p,h=0,x=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let c=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===u&&x>-1){for(;x>=0&&(p=c[x](this._params),!0!==p);x--)if(p instanceof Promise)return this._parseStack.handlerPos=x,p}this._parseStack.handlers=[];break;case 4:if(!1===u&&x>-1){for(;x>=0&&(p=c[x](),!0!==p);x--)if(p instanceof Promise)return this._parseStack.handlerPos=x,p}this._parseStack.handlers=[];break;case 6:if(h=n[this._parseStack.chunkPos],p=this._dcsParser.unhook(h!==24&&h!==26,u),p)return p;h===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(h=n[this._parseStack.chunkPos],p=this._oscParser.end(h!==24&&h!==26,u),p)return p;h===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=w;u<c;++u){switch(h=n[u],x=this._transitions.table[this.currentState<<8|(h<160?h:160)],x>>4){case 2:for(let p=u+1;;++p){if(p>=c||(h=n[p])<32||h>126&&h<160){this._printHandler(n,u,p),u=p-1;break}if(++p>=c||(h=n[p])<32||h>126&&h<160){this._printHandler(n,u,p),u=p-1;break}if(++p>=c||(h=n[p])<32||h>126&&h<160){this._printHandler(n,u,p),u=p-1;break}if(++p>=c||(h=n[p])<32||h>126&&h<160){this._printHandler(n,u,p),u=p-1;break}}break;case 3:this._executeHandlers[h]?this._executeHandlers[h]():this._executeHandlerFb(h),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:h,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let w=this._csiHandlers[this._collect<<8|h],T=w?w.length-1:-1;for(;T>=0&&(p=w[T](this._params),!0!==p);T--)if(p instanceof Promise)return this._preserveStack(3,w,T,x,u),p;T<0&&this._csiHandlerFb(this._collect<<8|h,this._params),this.precedingJoinState=0;break;case 8:do switch(h){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(h-48)}while(++u<c&&(h=n[u])>47&&h<60);u--;break;case 9:this._collect<<=8,this._collect|=h;break;case 10:let O=this._escHandlers[this._collect<<8|h],A=O?O.length-1:-1;for(;A>=0&&(p=O[A](),!0!==p);A--)if(p instanceof Promise)return this._preserveStack(4,O,A,x,u),p;A<0&&this._escHandlerFb(this._collect<<8|h),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|h,this._params);break;case 13:for(let p=u+1;;++p)if(p>=c||(h=n[p])===24||h===26||h===27||h>127&&h<160){this._dcsParser.put(n,u,p),u=p-1;break}break;case 14:if(p=this._dcsParser.unhook(h!==24&&h!==26),p)return this._preserveStack(6,[],0,x,u),p;h===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=u+1;;p++)if(p>=c||(h=n[p])<32||h>127&&h<160){this._oscParser.put(n,u,p),u=p-1;break}break;case 6:if(p=this._oscParser.end(h!==24&&h!==26),p)return this._preserveStack(5,[],0,x,u),p;h===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}c.EscapeSequenceParser=A},242:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.OscHandler=c.OscParser=void 0;let p=u(770),h=u(482),x=[];c.OscParser=class{constructor(){this._state=0,this._active=x,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(n,c){this._handlers[n]===void 0&&(this._handlers[n]=[]);let u=this._handlers[n];return u.push(c),{dispose:()=>{let n=u.indexOf(c);n!==-1&&u.splice(n,1)}}}clearHandler(n){this._handlers[n]&&delete this._handlers[n]}setHandlerFallback(n){this._handlerFb=n}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}reset(){if(this._state===2)for(let n=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;n>=0;--n)this._active[n].end(!1);this._stack.paused=!1,this._active=x,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||x,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].start();else this._handlerFb(this._id,`START`)}_put(n,c,u){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(n,c,u);else this._handlerFb(this._id,`PUT`,(0,h.utf32ToString)(n,c,u))}start(){this.reset(),this._state=1}put(n,c,u){if(this._state!==3){if(this._state===1)for(;c<u;){let u=n[c++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&u-c>0&&this._put(n,c,u)}}end(n,c=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let u=!1,p=this._active.length-1,h=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,u=c,h=this._stack.fallThrough,this._stack.paused=!1),!h&&!1===u){for(;p>=0&&(u=this._active[p].end(n),!0!==u);p--)if(u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,u;p--}for(;p>=0;p--)if(u=this._active[p].end(!1),u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,u}else this._handlerFb(this._id,`END`,n);this._active=x,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(n){this._handler=n,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(n,c,u){this._hitLimit||(this._data+=(0,h.utf32ToString)(n,c,u),this._data.length>p.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(n){let c=!1;if(this._hitLimit)c=!1;else if(n&&(c=this._handler(this._data),c instanceof Promise))return c.then((n=>(this._data=``,this._hitLimit=!1,n)));return this._data=``,this._hitLimit=!1,c}}},742:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.Params=void 0;let u=2147483647;class p{static fromArray(n){let c=new p;if(!n.length)return c;for(let u=+!!Array.isArray(n[0]);u<n.length;++u){let p=n[u];if(Array.isArray(p))for(let n=0;n<p.length;++n)c.addSubParam(p[n]);else c.addParam(p)}return c}constructor(n=32,c=32){if(this.maxLength=n,this.maxSubParamsLength=c,c>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new p(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){let n=[];for(let c=0;c<this.length;++c){n.push(this.params[c]);let u=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-u>0&&n.push(Array.prototype.slice.call(this._subParams,u,p))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>u?u:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=n>u?u:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let c=this._subParamsIdx[n]>>8,u=255&this._subParamsIdx[n];return u-c>0?this._subParams.subarray(c,u):null}getSubParamsAll(){let n={};for(let c=0;c<this.length;++c){let u=this._subParamsIdx[c]>>8,p=255&this._subParamsIdx[c];p-u>0&&(n[c]=this._subParams.slice(u,p))}return n}addDigit(n){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let p=this._digitIsSub?this._subParams:this.params,h=p[c-1];p[c-1]=~h?Math.min(10*h+n,u):n}}c.Params=p},741:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,c){let u={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(u),c.dispose=()=>this._wrappedAddonDispose(u),c.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let c=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){c=u;break}if(c===-1)throw Error(`Could not dispose an addon that has not been loaded`);n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(c,1)}}},771:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.BufferApiView=void 0;let p=u(785),h=u(511);c.BufferApiView=class{constructor(n,c){this._buffer=n,this.type=c}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){let c=this._buffer.lines.get(n);if(c)return new p.BufferLineApiView(c)}getNullCell(){return new h.CellData}}},785:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.BufferLineApiView=void 0;let p=u(511);c.BufferLineApiView=class{constructor(n){this._line=n}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(n,c){if(!(n<0||n>=this._line.length))return c?(this._line.loadCell(n,c),c):this._line.loadCell(n,new p.CellData)}translateToString(n,c,u){return this._line.translateToString(n,c,u)}}},285:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.BufferNamespaceApi=void 0;let p=u(771),h=u(460),x=u(844);class w extends x.Disposable{constructor(n){super(),this._core=n,this._onBufferChange=this.register(new h.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new p.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=w},975:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,c){return this._core.registerCsiHandler(n,(n=>c(n.toArray())))}addCsiHandler(n,c){return this.registerCsiHandler(n,c)}registerDcsHandler(n,c){return this._core.registerDcsHandler(n,((n,u)=>c(n,u.toArray())))}addDcsHandler(n,c){return this.registerDcsHandler(n,c)}registerEscHandler(n,c){return this._core.registerEscHandler(n,c)}addEscHandler(n,c){return this.registerEscHandler(n,c)}registerOscHandler(n,c){return this._core.registerOscHandler(n,c)}addOscHandler(n,c){return this.registerOscHandler(n,c)}}},90:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(n,c,u){var p=this&&this.__decorate||function(n,c,u,p){var h,x=arguments.length,w=x<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,u):p;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)w=Reflect.decorate(n,c,u,p);else for(var T=n.length-1;T>=0;T--)(h=n[T])&&(w=(x<3?h(w):x>3?h(c,u,w):h(c,u))||w);return x>3&&w&&Object.defineProperty(c,u,w),w},h=this&&this.__param||function(n,c){return function(u,p){c(u,p,n)}};Object.defineProperty(c,`__esModule`,{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;let x=u(460),w=u(844),T=u(295),O=u(585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let A=c.BufferService=class extends w.Disposable{get buffer(){return this.buffers.active}constructor(n){super(),this.isUserScrolling=!1,this._onResize=this.register(new x.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new x.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(n.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(n.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new T.BufferSet(n,this))}resize(n,c){this.cols=n,this.rows=c,this.buffers.resize(n,c),this._onResize.fire({cols:n,rows:c})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,c=!1){let u=this.buffer,p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===n.fg&&p.getBg(0)===n.bg||(p=u.getBlankLine(n,c),this._cachedBlankLine=p),p.isWrapped=c;let h=u.ybase+u.scrollTop,x=u.ybase+u.scrollBottom;if(u.scrollTop===0){let n=u.lines.isFull;x===u.lines.length-1?n?u.lines.recycle().copyFrom(p):u.lines.push(p.clone()):u.lines.splice(x+1,0,p.clone()),n?this.isUserScrolling&&(u.ydisp=Math.max(u.ydisp-1,0)):(u.ybase++,this.isUserScrolling||u.ydisp++)}else{let n=x-h+1;u.lines.shiftElements(h+1,n-1,-1),u.lines.set(x,p.clone())}this.isUserScrolling||(u.ydisp=u.ybase),this._onScroll.fire(u.ydisp)}scrollLines(n,c,u){let p=this.buffer;if(n<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else n+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);let h=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+n,p.ybase),0),h!==p.ydisp&&(c||this._onScroll.fire(p.ydisp))}};c.BufferService=A=p([h(0,O.IOptionsService)],A)},994:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,c){this._charsets[n]=c,this.glevel===n&&(this.charset=c)}}},753:function(n,c,u){var p=this&&this.__decorate||function(n,c,u,p){var h,x=arguments.length,w=x<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,u):p;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)w=Reflect.decorate(n,c,u,p);else for(var T=n.length-1;T>=0;T--)(h=n[T])&&(w=(x<3?h(w):x>3?h(c,u,w):h(c,u))||w);return x>3&&w&&Object.defineProperty(c,u,w),w},h=this&&this.__param||function(n,c){return function(u,p){c(u,p,n)}};Object.defineProperty(c,`__esModule`,{value:!0}),c.CoreMouseService=void 0;let x=u(585),w=u(460),T=u(844),O={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function A(n,c){let u=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(u|=64,u|=n.action):(u|=3&n.button,4&n.button&&(u|=64),8&n.button&&(u|=128),n.action===32?u|=32:n.action!==0||c||(u|=3)),u}let j=String.fromCharCode,N={DEFAULT:n=>{let c=[A(n,!1)+32,n.col+32,n.row+32];return c[0]>255||c[1]>255||c[2]>255?``:`[M${j(c[0])}${j(c[1])}${j(c[2])}`},SGR:n=>{let c=n.action===0&&n.button!==4?`m`:`M`;return`[<${A(n,!0)};${n.col};${n.row}${c}`},SGR_PIXELS:n=>{let c=n.action===0&&n.button!==4?`m`:`M`;return`[<${A(n,!0)};${n.x};${n.y}${c}`}},I=c.CoreMouseService=class extends T.Disposable{constructor(n,c){super(),this._bufferService=n,this._coreService=c,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new w.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(O))this.addProtocol(n,O[n]);for(let n of Object.keys(N))this.addEncoding(n,N[n]);this.reset()}addProtocol(n,c){this._protocols[n]=c}addEncoding(n,c){this._encodings[n]=c}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(n))return!1;let c=this._encodings[this._activeEncoding](n);return c&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(c):this._coreService.triggerDataEvent(c,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,c,u){if(u){if(n.x!==c.x||n.y!==c.y)return!1}else if(n.col!==c.col||n.row!==c.row)return!1;return n.button===c.button&&n.action===c.action&&n.ctrl===c.ctrl&&n.alt===c.alt&&n.shift===c.shift}};c.CoreMouseService=I=p([h(0,x.IBufferService),h(1,x.ICoreService)],I)},83:function(n,c,u){var p=this&&this.__decorate||function(n,c,u,p){var h,x=arguments.length,w=x<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,u):p;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)w=Reflect.decorate(n,c,u,p);else for(var T=n.length-1;T>=0;T--)(h=n[T])&&(w=(x<3?h(w):x>3?h(c,u,w):h(c,u))||w);return x>3&&w&&Object.defineProperty(c,u,w),w},h=this&&this.__param||function(n,c){return function(u,p){c(u,p,n)}};Object.defineProperty(c,`__esModule`,{value:!0}),c.CoreService=void 0;let x=u(439),w=u(460),T=u(844),O=u(585),A=Object.freeze({insertMode:!1}),j=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),N=c.CoreService=class extends T.Disposable{constructor(n,c,u){super(),this._bufferService=n,this._logService=c,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new w.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new w.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new w.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new w.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,x.clone)(A),this.decPrivateModes=(0,x.clone)(j)}reset(){this.modes=(0,x.clone)(A),this.decPrivateModes=(0,x.clone)(j)}triggerDataEvent(n,c=!1){if(this._optionsService.rawOptions.disableStdin)return;let u=this._bufferService.buffer;c&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),c&&this._onUserInput.fire(),this._logService.debug(`sending data "${n}"`,(()=>n.split(``).map((n=>n.charCodeAt(0))))),this._onData.fire(n)}triggerBinaryEvent(n){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${n}"`,(()=>n.split(``).map((n=>n.charCodeAt(0))))),this._onBinary.fire(n))}};c.CoreService=N=p([h(0,O.IBufferService),h(1,O.ILogService),h(2,O.IOptionsService)],N)},348:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;let p=u(585),h=u(343);class x{constructor(...n){this._entries=new Map;for(let[c,u]of n)this.set(c,u)}set(n,c){let u=this._entries.get(n);return this._entries.set(n,c),u}forEach(n){for(let[c,u]of this._entries.entries())n(c,u)}has(n){return this._entries.has(n)}get(n){return this._entries.get(n)}}c.ServiceCollection=x,c.InstantiationService=class{constructor(){this._services=new x,this._services.set(p.IInstantiationService,this)}setService(n,c){this._services.set(n,c)}getService(n){return this._services.get(n)}createInstance(n,...c){let u=(0,h.getServiceDependencies)(n).sort(((n,c)=>n.index-c.index)),p=[];for(let c of u){let u=this._services.get(c.id);if(!u)throw Error(`[createInstance] ${n.name} depends on UNKNOWN service ${c.id}.`);p.push(u)}let x=u.length>0?u[0].index:c.length;if(c.length!==x)throw Error(`[createInstance] First service dependency of ${n.name} at position ${x+1} conflicts with ${c.length} static arguments`);return new n(...c,...p)}}},866:function(n,c,u){var p=this&&this.__decorate||function(n,c,u,p){var h,x=arguments.length,w=x<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,u):p;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)w=Reflect.decorate(n,c,u,p);else for(var T=n.length-1;T>=0;T--)(h=n[T])&&(w=(x<3?h(w):x>3?h(c,u,w):h(c,u))||w);return x>3&&w&&Object.defineProperty(c,u,w),w},h=this&&this.__param||function(n,c){return function(u,p){c(u,p,n)}};Object.defineProperty(c,`__esModule`,{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;let x=u(844),w=u(585),T={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF},O,A=c.LogService=class extends x.Disposable{get logLevel(){return this._logLevel}constructor(n){super(),this._optionsService=n,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),O=this}_updateLogLevel(){this._logLevel=T[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let c=0;c<n.length;c++)typeof n[c]==`function`&&(n[c]=n[c]())}_log(n,c,u){this._evalLazyOptionalParams(u),n.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+c,...u)}trace(n,...c){this._logLevel<=w.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,n,c)}debug(n,...c){this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,n,c)}info(n,...c){this._logLevel<=w.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,n,c)}warn(n,...c){this._logLevel<=w.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,n,c)}error(n,...c){this._logLevel<=w.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,n,c)}};c.LogService=A=p([h(0,w.IOptionsService)],A),c.setTraceLogger=function(n){O=n},c.traceCall=function(n,c,u){if(typeof u.value!=`function`)throw Error(`not supported`);let p=u.value;u.value=function(...n){if(O.logLevel!==w.LogLevelEnum.TRACE)return p.apply(this,n);O.trace(`GlyphRenderer#${p.name}(${n.map((n=>JSON.stringify(n))).join(`, `)})`);let c=p.apply(this,n);return O.trace(`GlyphRenderer#${p.name} return`,c),c}}},302:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;let p=u(460),h=u(844);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:u(114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let x=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class w extends h.Disposable{constructor(n){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;let u={...c.DEFAULT_OPTIONS};for(let c in n)if(c in u)try{let p=n[c];u[c]=this._sanitizeAndValidateOption(c,p)}catch(n){console.error(n)}this.rawOptions=u,this.options={...u},this._setupOptions(),this.register((0,h.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(n,c){return this.onOptionChange((u=>{u===n&&c(this.rawOptions[n])}))}onMultipleOptionChange(n,c){return this.onOptionChange((u=>{n.indexOf(u)!==-1&&c()}))}_setupOptions(){let n=n=>{if(!(n in c.DEFAULT_OPTIONS))throw Error(`No option with key "${n}"`);return this.rawOptions[n]},u=(n,u)=>{if(!(n in c.DEFAULT_OPTIONS))throw Error(`No option with key "${n}"`);u=this._sanitizeAndValidateOption(n,u),this.rawOptions[n]!==u&&(this.rawOptions[n]=u,this._onOptionChange.fire(n))};for(let c in this.rawOptions){let p={get:n.bind(this,c),set:u.bind(this,c)};Object.defineProperty(this.options,c,p)}}_sanitizeAndValidateOption(n,u){switch(n){case`cursorStyle`:if(u||=c.DEFAULT_OPTIONS[n],!function(n){return n===`block`||n===`underline`||n===`bar`}(u))throw Error(`"${u}" is not a valid value for ${n}`);break;case`wordSeparator`:u||=c.DEFAULT_OPTIONS[n];break;case`fontWeight`:case`fontWeightBold`:if(typeof u==`number`&&1<=u&&u<=1e3)break;u=x.includes(u)?u:c.DEFAULT_OPTIONS[n];break;case`cursorWidth`:u=Math.floor(u);case`lineHeight`:case`tabStopWidth`:if(u<1)throw Error(`${n} cannot be less than 1, value: ${u}`);break;case`minimumContrastRatio`:u=Math.max(1,Math.min(21,Math.round(10*u)/10));break;case`scrollback`:if((u=Math.min(u,4294967295))<0)throw Error(`${n} cannot be less than 0, value: ${u}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(u<=0)throw Error(`${n} cannot be less than or equal to 0, value: ${u}`);break;case`rows`:case`cols`:if(!u&&u!==0)throw Error(`${n} must be numeric, value: ${u}`);break;case`windowsPty`:u??={}}return u}}c.OptionsService=w},660:function(n,c,u){var p=this&&this.__decorate||function(n,c,u,p){var h,x=arguments.length,w=x<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,u):p;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)w=Reflect.decorate(n,c,u,p);else for(var T=n.length-1;T>=0;T--)(h=n[T])&&(w=(x<3?h(w):x>3?h(c,u,w):h(c,u))||w);return x>3&&w&&Object.defineProperty(c,u,w),w},h=this&&this.__param||function(n,c){return function(u,p){c(u,p,n)}};Object.defineProperty(c,`__esModule`,{value:!0}),c.OscLinkService=void 0;let x=u(585),w=c.OscLinkService=class{constructor(n){this._bufferService=n,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(n){let c=this._bufferService.buffer;if(n.id===void 0){let u=c.addMarker(c.ybase+c.y),p={data:n,id:this._nextId++,lines:[u]};return u.onDispose((()=>this._removeMarkerFromLink(p,u))),this._dataByLinkId.set(p.id,p),p.id}let u=n,p=this._getEntryIdKey(u),h=this._entriesWithId.get(p);if(h)return this.addLineToLink(h.id,c.ybase+c.y),h.id;let x=c.addMarker(c.ybase+c.y),w={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(w,x))),this._entriesWithId.set(w.key,w),this._dataByLinkId.set(w.id,w),w.id}addLineToLink(n,c){let u=this._dataByLinkId.get(n);if(u&&u.lines.every((n=>n.line!==c))){let n=this._bufferService.buffer.addMarker(c);u.lines.push(n),n.onDispose((()=>this._removeMarkerFromLink(u,n)))}}getLinkData(n){return this._dataByLinkId.get(n)?.data}_getEntryIdKey(n){return`${n.id};;${n.uri}`}_removeMarkerFromLink(n,c){let u=n.lines.indexOf(c);u!==-1&&(n.lines.splice(u,1),n.lines.length===0&&(n.data.id!==void 0&&this._entriesWithId.delete(n.key),this._dataByLinkId.delete(n.id)))}};c.OscLinkService=w=p([h(0,x.IBufferService)],w)},343:(n,c)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;let u=`di$target`,p=`di$dependencies`;c.serviceRegistry=new Map,c.getServiceDependencies=function(n){return n[p]||[]},c.createDecorator=function(n){if(c.serviceRegistry.has(n))return c.serviceRegistry.get(n);let h=function(n,c,x){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(n,c,h){c[u]===c?c[p].push({id:n,index:h}):(c[p]=[{id:n,index:h}],c[u]=c)})(h,n,x)};return h.toString=()=>n,c.serviceRegistry.set(n,h),h}},585:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;let p=u(343);var h;c.IBufferService=(0,p.createDecorator)(`BufferService`),c.ICoreMouseService=(0,p.createDecorator)(`CoreMouseService`),c.ICoreService=(0,p.createDecorator)(`CoreService`),c.ICharsetService=(0,p.createDecorator)(`CharsetService`),c.IInstantiationService=(0,p.createDecorator)(`InstantiationService`),function(n){n[n.TRACE=0]=`TRACE`,n[n.DEBUG=1]=`DEBUG`,n[n.INFO=2]=`INFO`,n[n.WARN=3]=`WARN`,n[n.ERROR=4]=`ERROR`,n[n.OFF=5]=`OFF`}(h||(c.LogLevelEnum=h={})),c.ILogService=(0,p.createDecorator)(`LogService`),c.IOptionsService=(0,p.createDecorator)(`OptionsService`),c.IOscLinkService=(0,p.createDecorator)(`OscLinkService`),c.IUnicodeService=(0,p.createDecorator)(`UnicodeService`),c.IDecorationService=(0,p.createDecorator)(`DecorationService`)},480:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.UnicodeService=void 0;let p=u(460),h=u(225);class x{static extractShouldJoin(n){return(1&n)!=0}static extractWidth(n){return n>>1&3}static extractCharKind(n){return n>>3}static createPropertyValue(n,c,u=!1){return(16777215&n)<<3|(3&c)<<1|!!u}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;let n=new h.UnicodeV6;this.register(n),this._active=n.version,this._activeProvider=n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(n){if(!this._providers[n])throw Error(`unknown Unicode version "${n}"`);this._active=n,this._activeProvider=this._providers[n],this._onChange.fire(n)}register(n){this._providers[n.version]=n}wcwidth(n){return this._activeProvider.wcwidth(n)}getStringCellWidth(n){let c=0,u=0,p=n.length;for(let h=0;h<p;++h){let w=n.charCodeAt(h);if(55296<=w&&w<=56319){if(++h>=p)return c+this.wcwidth(w);let u=n.charCodeAt(h);56320<=u&&u<=57343?w=1024*(w-55296)+u-56320+65536:c+=this.wcwidth(u)}let T=this.charProperties(w,u),O=x.extractWidth(T);x.extractShouldJoin(T)&&(O-=x.extractWidth(u)),c+=O,u=T}return c}charProperties(n,c){return this._activeProvider.charProperties(n,c)}}c.UnicodeService=x},781:(n,c,u)=>{Object.defineProperty(c,`__esModule`,{value:!0}),c.Terminal=void 0;let p=u(437),h=u(969),x=u(460);class w extends h.CoreTerminal{constructor(n={}){super(n),this._onBell=this.register(new x.EventEmitter),this.onBell=this._onBell.event,this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this.register(new x.EventEmitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this.register(new x.EventEmitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this.register(this._inputHandler.onRequestBell((()=>this.bell()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register((0,x.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,x.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(n){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+n)}bell(){this._onBell.fire()}input(n,c=!0){this.coreService.triggerDataEvent(n,c)}resize(n,c){n===this.cols&&c===this.rows||super.resize(n,c)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let n=1;n<this.rows;n++)this.buffer.lines.push(this.buffer.getBlankLine(p.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}c.Terminal=w}},u={};function p(n){var h=u[n];if(h!==void 0)return h.exports;var x=u[n]={exports:{}};return c[n].call(x.exports,x,x.exports,p),x.exports}var h={};(()=>{var n=h;Object.defineProperty(n,`__esModule`,{value:!0}),n.Terminal=void 0;let c=p(285),u=p(975),x=p(90),w=p(781),T=p(741),O=p(844),A=[`cols`,`rows`];class j extends O.Disposable{constructor(n){super(),this._core=this.register(new w.Terminal(n)),this._addonManager=this.register(new T.AddonManager),this._publicOptions={...this._core.options};let c=n=>this._core.options[n],u=(n,c)=>{this._checkReadonlyOptions(n),this._core.options[n]=c};for(let n in this._core.options){Object.defineProperty(this._publicOptions,n,{get:()=>this._core.options[n],set:c=>{this._checkReadonlyOptions(n),this._core.options[n]=c}});let p={get:c.bind(this,n),set:u.bind(this,n)};Object.defineProperty(this._publicOptions,n,p)}}_checkReadonlyOptions(n){if(A.includes(n))throw Error(`Option "${n}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get parser(){return this._checkProposedApi(),this._parser||=new u.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new x.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||=this.register(new c.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let n=this._core.coreService.decPrivateModes,c=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:c=`x10`;break;case`VT200`:c=`vt200`;break;case`DRAG`:c=`drag`;break;case`ANY`:c=`any`}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:c,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(let c in n)this._publicOptions[c]=n[c]}input(n,c=!0){this._core.input(n,c)}resize(n,c){this._verifyIntegers(n,c),this._core.resize(n,c)}registerMarker(n=0){return this._checkProposedApi(),this._verifyIntegers(n),this._core.addMarker(n)}addMarker(n){return this.registerMarker(n)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,c){this._core.write(n,c)}writeln(n,c){this._core.write(n),this._core.write(`\r
|
|
186
186
|
`,c)}reset(){this._core.reset()}loadAddon(n){this._addonManager.loadAddon(this,n)}_verifyIntegers(...n){for(let c of n)if(c===1/0||isNaN(c)||c%1!=0)throw Error(`This API only accepts integers`)}}n.Terminal=j})();var x=n;for(var w in h)x[w]=h[w];h.__esModule&&Object.defineProperty(x,`__esModule`,{value:!0})})()})),import_xterm_headless=__toESM(require_xterm_headless(),1),PtyError=class extends Error{constructor(n,c){super(c),this.name=`PtyError`,this.code=n}};const FALLBACK_TMUX_PATHS=[`/opt/homebrew/bin/tmux`,`/usr/local/bin/tmux`,`/usr/bin/tmux`],FALLBACK_SHELLS=[`/bin/zsh`,`/bin/bash`,`/bin/sh`];let cachedTmuxPath=null;const isUsableTmuxPath=n=>{try{return execFileSync(n,[`-V`],{stdio:`ignore`}),!0}catch{return!1}},resolveShellPath=()=>{let n=process.env.SHELL;return n&&isAbsolute(n)?n:FALLBACK_SHELLS[0]},resolveFromShell=()=>{try{for(let n of new Set([resolveShellPath(),...FALLBACK_SHELLS])){let c=execFileSync(n,[`-lc`,`command -v tmux`],{encoding:`utf8`}).trim();if(c&&isUsableTmuxPath(c))return c}return null}catch{return null}};function resolveTmuxBinaryPath(){if(cachedTmuxPath)return cachedTmuxPath;let n=resolveFromShell();if(n)return cachedTmuxPath=n,cachedTmuxPath;for(let n of FALLBACK_TMUX_PATHS)if(isUsableTmuxPath(n))return cachedTmuxPath=n,cachedTmuxPath;throw Error("tmux is not installed. Install it first (for macOS: `brew install tmux`).")}var AsyncQueue=class{constructor(){this.events=runSync(unbounded()),this.terminalEvent=null}push(n){this.terminalEvent||runSync(offer(this.events,{type:`value`,value:n}))}end(){if(this.terminalEvent)return;let n={type:`end`};this.terminalEvent=n,runSync(offer(this.events,n))}fail(n){if(this.terminalEvent)return;let c={type:`failure`,error:n};this.terminalEvent=c,runSync(offer(this.events,c))}iterable(){return this.iterate()}async*iterate(){for(;;){let n=await runPromise(take(this.events));if(n.type===`value`){yield n.value;continue}if(runSync(offer(this.events,n)),n.type===`failure`)throw n.error;return}}};function closeClientState(n){if(!n.isClosed){n.isClosed=!0,n.queue.end();for(let c of n.parserDisposables)c.dispose();n.terminal.dispose()}}function mapInputToPty(n){return n.type===`text`?n.text:n.type===`raw`?n.data:n.type===`paste`?n.text:n.type===`enter`?`\r`:n.type===`interrupt`?``:n.type===`eof`?``:n.type===`key`?keyToSequence(n.key):``}function keyToSequence(n){return n===`up`?`\x1B[A`:n===`down`?`\x1B[B`:n===`right`?`\x1B[C`:n===`left`?`\x1B[D`:n===`tab`?` `:n===`backspace`?``:n===`escape`?`\x1B`:n===`delete`?`\x1B[3~`:n===`home`?`\x1B[H`:n===`end`?`\x1B[F`:n===`page_up`?`\x1B[5~`:n===`page_down`?`\x1B[6~`:``}const runtimeRequire=createRequire(import.meta.url),vendoredNodePtyPackageJson=resolve(dirname(fileURLToPath(import.meta.url)),`..`,`vendor`,`node-pty`,`package.json`);function resolveVendoredNodePtyPackageRoot(){let n=process.env.NODWORK_NODE_PTY_PACKAGE_ROOT;return n&&existsSync(join(n,`package.json`))?n:existsSync(vendoredNodePtyPackageJson)?dirname(vendoredNodePtyPackageJson):null}function resolveNodePtyPackageRoot(){return resolveVendoredNodePtyPackageRoot()||dirname(runtimeRequire.resolve(`node-pty/package.json`))}function loadNodePtyModule(){return runtimeRequire(join(resolveNodePtyPackageRoot(),`lib`,`index.js`))}function prepareNodePtyRuntime(){if(process.platform===`win32`)return;let n=resolveNodePtyPackageRoot(),c=[join(n,`build`,`Release`,`spawn-helper`),join(n,`prebuilds`,`${process.platform}-${process.arch}`,`spawn-helper`)];for(let n of c)ensureExecutable(n)}function ensureExecutable(n){let c;try{c=statSync(n)}catch{return}c.isFile()&&(c.mode&73||chmodSync(n,493))}function createParsedOutput(){return{csi:[],osc:[],dcs:[],esc:[]}}function registerParserHooks(n){let{terminal:c,getCurrentParsed:u}=n,p=c.parser,h=[];for(let n of asciiRange(64,126)){let c={final:n};h.push(p.registerCsiHandler(c,n=>{let p=u();return p&&p.csi.push({id:c,params:n}),!1}))}for(let n of[0,1,2,4,7,8,9,10,11,12,52,133,1337])h.push(p.registerOscHandler(n,c=>{let p=u();return p&&p.osc.push({ident:n,data:c}),!1}));for(let n of asciiRange(64,126)){let c={final:n};h.push(p.registerDcsHandler(c,(n,p)=>{let h=u();return h&&h.dcs.push({id:c,data:n,params:p}),!1}))}for(let n of asciiRange(48,126)){let c={final:n};h.push(p.registerEscHandler(c,()=>{let n=u();return n&&n.esc.push({id:c}),!1}))}return h}function asciiRange(n,c){let u=[];for(let p=n;p<=c;p+=1)u.push(String.fromCharCode(p));return u}function registerProcessShutdownHandlers(n){let c=[{event:`SIGINT`,handler:n},{event:`SIGTERM`,handler:n},{event:`SIGHUP`,handler:n},{event:`beforeExit`,handler:n},{event:`exit`,handler:n}];for(let n of c)process.once(n.event,n.handler);return()=>{for(let n of c)process.off(n.event,n.handler)}}function parseTmuxSessionList(n){return n.split(`
|
|
187
187
|
`).map(n=>n.trim()).filter(Boolean).map(parseTmuxSessionLine)}function parseTmuxSessionLine(n){let[c=``,u=`0`,p=`0`,h=``]=n.split(` `),x=Number.parseInt(h,10);return{name:c,windows:Number.parseInt(u,10)||0,attached:Number.parseInt(p,10)||0,createdAt:Number.isFinite(x)?new Date(x*1e3).toISOString():null,raw:n}}const execFile$1$1=promisify$1(execFile$1),getTmuxInstallHint=()=>{switch(process.platform){case`darwin`:return`brew install tmux`;case`linux`:return`apt install tmux (Debian/Ubuntu) or yum install tmux (RHEL/CentOS)`;default:return`install tmux for your platform`}},TMUX_SERVER_UNAVAILABLE_PATTERN=/(?:^|\n)(?:error connecting to|failed to connect to server|no server running on)\b|no such file or directory|operation not permitted/i,ECHO_NATIVE_SCROLLBACK_TERM=`xterm-256color`,ECHO_NATIVE_SCROLLBACK_OVERRIDE=`${ECHO_NATIVE_SCROLLBACK_TERM}:smcup@:rmcup@`,readErrorText=n=>typeof n==`string`?n.trim():``,getExecFailureDetails=n=>{if(!(n instanceof Error))return{exitCode:null,stderr:``,message:String(n)};let c=n;return{exitCode:typeof c.code==`number`?c.code:null,stderr:readErrorText(c.stderr),message:n.message}},isTmuxServerUnavailableError=n=>{let{exitCode:c,stderr:u,message:p}=getExecFailureDetails(n);if(c!==null&&c!==1)return!1;let h=u||p;return TMUX_SERVER_UNAVAILABLE_PATTERN.test(h)},getTmuxFailureMessage=(n,c)=>{let{stderr:u,message:p}=getExecFailureDetails(n);return u||p||c},hasNativeScrollbackOverride=n=>n.split(`,`).map(n=>n.trim()).some(n=>{if(!n)return!1;let[c,...u]=n.split(`:`).map(n=>n.trim());if(c!==ECHO_NATIVE_SCROLLBACK_TERM&&c!==`xterm*`)return!1;let p=new Set(u);return p.has(`smcup@`)&&p.has(`rmcup@`)});async function defaultTmuxExecutor(n,c){let u=await execFile$1$1(n,c,{encoding:`utf8`});return{stdout:u.stdout,stderr:u.stderr}}async function ensureTmuxAvailable(n){try{await n([`-V`])}catch{throw new PtyError(`TMUX_NOT_INSTALLED`,`tmux is not installed. Install it first: \`${getTmuxInstallHint()}\`.`)}}async function ensureSessionExists(n,c){try{await n([`has-session`,`-t`,c])}catch{throw new PtyError(`TMUX_SESSION_NOT_FOUND`,`tmux session not found: ${c}`)}}async function createSession(n,c,u){let p=u&&u.length>0?u:homedir$1();try{await n([`new-session`,`-d`,`-s`,c,`-c`,p])}catch(n){let{stderr:u,message:p}=getExecFailureDetails(n);if((u||p).toLowerCase().includes(`duplicate session`))return;throw new PtyError(`TMUX_ATTACH_FAILED`,getTmuxFailureMessage(n,`Failed to create tmux session: ${c}`))}}async function enableSessionMouseMode(n,c){try{await n([`set-option`,`-t`,c,`mouse`,`on`])}catch(n){throw new PtyError(`TMUX_ATTACH_FAILED`,getTmuxFailureMessage(n,`Failed to enable tmux mouse mode for session: ${c}`))}}async function enableNativeScrollback(n){let c=``;try{let{stdout:u}=await n([`show-options`,`-sv`,`terminal-overrides`]);c=u.trim()}catch(n){throw new PtyError(`TMUX_ATTACH_FAILED`,getTmuxFailureMessage(n,`Failed to read tmux terminal-overrides`))}if(hasNativeScrollbackOverride(c))return;let u=c.length>0?`,${ECHO_NATIVE_SCROLLBACK_OVERRIDE}`:ECHO_NATIVE_SCROLLBACK_OVERRIDE;try{await n([`set-option`,`-as`,`terminal-overrides`,u])}catch(n){throw new PtyError(`TMUX_ATTACH_FAILED`,getTmuxFailureMessage(n,`Failed to enable tmux native scrollback override`))}}async function listTmuxSessions(n){try{let{stdout:c}=await n([`list-sessions`,`-F`,`#{session_name} #{session_windows} #{session_attached} #{session_created}`]);return parseTmuxSessionList(c)}catch(n){throw isTmuxServerUnavailableError(n)?new PtyError(`TMUX_SERVER_UNAVAILABLE`,getTmuxFailureMessage(n,`tmux server is unavailable`)):new PtyError(`TMUX_SESSION_LIST_FAILED`,getTmuxFailureMessage(n,`Failed to list tmux sessions`))}}async function killTmuxSession(n,c){await n([`kill-session`,`-t`,c])}const{Terminal:HeadlessTerminal}=import_xterm_headless.default;var TmuxPtyClient=class{constructor(n){this.clients=new Map,this.sessionClients=new Map,this.latestClientBySession=new Map,this.disposed=!1,this.shutdownPromise=null,this.tmuxPath=n.tmuxPath,this.tmuxExec=n.tmuxExecutor??(n=>defaultTmuxExecutor(this.tmuxPath,n)),this.createPty=n.ptyFactory??((n,c,u)=>loadNodePtyModule().spawn(n,c,u)),this.createTerminal=n.terminalFactory??(()=>new HeadlessTerminal({allowProposedApi:!0})),this.unregisterShutdownHandlers=registerProcessShutdownHandlers(()=>{this.shutdownManagedClients()})}async listSessions(){return this.assertNotDisposed(),await ensureTmuxAvailable(this.tmuxExec),listTmuxSessions(this.tmuxExec)}async connectSession(n,c){this.assertNotDisposed();let{createIfNotexists:u,cwd:p,env:h,cols:x=120,rows:w=32}=c;if(!n.trim())throw new PtyError(`TMUX_ATTACH_FAILED`,`sessionName is required`);if(await ensureTmuxAvailable(this.tmuxExec),u)try{await ensureSessionExists(this.tmuxExec,n)}catch{await createSession(this.tmuxExec,n,p)}else await ensureSessionExists(this.tmuxExec,n);await enableNativeScrollback(this.tmuxExec),await enableSessionMouseMode(this.tmuxExec,n),prepareNodePtyRuntime();let T=randomUUID$1(),O=this.createClientState({sessionName:n,cwd:p,env:h,cols:x,rows:w});O.pty.onExit(()=>{this.closeState(T)}),this.clients.set(T,O);let A=this.sessionClients.get(n)??new Set;return A.add(T),this.sessionClients.set(n,A),this.latestClientBySession.set(n,T),{sessionName:n,clientId:T}}async sendInput(n,c){this.assertNotDisposed();let{input:u}=c,p=this.requireClient(n);if(u.type===`signal`){p.pty.kill(u.signal);return}p.pty.write(mapInputToPty(u))}async resize(n,c){this.assertNotDisposed();let u=this.requireClient(n);u.pty.resize(c.cols,c.rows),u.terminal.resize(c.cols,c.rows)}async detach(n){this.assertNotDisposed();let c=this.requireClient(n);if(c.isClosed)throw new PtyError(`PTY_CLOSED`,`PTY client is already closed: ${n}`);c.pty.write(`d`)}async close(n){this.assertNotDisposed();let c=this.resolveClientId(n),u=this.clients.get(c);!u||u.isClosed||(u.pty.kill(),this.closeState(c))}async destroySession(n){this.assertNotDisposed();let c=this.sessionClients.get(n);if(c){let n=[...c];for(let c of n){let n=this.clients.get(c);!n||n.isClosed||(n.pty.kill(),this.closeState(c))}}try{await killTmuxSession(this.tmuxExec,n)}catch(c){let u=c instanceof Error?c.message.toLowerCase():``;if(u.includes(`can't find session`)||u.includes(`no such session`))return;throw new PtyError(`TMUX_ATTACH_FAILED`,c instanceof Error?c.message:`Failed to destroy tmux session: ${n}`)}}getVisibleScreenText(n){this.assertNotDisposed();let c=this.requireClient(n).terminal,u=[];for(let n=0;n<c.rows;n+=1){let p=c.buffer.active.getLine(n);u.push(p?p.translateToString(!1):``)}return u.join(`
|
|
188
|
-
`)}openOutputStream(n){this.assertNotDisposed();let c=this.requireClient(n);if(c.outputStreamOpen)throw new PtyError(`PTY_OUTPUT_STREAM_ALREADY_OPEN`,`Output stream already open for ${n}`);c.outputStreamOpen=!0;let u=c.queue.iterable();return{async*[Symbol.asyncIterator](){try{for await(let n of u)yield n}finally{c.outputStreamOpen=!1}}}}async dispose(){await this.shutdownManagedClients()}createClientState(n){let{sessionName:c,cwd:u,env:p,cols:h,rows:x}=n,w=this.createTerminal(),T=new AsyncQueue,O=null,A;try{A=this.createPty(this.tmuxPath,[`attach-session`,`-t`,c],{name:`xterm-256color`,cols:h,rows:x,cwd:u,env:p?{...process.env,...p}:process.env})}catch(n){throw w.dispose(),new PtyError(`TMUX_ATTACH_FAILED`,n instanceof Error?n.message:`Failed to attach tmux session`)}let j={pty:A,terminal:w,queue:T,parserDisposables:registerParserHooks({terminal:w,getCurrentParsed:()=>O}),sessionName:c,isClosed:!1,outputStreamOpen:!1,parseChain:Promise.resolve(),currentParsed:O};return A.onData(n=>{let c=new TextEncoder().encode(n);j.parseChain=j.parseChain.then(()=>{let u=createParsedOutput();O=u,j.currentParsed=u;try{w.write(c)}finally{O=null,j.currentParsed=null}T.push({at:new Date().toISOString(),raw:c,text:n,parsed:u})}).catch(n=>{T.fail(n instanceof Error?n:Error(`Failed to parse pty output`))})}),j}resolveClientId(n){if(this.clients.has(n))return n;let c=this.latestClientBySession.get(n);if(c&&this.clients.has(c))return c;let u=this.sessionClients.get(n);if(u){for(let c of u)if(this.clients.has(c))return this.latestClientBySession.set(n,c),c}throw new PtyError(`PTY_CLIENT_NOT_FOUND`,`PTY client not found: ${n}`)}requireClient(n){let c=this.resolveClientId(n),u=this.clients.get(c);if(!u)throw new PtyError(`PTY_CLIENT_NOT_FOUND`,`PTY client not found: ${n}`);if(u.isClosed)throw new PtyError(`PTY_CLOSED`,`PTY client is closed: ${n}`);return u}closeState(n){let c=this.clients.get(n);if(!c)return;let{sessionName:u}=c;closeClientState(c),this.clients.delete(n);let p=this.sessionClients.get(u);if(p){if(p.delete(n),p.size===0)this.sessionClients.delete(u),this.latestClientBySession.delete(u);else if(this.latestClientBySession.get(u)===n){let n=p.values().next().value;n&&this.latestClientBySession.set(u,n)}}}async shutdownManagedClients(){return this.shutdownPromise||=(async()=>{for(let[n,c]of this.clients)c.pty.kill(),this.closeState(n);this.unregisterShutdownHandlers(),this.disposed=!0})(),this.shutdownPromise}assertNotDisposed(){if(this.disposed)throw new PtyError(`PTY_CLOSED`,`TmuxPtyClient has been disposed`)}};let cliTmuxClient=null;const getCliTmuxClient=()=>(cliTmuxClient??=new TmuxPtyClient({tmuxPath:resolveTmuxBinaryPath()}),cliTmuxClient),toTmuxOutputChunk=n=>({at:n.at,rawHex:Buffer$1.from(n.raw).toString(`hex`),text:n.text,parsed:{csi:[...n.parsed.csi],osc:[...n.parsed.osc],dcs:[...n.parsed.dcs],esc:[...n.parsed.esc]}}),cliTmuxSocketRuntime={open:async n=>{let c=await getCliTmuxClient().connectSession(n.sessionName,{createIfNotexists:n.createIfNotexists,...n.cwd?{cwd:n.cwd}:{},cols:n.cols??120,rows:n.rows??32});return{sessionName:c.sessionName,runtimeId:c.clientId}},sendInput:async(n,c,u)=>{await getCliTmuxClient().sendInput(u??n,c)},resize:async(n,c,u)=>{await getCliTmuxClient().resize(u??n,c)},async*output(n,c){let u=getCliTmuxClient();for await(let p of u.openOutputStream(c??n))yield toTmuxOutputChunk(p)},close:async(n,c,u)=>{await getCliTmuxClient().close(u??n)}},toRelayFailure=n=>({ok:!1,code:`RELAY_ACCEPT_FAILED`,message:n,details:{}}),createRelayAcceptOpenSignal=()=>{let n=!1,c=()=>{},u=()=>{};return{ready:new Promise((p,h)=>{c=()=>{n||(n=!0,p())},u=c=>{n||(n=!0,h(c))}}),resolveReady:c,rejectReady:u}};async function listCliTmuxSessions(){let n=getCliTmuxClient(),c=[];try{c=await n.listSessions()}catch(n){if(!(n instanceof PtyError)||n.code!==`TMUX_SERVER_UNAVAILABLE`)throw n}return{items:c.map(n=>({sessionName:n.name}))}}async function createCliTmuxSession(n){let c=getCliTmuxClient(),u=await c.connectSession(n.sessionName,{createIfNotexists:!0,...n.cwd?{cwd:n.cwd}:{}});return await c.close(u.clientId),{ok:!0}}async function deleteCliTmuxSession(n){return await getCliTmuxClient().destroySession(n.sessionName),{ok:!0}}async function acceptCliTmuxRelaySession(n){if(n.channel!==`tmux:session`)return toRelayFailure(`Unsupported relay session channel: ${n.channel}`);let c=n.sessionName?.trim();if(!c)return toRelayFailure(`tmux relay sessionName is required`);try{let u=await connectNodeTcpSocket({relayUrl:n.server.url,sessionId:n.sessionId,token:n.acceptor.token,role:`acceptor`}),p=createRelayAcceptOpenSignal(),h={...cliTmuxSocketRuntime,open:async n=>{try{let c=await cliTmuxSocketRuntime.open(n);return p.resolveReady(),c}catch(n){throw p.rejectReady(n instanceof Error?n:Error(`Failed to open tmux session`)),n}}},x=runTmuxSessionOverSocket(u,{deviceCode:n.deviceCode,sessionName:c,createIfNotexists:n.createIfNotexists??!1,...n.cwd?{cwd:n.cwd}:{}},h);return await p.ready,x.catch(()=>{}),{ok:!0}}catch(n){return toRelayFailure(n instanceof Error?n.message:String(n))}}async function disposeCliTmuxRuntime(){if(!cliTmuxClient)return;let n=cliTmuxClient;cliTmuxClient=null,await n.dispose()}const FINAL_CLEANUP_DELAY_MS=6e4,KILL_GRACE_PERIOD_MS=5e3;var NodeCommandRunner=class{commands=new Map;async requestRun(n){if(this.commands.has(n.sessionId))throw Error(`Command session is already running: ${n.sessionId}`);let[c,...u]=n.cmd;if(!c)throw Error(`Command is required`);let p={cwd:n.cwd&&n.cwd.length>0?n.cwd:void 0,env:n.env?{...process.env,...n.env}:process.env,shell:n.shell??!1,stdio:[`ignore`,`pipe`,`pipe`]},h=typeof p.cwd==`string`?p.cwd:void 0,x;try{x=this.createActiveCommand({sessionId:n.sessionId,command:c,args:u,spawnOptions:p,cwd:h,timeoutMs:n.timeoutMs})}catch(c){return this.buildStartFailure(n.sessionId,h,c)}this.commands.set(n.sessionId,x);let w=await this.waitForStart(n.sessionId,x);return w.ok?{ok:!0,sessionId:n.sessionId,localProcessId:x.localProcessId,...x.cwd?{cwd:x.cwd}:{}}:w}async stopRun(n){let c=this.commands.get(n);c&&(this.clearTimer(c),this.clearCleanupTimer(c),this.terminate(c),this.commands.delete(n))}onOutput(n,c){let u=this.commands.get(n);if(!u)throw Error(`Unknown command session: ${n}`);this.clearCleanupTimer(u),u.listeners.add(c);for(let n of u.pendingEvents)c(n);return u.pendingEvents=[],()=>{u.listeners.delete(c),u.ended&&u.listeners.size===0&&this.scheduleCleanup(n,u)}}emit(n,c){let u=this.commands.get(n);if(u){if(u.listeners.size===0){u.pendingEvents.push(c);return}for(let n of u.listeners)n(c)}}createActiveCommand(n){let c=spawn$1(n.command,n.args,n.spawnOptions),u=String(c.pid??``);c.stdout?.setEncoding(`utf8`),c.stderr?.setEncoding(`utf8`);let p={child:c,cwd:n.cwd,localProcessId:u,listeners:new Set,pendingEvents:[],cleanupTimer:null,ended:!1,timeoutHandle:null};return n.timeoutMs&&(p.timeoutHandle=setTimeout(()=>{this.terminate(p)},n.timeoutMs)),c.stdout?.on(`data`,c=>{this.emit(n.sessionId,{sessionId:n.sessionId,stdout:c,stderr:``,eof:!1,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),c.stderr?.on(`data`,c=>{this.emit(n.sessionId,{sessionId:n.sessionId,stdout:``,stderr:c,eof:!1,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),c.once(`exit`,(c,h)=>{this.finish(n.sessionId,{sessionId:n.sessionId,stdout:``,stderr:``,eof:!0,exitCode:c,signal:h,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),p}finishFailure(n,c,u){this.finish(n,{sessionId:n,stdout:``,stderr:this.formatError(u),eof:!0,exitCode:null,signal:null,localProcessId:c.localProcessId,...c.cwd?{cwd:c.cwd}:{}})}async waitForStart(n,c){return await new Promise(u=>{let p=!1,h=n=>{p||(p=!0,u(n))};c.child.once(`spawn`,()=>{if(!c.localProcessId){this.clearTimer(c),this.clearCleanupTimer(c),this.commands.delete(n),this.terminate(c),h(this.buildStartFailure(n,c.cwd,Error(`Failed to start command process`)));return}h({ok:!0,sessionId:n,localProcessId:c.localProcessId,...c.cwd?{cwd:c.cwd}:{}})}),c.child.once(`error`,u=>{if(!p){this.clearTimer(c),this.clearCleanupTimer(c),this.commands.delete(n),h(this.buildStartFailure(n,c.cwd,u));return}this.finishFailure(n,c,u)})})}buildStartFailure(n,c,u){return{ok:!1,sessionId:n,error:this.formatError(u),...c?{cwd:c}:{}}}finish(n,c){let u=this.commands.get(n);!u||u.ended||(u.ended=!0,this.clearTimer(u),this.emit(n,c),u.listeners.size===0&&this.scheduleCleanup(n,u))}scheduleCleanup(n,c){this.clearCleanupTimer(c),c.cleanupTimer=setTimeout(()=>{this.commands.delete(n)},FINAL_CLEANUP_DELAY_MS)}clearCleanupTimer(n){n.cleanupTimer&&=(clearTimeout(n.cleanupTimer),null)}clearTimer(n){n.timeoutHandle&&=(clearTimeout(n.timeoutHandle),null)}terminate(n){n.child.killed||(n.child.kill(`SIGTERM`),setTimeout(()=>{n.child.killed||n.child.kill(`SIGKILL`)},KILL_GRACE_PERIOD_MS))}formatError(n){return n instanceof Error?n.message:String(n)}};function registerCliDeviceCommandRpcHandlers(n){let c=new NodeCommandRunner,u=n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_COMMAND_REQUEST_RUN,async u=>await startReportedDeviceCommandSession({commandExecutor:c,request:u,reportOutput:async c=>await n.sendRpc(WS_RPC_DEVICES_CHANNELS.DEVICE_COMMAND_REPORT_OUTPUT,c),onReportError:n=>{console.error(`Failed to report command output`,n)}}));return()=>{n.removeRpcHandler(u)}}function registerCliDeviceTmuxRpcHandlers(n){let c=[n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSIONS_LIST,async()=>await listCliTmuxSessions()),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSION_CREATE,async n=>{let c=n;return await createCliTmuxSession({sessionName:c.sessionName,...c.cwd?{cwd:c.cwd}:{}})}),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSION_DELETE,async n=>await deleteCliTmuxSession({sessionName:n.sessionName}))];return()=>{for(let u of c)n.removeRpcHandler(u)}}const HTTP_URL_PATTERN=/^https?:\/\//i;function registerCliLocalFileRpcHandlers(n){let c=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.STAT_LOCAL_FILE,async n=>await statLocalFile(n)),u=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.REQUEST_LOCAL_FILE,async c=>await requestLocalFile(c,n)),p=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.PUT_FILE_TO_LOCAL,async n=>await putFileToLocal(n));return()=>{n.removeRpcHandler(c),n.removeRpcHandler(u),n.removeRpcHandler(p)}}async function statLocalFile(n){try{let c=await fs$2.stat(n.local.path);return c.isFile()?{ok:!0,sha256:await hashFile(n.local.path),sizeBytes:c.size,filename:basename(n.local.path)}:{ok:!1,reason:`Path is not a file`}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Stat failed`}}}async function requestLocalFile(n,c){let{acknowledgeUpload:u=!0,constraints:p,fileId:h,local:x,uploadUrl:w}=n;try{let n=await statLocalFile({local:x});return!n.ok||!n.filename||n.sizeBytes===void 0||!n.sha256||p?.maxSizeBytes!==void 0&&n.sizeBytes>p.maxSizeBytes||!(await uploadLocalFile({path:x.path,uploadUrl:w})).ok?{ok:!1}:(u&&await c.sendRpc(WS_RPC_FILE_CHANNELS.UPLOAD_FILE,{fileId:h,filename:n.filename,sizeBytes:n.sizeBytes,sha256:n.sha256,status:`completed`}),{ok:!0})}catch{return{ok:!1}}}async function uploadLocalFile(n){try{if(!(await fs$2.stat(n.path)).isFile())return{ok:!1,reason:`Path is not a file`};let c=await fs$2.readFile(n.path),u=await fetch(n.uploadUrl,{method:`PUT`,body:c});return u.ok?{ok:!0}:{ok:!1,reason:`Upload failed (${u.status})`}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Upload failed`}}}async function putFileToLocal(n){let{downloadUrl:c,headers:u,local:p}=n;try{if(!HTTP_URL_PATTERN.test(c))return{ok:!1,reason:`Invalid download URL`};await fs$2.mkdir(dirname(p.path),{recursive:!0});let n=await fetch(c,{method:`GET`,headers:u??{}});if(!n.ok||!n.body)return{ok:!1,reason:`Download failed (${n.status})`};await pipeline(Readable.fromWeb(n.body),createWriteStream(p.path));let h=await fs$2.stat(p.path);return{ok:!0,metadata:{path:p.path,isDirectory:!1,size:h.size,createdAt:h.birthtime?.toISOString?.()??void 0,updatedAt:h.mtime?.toISOString?.()??void 0}}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Download failed`}}}async function hashFile(n){let c=createHash$1(`sha256`);return await new Promise((u,p)=>{let h=createReadStream(n);h.on(`data`,n=>c.update(n)),h.on(`error`,p),h.on(`end`,()=>u())}),c.digest(`hex`)}let codexIntegration=null,claudeIntegration=null;const getCodexIntegration=()=>(codexIntegration??=new CodexIntegration(join(homedir$1(),`.codex`),process$1.cwd()),codexIntegration),getClaudeIntegration=()=>(claudeIntegration??=new ClaudeIntegration(process$1.cwd()),claudeIntegration),buildCliDeviceMetadata=n=>({command:{cwd:n,sourceType:`manual`},codex:{cwd:n,sourceType:`manual`}}),createCliRunRuntime=async n=>{if(!await loadAuthSession(n.endpoints))throw Error(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);let c=!1,u=null,p=new Promise(n=>{u=n}),h=async()=>{},x=createCliNetworkRuntime({deviceCode:n.deviceCode,endpoints:n.endpoints,getDeviceMetadata:async()=>buildCliDeviceMetadata(n.cwd),onExternalUrl:async()=>{throw Error(`CLI runtime does not support interactive external login`)},callbacks:{onExpired:async()=>{n.logSink.writeLine(`authentication expired; CLI runtime stopped`),await h()}}}),w=getCodexIntegration(),T={claude:getClaudeIntegration(),codex:w},O=createAgentIntegrationHandlers({integrations:T}),A=registerCliDeviceCommandRpcHandlers(x.provider),j=registerAgentDeviceRpcHandlers(x.provider,{integrations:T}),N=registerCliDeviceTmuxRpcHandlers(x.provider),I=registerCliLocalFileRpcHandlers(x.provider),L=x.provider.registerRpcHandler(WS_RPC_RELAY_CHANNELS.RELAY_SESSION_CONNECT_REQUEST,async n=>{let c=n;if(c.channel===`tmux:session`)return await acceptCliTmuxRelaySession(c);if(c.channel!==`agent:run`||!isCliAgentType(c.agentType)||!c.runId?.trim())return{ok:!1,code:`RELAY_ACCEPT_FAILED`,message:`Unsupported relay session channel: ${c.channel}`,details:{}};try{return await O.acceptRunRelaySession({agentType:c.agentType,relayUrl:c.server.url,sessionId:c.sessionId,runId:c.runId.trim(),token:c.acceptor.token}),{ok:!0}}catch(n){return{ok:!1,code:`RELAY_ACCEPT_FAILED`,message:n instanceof Error?n.message:String(n),details:{}}}});return h=async()=>{c||(c=!0,x.provider.removeRpcHandler(L),A(),j(),N(),I(),x.stop(),await disposeCliTmuxRuntime().catch(()=>{}),setCliPipelineScope(null),u?.())},{start:async()=>{n.logSink.writeLine(`Starting CLI runtime: deviceCode=${n.deviceCode} cwd=${n.cwd}`),await x.start(),await waitForRuntimeAuthentication(x),n.logSink.writeLine(`published local command and agent environments: deviceCode=${n.deviceCode} cwd=${n.cwd}`)},stop:h,waitUntilStopped:async()=>await p}};function isCliAgentType(n){return n===`claude`||n===`codex`}const DEFAULT_MAX_LOG_LINES=300,DEFAULT_VISIBLE_LOG_ROWS=12,LOG_LINE_BREAK_PATTERN=/\r?\n/g,readErrorMessage$1=n=>n instanceof Error?n.message:String(n),getAuthProviderForLoginMethod=n=>{switch(n){case`github`:return AuthProvider.GITHUB;case`google`:return AuthProvider.GOOGLE;case`slack`:return AuthProvider.SLACK;case`googleWorkspace`:return AuthProvider.GOOGLE_WORKSPACE}},normalizeLogLine=n=>n.replace(LOG_LINE_BREAK_PATTERN,` `),clamp=(n,c,u)=>Math.min(Math.max(n,c),u),getVisibleLogRows=n=>Math.max(1,n),getMaxLogViewportTop=n=>Math.max(0,n.linesLength-getVisibleLogRows(n.visibleLogRowCount)),clampLogViewportTop=n=>clamp(n.nextTop,0,getMaxLogViewportTop({linesLength:n.linesLength,visibleLogRowCount:n.visibleLogRowCount})),getVisibleLogViewport=n=>{let c=n.logLines.length,u=n.logCount;if(c===0)return{isFollowingTail:n.isFollowingLogTail,lines:[],showingFrom:0,showingTo:0,totalLogCount:u,totalRetained:c};let p=getVisibleLogRows(n.visibleLogRowCount),h=n.isFollowingLogTail?Math.max(0,c-p):clampLogViewportTop({linesLength:c,nextTop:n.logViewportTop,visibleLogRowCount:p}),x=n.logLines.slice(h,h+p);return{isFollowingTail:n.isFollowingLogTail,lines:x,showingFrom:h,showingTo:h+x.length,totalLogCount:u,totalRetained:c}},readStoredSessionEmail=n=>n?.email??null,createCliCoreStore=n=>{let c=n.maxLogLines??DEFAULT_MAX_LOG_LINES,u=createCliLogFileWriter(),p=null,h=new Promise(n=>{p=n});return createStore((x,w)=>{let T=n=>{w().exitCode===null&&(x({exitCode:n}),p?.(n),p=null)},O=n=>{w().isDisposed||x({errorMessage:null,fatalMessage:n,screen:`fatal`,statusMessage:null})},A=()=>{let n=w().loginRuntime;n&&(n.stop(),w().loginRuntime===n&&x({loginRuntime:null}))},j=async()=>{let n=w().cliRunRuntime;n&&(await n.stop().catch(()=>{}),w().cliRunRuntime===n&&x({cliRunRuntime:null}))},N=async()=>{let c=await loadBackendConfig(),u=resolveCliBackendConfig({baseUrl:n.baseUrl,ssl:n.ssl,storedBaseUrl:c?.baseUrl,storedSsl:c?.ssl});await saveBackendConfig(u);let p=deriveCliEndpoints(u);return w().isDisposed||x({resolvedEndpoints:p}),u},I=async()=>deriveCliEndpoints(await N()),L=async()=>{let n=deriveCliEndpoints(await N()),c=await loadAuthSession(n);return w().isDisposed||x({authenticatedEmail:readStoredSessionEmail(c),resolvedEndpoints:n}),{endpoints:n,session:c}},z=async()=>{let n=w().deviceCode;if(n)return n;let c=await loadOrCreateDeviceCode();return w().isDisposed||x({deviceCode:c}),c},B=async c=>{let u=n.token;if(!u)return!1;x({bootMessage:`Signing in with bootstrap token...`,screen:`boot`});let p=await I();return await loginWithBootstrapToken({deviceCode:c,endpoints:p,token:u}),w().isDisposed||x({authenticatedEmail:readStoredSessionEmail(await loadAuthSession(p))}),!0},V=async n=>{let c=w().loginRuntime;if(c)return c;x({bootMessage:`Connecting login runtime...`,screen:`boot`});let u=createCliNetworkRuntime({deviceCode:n,endpoints:await I(),onExternalUrl:async n=>{if(w().isDisposed)return;let c=w().currentProvider;x({errorMessage:null,externalUrl:n,providerLabel:c?getLoginMethodLabel(c):`External provider`,screen:`external_url`,statusMessage:null})}});if(await u.start(),w().isDisposed)throw u.stop(),Error(`CLI store disposed before login runtime was ready`);return x({currentProvider:null,errorMessage:null,loginRuntime:u,screen:`login_method`,selectedIndex:0,statusMessage:null}),u},H=async(n,c,u)=>{A(),await j();let p=u??await L();if(!p.session)throw Error(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);x({authenticatedEmail:readStoredSessionEmail(p.session),bootMessage:`Starting CLI runtime...`,cliRunRuntime:null,currentProvider:null,cwd:c,deviceCode:n,errorMessage:null,externalUrl:null,isFollowingLogTail:!0,logCount:0,logLines:[],logViewportTop:0,providerLabel:null,resolvedEndpoints:p.endpoints,screen:`boot`,statusMessage:null});let h=null;try{if(h=await createCliRunRuntime({cwd:c,deviceCode:n,endpoints:p.endpoints,logSink:{writeLine:n=>{w().appendLogLine(n)}}}),w().isDisposed){await h.stop().catch(()=>{});return}if(x({cliRunRuntime:h}),await h.start(),w().isDisposed){await h.stop().catch(()=>{});return}x({fatalMessage:null,screen:`running`}),h.waitUntilStopped().then(()=>{let n=w();n.isDisposed||n.isShuttingDown||n.setExitCode(0)})}catch(n){h&&await h.stop().catch(()=>{}),O(readErrorMessage$1(n))}},U=async n=>{let c=await L();if(!c.session)throw Error(`Login reported success, but no persisted session was found`);if(!w().isDisposed){if(n.kind===`run`){let u=w().deviceCode;if(!u)throw Error(`Missing device code`);await H(u,n.cwd,c);return}A(),x({authenticatedEmail:readStoredSessionEmail(c.session),currentProvider:null,errorMessage:null,externalUrl:null,providerLabel:null,screen:`login_method`,statusMessage:null})}},W=async(n,c={kind:`stay`})=>{let u=w().loginRuntime;if(!u){O(`Login runtime is not available`);return}x({currentProvider:n,errorMessage:null,screen:`login_method`,selectedIndex:LOGIN_METHODS.indexOf(n),statusMessage:`Preparing ${getLoginMethodLabel(n)} login...`});try{if(!await u.startLogin(getAuthProviderForLoginMethod(n),{preferredLanguage:resolveCliPreferredLanguage()}))throw Error(getRuntimeAuthError(u)??`${getLoginMethodLabel(n)} login failed`);await U(c)}catch(c){if(w().isDisposed)return;x({currentProvider:null,errorMessage:readErrorMessage$1(c),screen:`login_method`,selectedIndex:LOGIN_METHODS.indexOf(n),statusMessage:null})}};return{authenticatedEmail:null,bootMessage:`Booting ${CLI_BRAND.command}...`,cliRunRuntime:null,currentProvider:null,cwd:n.defaultCwd,deviceCode:null,errorMessage:null,exitCode:null,externalUrl:null,fatalMessage:null,isFollowingLogTail:!0,isDisposed:!1,isShuttingDown:!1,logCount:0,logLines:[],logViewportTop:0,loginRuntime:null,providerLabel:null,resolvedEndpoints:null,screen:`boot`,selectedIndex:0,statusMessage:null,visibleLogRowCount:DEFAULT_VISIBLE_LOG_ROWS,appendLogLine:n=>{let p=normalizeLogLine(n);x(n=>({...(()=>{let h=[...n.logLines,p],x=Math.max(0,h.length-c),w=x>0?h.slice(0,x):[],T=x>0?h.slice(x):h;w.length>0&&u.appendLines(w);let O=n.isFollowingLogTail?Math.max(0,T.length-getVisibleLogRows(n.visibleLogRowCount)):clampLogViewportTop({linesLength:T.length,nextTop:n.logViewportTop-x,visibleLogRowCount:n.visibleLogRowCount});return{logCount:n.logCount+1,logLines:T,logViewportTop:O}})()}))},bootstrapHeadlessLogin:async()=>{try{x({bootMessage:`Preparing device identity...`,fatalMessage:null,screen:`boot`});let n=await z();if(w().isDisposed)return;let c=await B(n);if(w().isDisposed||c)return;await V(n)}catch(n){O(readErrorMessage$1(n))}},bootstrapHeadlessRun:async()=>{try{x({bootMessage:`Preparing device identity...`,cwd:n.defaultCwd,fatalMessage:null,screen:`boot`});let c=await z();if(w().isDisposed||(await B(c),w().isDisposed))return;let u=await L();if(!u.session){O(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);return}await H(c,n.defaultCwd,u)}catch(n){O(readErrorMessage$1(n))}},bootstrapInteractive:async()=>{try{x({bootMessage:`Preparing device identity...`,fatalMessage:null,screen:`boot`});let n=await z();if(w().isDisposed||(await B(n),w().isDisposed))return;let c=await L();if(w().isDisposed)return;if(c.session){await H(n,w().cwd,c);return}await V(n)}catch(n){O(readErrorMessage$1(n))}},dispose:async()=>{w().isDisposed||(x({isDisposed:!0}),A(),await j(),await u.flush().catch(()=>{}))},jumpLogsToEnd:()=>{x(n=>({isFollowingLogTail:!0,logViewportTop:getMaxLogViewportTop({linesLength:n.logLines.length,visibleLogRowCount:n.visibleLogRowCount})}))},jumpLogsToStart:()=>{x({isFollowingLogTail:!1,logViewportTop:0})},moveLoginSelection:n=>{w().screen===`login_method`&&x(c=>({errorMessage:null,selectedIndex:moveLoginMethodSelection(c.selectedIndex,n)}))},pageLogsDown:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop+getVisibleLogRows(n.visibleLogRowCount),visibleLogRowCount:n.visibleLogRowCount})}))},pageLogsUp:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop-getVisibleLogRows(n.visibleLogRowCount),visibleLogRowCount:n.visibleLogRowCount})}))},scrollLogsDown:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop+1,visibleLogRowCount:n.visibleLogRowCount})}))},scrollLogsUp:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop-1,visibleLogRowCount:n.visibleLogRowCount})}))},setExitCode:n=>{w().isDisposed||T(n)},setVisibleLogRowCount:n=>{x(c=>{let u=getVisibleLogRows(n);return{logViewportTop:c.isFollowingLogTail?Math.max(0,c.logLines.length-u):clampLogViewportTop({linesLength:c.logLines.length,nextTop:c.logViewportTop,visibleLogRowCount:u}),visibleLogRowCount:u}})},shutdown:async n=>{w().isDisposed||w().isShuttingDown||(x({isShuttingDown:!0}),A(),await j(),await u.flush().catch(()=>{}),!w().isDisposed&&T(n))},startProviderLogin:W,submitSelectedLoginMethod:async()=>{let{screen:n,selectedIndex:c}=w();n===`login_method`&&await W(LOGIN_METHODS[c]??DEFAULT_LOGIN_METHOD,{cwd:w().cwd,kind:`run`})},waitForExit:async()=>await h}})},createStdoutSink=()=>({writeLine:n=>{stdout.write(`${n}\n`)}}),requireMethod=n=>{let c=n?.trim();if(!c||!isLoginMethod(c))throw Error(`login requires --method ${LOGIN_METHOD_OPTIONS_TEXT} when --token is not provided`);return c},throwIfFatal$1=n=>{let c=n.getState().fatalMessage;if(c)throw Error(c)},runNonInteractiveLoginCommand=async n=>{let c=createStdoutSink(),u=createCliCoreStore({baseUrl:n.baseUrl,defaultCwd:process.cwd(),ssl:n.ssl,token:n.token}),p=u.subscribe((n,u)=>{n.externalUrl&&n.externalUrl!==u.externalUrl&&(c.writeLine(`Open this URL to continue login:`),c.writeLine(n.externalUrl))});try{if(await u.getState().bootstrapHeadlessLogin(),throwIfFatal$1(u),n.token){c.writeLine(`CLI session verified and saved`);return}let p=requireMethod(n.method);await u.getState().startProviderLogin(p,{kind:`stay`}),throwIfFatal$1(u),c.writeLine(`CLI session verified and saved`)}finally{p(),await u.getState().dispose()}},packageJson$1=createRequire(import.meta.url)(`../package.json`),CLI_VERSION=typeof packageJson$1.version==`string`&&packageJson$1.version.length>0?packageJson$1.version:`0.0.0`,CLI_UPDATES_CACHE_KEY=`updates/cli.json`,CLI_UPDATES_INTERVAL_MS=720*60*1e3,readErrorMessage=n=>n instanceof Error?n.message:String(n),parseTruthyEnvFlag$1=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`||c===`yes`},shouldSkipCliUpdateCheck=n=>n===!0||parseTruthyEnvFlag$1(process.env.SYNCLESS_SKIP_UPDATE_CHECK),resolveCliReleaseChannel=n=>n.includes(`-preview`)?`preview`:n.includes(`-`)?`beta`:`stable`,resolveCliReleasePlatform=()=>process.platform===`darwin`&&process.arch===`arm64`?`darwin-arm64`:process.platform===`darwin`&&process.arch===`x64`?`darwin-x64`:process.platform===`linux`&&process.arch===`x64`?`linux-x64`:process.platform===`linux`&&process.arch===`arm64`?`linux-arm64`:null,getCliUpdatesBaseUrl=()=>{let n=``?.trim();if(n)return n;let c=``?.trim();return c&&c.length>0?c:null},createEmptyCliUpdateState=n=>({enabled:n,checkedAt:null,currentVersion:CLI_VERSION,dismissedVersion:null,errorMessage:null,result:null}),createCliUpdateErrorState=n=>({enabled:!0,checkedAt:n.previousState?.checkedAt??null,currentVersion:CLI_VERSION,dismissedVersion:n.previousState?.dismissedVersion??null,errorMessage:readErrorMessage(n.error),result:null}),resolveDismissedCliVersion=n=>n.previousDismissedVersion===n.latestVersion?n.previousDismissedVersion:null,readCliUpdateState=async n=>{let c=await n.fetch(CLI_UPDATES_CACHE_KEY);return!c||c.currentVersion!==CLI_VERSION?null:{enabled:!0,checkedAt:c.checkedAt,currentVersion:c.currentVersion,dismissedVersion:c.dismissedVersion??null,errorMessage:c.errorMessage??null,result:c.result}},writeCliUpdateState=async(n,c)=>{await n.persist(CLI_UPDATES_CACHE_KEY,{checkedAt:c.checkedAt,currentVersion:c.currentVersion,dismissedVersion:c.dismissedVersion??null,errorMessage:c.errorMessage??null,result:c.result})},getDismissableCliUpdateVersion=n=>n.result?.availability===`update_available`?n.result.manifest.latestVersion:null,dismissCliUpdate=async(n,c)=>{let u=getDismissableCliUpdateVersion(c);if(!u||c.dismissedVersion===u)return c;let p={...c,dismissedVersion:u};try{await writeCliUpdateState(n,p)}catch{}return p},dismissCliAvailableUpdateNotice=async(n,c={})=>await dismissCliUpdate(c.persistence??cliPersistenceStore,n),resolveCliUpdateInstruction=n=>{if(!n.result)return null;for(let c of n.result.manifest.actions){if(c.kind===`command`&&c.command)return c.command;if((c.kind===`download`||c.kind===`store`||c.kind===`docs`)&&c.url)return c.url}return n.result.manifest.releaseNotesUrl??null},formatCliUpdateMessage=n=>{if(n.errorMessage||!n.result||n.result.availability===`up_to_date`)return null;let c=n.result.manifest.latestVersion;if(n.result.availability===`update_available`&&n.dismissedVersion===c)return null;let u=resolveCliUpdateInstruction(n),p=n.result.availability===`update_required`?`Update required`:`Update available`;return u?`${p}: ${PRODUCT_DISPLAY_NAME} ${c} is available (current ${n.currentVersion}). Use ${u}`:`${p}: ${PRODUCT_DISPLAY_NAME} ${c} is available (current ${n.currentVersion}).`},checkCliUpdatesNow=async(n={})=>{let c=n.persistence??cliPersistenceStore,u=await readCliUpdateState(c),p=resolveCliReleasePlatform(),h=getCliUpdatesBaseUrl();if(!p||!h)return createEmptyCliUpdateState(!1);try{let x=await checkForUpdates({baseUrl:h,product:`cli`,channel:resolveCliReleaseChannel(CLI_VERSION),platform:p,currentVersion:CLI_VERSION,fetch:n.fetch??createCliObservedFetch(`cli.updates`)}),w={enabled:!0,checkedAt:new Date().toISOString(),currentVersion:CLI_VERSION,dismissedVersion:resolveDismissedCliVersion({latestVersion:x.manifest.latestVersion,previousDismissedVersion:u?.dismissedVersion}),errorMessage:null,result:x};return await writeCliUpdateState(c,w),w}catch(n){return createCliUpdateErrorState({error:n,previousState:u})}},enforceCliUpdatePolicy=async(n={})=>{if(shouldSkipCliUpdateCheck(n.skipUpdateCheck))return createEmptyCliUpdateState(!1);let c=await checkCliUpdatesNow(n),u=formatCliUpdateMessage(c);if(!u)return c;if(c.result?.availability===`update_required`)throw Error(u);return(n.writeMessage??(n=>{stderr.write(`${n}\n`)}))(u),c},startCliUpdatePolling=n=>{if(shouldSkipCliUpdateCheck(n.skipUpdateCheck))return()=>{};let c=null,u=setInterval(()=>{checkCliUpdatesNow(n).then(u=>{let p=formatCliUpdateMessage(u);if(!p||!u.result)return;let h=`${u.result.availability}:${u.result.manifest.latestVersion}`;c!==h&&(c=h,n.onUpdate(u,p))}).catch(()=>{})},CLI_UPDATES_INTERVAL_MS);return()=>{clearInterval(u)}},MACOS_CAFFEINATE_PATH=`/usr/bin/caffeinate`,PREVENT_SLEEP_CAFFEINATE_PATH_ENV=`SYNCLESS_E2E_CAFFEINATE_PATH`,PREVENT_SLEEP_PLATFORM_ENV=`SYNCLESS_E2E_PREVENT_SLEEP_PLATFORM`,writePreventSleepWarning=n=>{process.stderr.write(`Warning: ${n}\n`)},parseTruthyEnvFlag=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`||c===`yes`},shouldPreventSleepForRun=n=>n===!0||parseTruthyEnvFlag(process.env.SYNCLESS_PREVENT_SLEEP),getPreventSleepPlatform=()=>process.env[PREVENT_SLEEP_PLATFORM_ENV]||process.platform,getCaffeinatePath=()=>process.env[PREVENT_SLEEP_CAFFEINATE_PATH_ENV]||MACOS_CAFFEINATE_PATH;function stopCaffeinate(n){n.exitCode!==null||n.signalCode!==null||n.kill()}function startPreventSleepForRun(){if(getPreventSleepPlatform()!==`darwin`)return writePreventSleepWarning(`--prevent-sleep is only supported on macOS; continuing without a sleep blocker.`),{stop:()=>{}};let n=getCaffeinatePath();if(!existsSync(n))return writePreventSleepWarning(`macOS caffeinate was not found; continuing without a sleep blocker.`),{stop:()=>{}};try{let c=spawn$1(n,[`-i`,`-w`,String(process.pid)],{stdio:`ignore`}),u=!1,p=!1,h=(n,c)=>{p||n===0||(p=!0,writePreventSleepWarning(`caffeinate exited early; continuing without a sleep blocker. ${c?`signal ${c}`:`exit code ${String(n)}`}`))};return c.once(`error`,n=>{u||writePreventSleepWarning(`failed to start caffeinate; continuing without a sleep blocker. ${n.message}`)}),c.once(`exit`,(n,c)=>{u||h(n,c)}),c.unref(),{stop:()=>{u||(u=!0,c.exitCode!==null&&h(c.exitCode,c.signalCode),stopCaffeinate(c))}}}catch(n){return writePreventSleepWarning(`failed to start caffeinate; continuing without a sleep blocker. ${n instanceof Error?n.message:String(n)}`),{stop:()=>{}}}}const throwIfFatal=n=>{let c=n.getState().fatalMessage;if(c)throw Error(c)},runNonInteractiveRunCommand=async n=>{let c=createStdoutSink(),u=createCliCoreStore({baseUrl:n.baseUrl,defaultCwd:process.cwd(),ssl:n.ssl,token:n.token}),p=u.subscribe((n,u)=>{if(n.logCount<=u.logCount)return;let p=n.logLines.at(-1);p&&c.writeLine(p)}),h=async()=>{await u.getState().shutdown(0)},x=()=>{h()},w=()=>{h()},T=startCliUpdatePolling({onUpdate:(n,c)=>{process.stderr.write(`${c}\n`)}}),O=shouldPreventSleepForRun(n.preventSleep)?startPreventSleepForRun():null;process.once(`SIGINT`,x),process.once(`SIGTERM`,w);try{await u.getState().bootstrapHeadlessRun(),throwIfFatal(u),await u.getState().waitForExit()}finally{O?.stop(),T(),p(),process.off(`SIGINT`,x),process.off(`SIGTERM`,w),await u.getState().dispose()}},DIST_DIRECTORY_NAME=`dist`,RUNTIME_DIRECTORY_NAME=`runtime`,ENV_FILES=[`.env`,`.env.local`],resolveCurrentDistDirectory=n=>{let c=fileURLToPath(n),u=dirname(c);if(u.endsWith(`/${DIST_DIRECTORY_NAME}`))return u;throw Error(`Cannot install service runtime from non-dist entrypoint: ${c}`)},getCliServiceRuntimeRoot=(n=CLI_VERSION)=>join(getCliStateDir(),RUNTIME_DIRECTORY_NAME,n),installCurrentCliRuntime=async n=>{let c=resolveCurrentDistDirectory(n.entrypointUrl),u=dirname(c),p=getCliServiceRuntimeRoot(n.version??CLI_VERSION),h=join(p,DIST_DIRECTORY_NAME);await rm(p,{force:!0,recursive:!0}),await mkdir(p,{recursive:!0}),await cp(c,h,{recursive:!0});for(let n of ENV_FILES)await cp(join(u,n),join(p,n),{force:!0}).catch(n=>{if(!(n&&typeof n==`object`&&`code`in n&&n.code===`ENOENT`))throw n});return{cliPath:join(h,`cli.js`),runtimeRoot:p}},SYNCLESS_SYSTEMD_SERVICE_NAME=`syncless.service`,getXdgConfigHome=()=>process.env.XDG_CONFIG_HOME||join(homedir$1(),`.config`),runCommand=async(n,c)=>{await new Promise((u,p)=>{let h=spawn$1(n,[...c],{env:process.env,stdio:`inherit`});h.on(`error`,p),h.on(`exit`,(h,x)=>{if(h===0){u();return}p(Error(`${n} ${c.join(` `)} failed with ${x?`signal ${x}`:`exit code ${String(h)}`}`))})})},getSystemdUserServicePath=()=>join(getXdgConfigHome(),`systemd`,`user`,SYNCLESS_SYSTEMD_SERVICE_NAME),buildSystemdUserServiceUnit=n=>{let c=[n.nodePath,n.cliPath,`run`,`--non-interactive`,`--base-url`,n.apiBaseUrl,...n.noSsl?[`--no-ssl`]:[]];return[`[Unit]`,`Description=Syncless CLI runtime`,`After=network-online.target`,``,`[Service]`,`Type=simple`,`WorkingDirectory=${n.workingDirectory}`,`ExecStart=${c.join(` `)}`,`Restart=always`,`RestartSec=5`,`Environment=SYNCLESS_SERVICE=1`,``,`[Install]`,`WantedBy=default.target`,``].join(`
|
|
189
|
-
`)},installSystemdUserService=async n=>{let c=getSystemdUserServicePath();return await mkdir(dirname(c),{recursive:!0}),await writeFile(c,n,{encoding:`utf8`,mode:384}),await runCommand(`systemctl`,[`--user`,`daemon-reload`]),await runCommand(`systemctl`,[`--user`,`enable`,`--now`,SYNCLESS_SYSTEMD_SERVICE_NAME]),c},uninstallSystemdUserService=async()=>{let n=getSystemdUserServicePath();return await runCommand(`systemctl`,[`--user`,`disable`,`--now`,SYNCLESS_SYSTEMD_SERVICE_NAME]),await rm(n,{force:!0}),await runCommand(`systemctl`,[`--user`,`daemon-reload`]),n},stopSystemdUserService=async()=>{await runCommand(`systemctl`,[`--user`,`stop`,SYNCLESS_SYSTEMD_SERVICE_NAME])},showSystemdUserServiceStatus=async()=>{await runCommand(`systemctl`,[`--user`,`status`,`--no-pager`,SYNCLESS_SYSTEMD_SERVICE_NAME])},showSystemdUserServiceLogs=async()=>{await runCommand(`journalctl`,[`--user`,`-u`,SYNCLESS_SYSTEMD_SERVICE_NAME,`-f`])},enableUserLinger=async n=>{await runCommand(`loginctl`,[`enable-linger`,n])},SERVICE_ACTIONS={INSTALL:`install`,LOGS:`logs`,STATUS:`status`,STOP:`stop`,UNINSTALL:`uninstall`},SERVICE_TARGETS={AUTO:`auto`,SYSTEMD_USER:`systemd-user`},isServiceAction=n=>Object.values(SERVICE_ACTIONS).includes(n),parseServiceAction=n=>{if(isServiceAction(n))return n;throw Error(`Unknown service action: ${n}. Expected install, status, logs, stop, or uninstall.`)},parseServiceTarget=n=>{let c=n||SERVICE_TARGETS.AUTO;if(c===SERVICE_TARGETS.AUTO||c===SERVICE_TARGETS.SYSTEMD_USER)return c;throw Error(`Unknown service target: ${c}. Expected auto or systemd-user.`)},resolveServiceTarget=n=>{let c=parseServiceTarget(n);if(c!==SERVICE_TARGETS.AUTO)return c;if(process$1.platform===`linux`)return SERVICE_TARGETS.SYSTEMD_USER;throw Error(`Service install currently supports Linux systemd user services. Pass --target systemd-user only when testing or provisioning a compatible host.`)},resolveAndStoreBackendConfig=async n=>{let c=await loadBackendConfig(),u=resolveCliBackendConfig({baseUrl:n.baseUrl,ssl:n.ssl,storedBaseUrl:c?.baseUrl,storedSsl:c?.ssl});return await saveBackendConfig(u),u},ensureServiceAuth=async n=>{n.token&&await runNonInteractiveLoginCommand({baseUrl:n.baseUrl,ssl:n.ssl,token:n.token});let c=await resolveAndStoreBackendConfig(n);if(!await loadAuthSession(deriveCliEndpoints(c)))throw Error(`No valid CLI session found. Run service install with --token or run login --non-interactive first.`);return c},runServiceInstall=async n=>{let c=resolveServiceTarget(n.target),u=await ensureServiceAuth(n),p=await installCurrentCliRuntime({entrypointUrl:import.meta.url});if(c===SERVICE_TARGETS.SYSTEMD_USER){let c=await installSystemdUserService(buildSystemdUserServiceUnit({apiBaseUrl:u.baseUrl,cliPath:p.cliPath,nodePath:process$1.execPath,noSsl:!u.ssl,workingDirectory:n.workingDirectory||process$1.cwd()}));if(n.enableLinger){let n=process$1.env.USER;if(!n)throw Error(`Cannot enable linger because USER is not set`);await enableUserLinger(n)}process$1.stdout.write(`Installed Syncless service: ${c}\n`),process$1.stdout.write(`Installed Syncless runtime: ${p.runtimeRoot}\n`)}},runServiceCommand=async(n,c)=>{let u=parseServiceAction(n),p=resolveServiceTarget(c.target);if(u===SERVICE_ACTIONS.INSTALL){await runServiceInstall(c);return}if(p===SERVICE_TARGETS.SYSTEMD_USER){if(u===SERVICE_ACTIONS.STATUS){await showSystemdUserServiceStatus();return}if(u===SERVICE_ACTIONS.LOGS){await showSystemdUserServiceLogs();return}if(u===SERVICE_ACTIONS.STOP){await stopSystemdUserService();return}if(u===SERVICE_ACTIONS.UNINSTALL){let n=await uninstallSystemdUserService();process$1.stdout.write(`Uninstalled Syncless service: ${n}\n`)}}};function debounce$1(n,c,{signal:u,edges:p}={}){let h,x=null,w=p!=null&&p.includes(`leading`),T=p==null||p.includes(`trailing`),O=()=>{x!==null&&(n.apply(h,x),h=void 0,x=null)},A=()=>{T&&O(),L()},j=null,N=()=>{j!=null&&clearTimeout(j),j=setTimeout(()=>{j=null,A()},c)},I=()=>{j!==null&&(clearTimeout(j),j=null)},L=()=>{I(),h=void 0,x=null},z=()=>{O()},B=function(...n){if(u?.aborted)return;h=this,x=n;let c=j==null;N(),w&&c&&O()};return B.schedule=N,B.cancel=L,B.flush=z,u?.addEventListener(`abort`,L,{once:!0}),B}function debounce(n,c=0,u={}){typeof u!=`object`&&(u={});let{leading:p=!1,trailing:h=!0,maxWait:x}=u,w=[,,];p&&(w[0]=`leading`),h&&(w[1]=`trailing`);let T,O=null,A=debounce$1(function(...c){T=n.apply(this,c),O=null},c,{edges:w}),j=function(...c){return x!=null&&(O===null&&(O=Date.now()),Date.now()-O>=x)?(T=n.apply(this,c),O=Date.now(),A.cancel(),A.schedule(),T):(A.apply(this,c),T)};return j.cancel=A.cancel,j.flush=()=>(A.flush(),T),j}function throttle(n,c=0,u={}){let{leading:p=!0,trailing:h=!0}=u;return debounce(n,c,{leading:p,maxWait:c,trailing:h})}const isBrowser=globalThis.window?.document!==void 0,isNode=globalThis.process?.versions?.node!==void 0,isBun=globalThis.process?.versions?.bun!==void 0,isDeno=globalThis.Deno?.version?.deno!==void 0,isElectron=globalThis.process?.versions?.electron!==void 0,isJsDom=globalThis.navigator?.userAgent?.includes(`jsdom`)===!0,isWebWorker=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,isDedicatedWorker=typeof DedicatedWorkerGlobalScope<`u`&&globalThis instanceof DedicatedWorkerGlobalScope,isSharedWorker=typeof SharedWorkerGlobalScope<`u`&&globalThis instanceof SharedWorkerGlobalScope,isServiceWorker=typeof ServiceWorkerGlobalScope<`u`&&globalThis instanceof ServiceWorkerGlobalScope,platform=globalThis.navigator?.userAgentData?.platform,isMacOs=platform===`macOS`||globalThis.navigator?.platform===`MacIntel`||globalThis.navigator?.userAgent?.includes(` Mac `)===!0||globalThis.process?.platform===`darwin`,isWindows$1=platform===`Windows`||globalThis.navigator?.platform===`Win32`||globalThis.process?.platform===`win32`,isLinux=platform===`Linux`||globalThis.navigator?.platform?.startsWith(`Linux`)===!0||globalThis.navigator?.userAgent?.includes(` Linux `)===!0||globalThis.process?.platform===`linux`,isIos=platform===`iOS`||globalThis.navigator?.platform===`MacIntel`&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),isAndroid=platform===`Android`||globalThis.navigator?.platform===`Android`||globalThis.navigator?.userAgent?.includes(` Android `)===!0||globalThis.process?.platform===`android`,ESC=`\x1B[`,SEP=`;`,isTerminalApp=!isBrowser&&process$1.env.TERM_PROGRAM===`Apple_Terminal`,isWindows=!isBrowser&&process$1.platform===`win32`,isTmux=!isBrowser&&(process$1.env.TERM?.startsWith(`screen`)||process$1.env.TERM?.startsWith(`tmux`)||process$1.env.TMUX!==void 0),cwdFunction=isBrowser?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:process$1.cwd,cursorTo=(n,c)=>{if(typeof n!=`number`)throw TypeError("The `x` argument is required");return typeof c==`number`?ESC+(c+1)+SEP+(n+1)+`H`:ESC+(n+1)+`G`},cursorUp=(n=1)=>ESC+n+`A`,cursorDown=(n=1)=>ESC+n+`B`,cursorLeft=ESC+`G`,cursorSavePosition=isTerminalApp?`\x1B7`:ESC+`s`,cursorRestorePosition=isTerminalApp?`\x1B8`:ESC+`u`,cursorGetPosition=ESC+`6n`,cursorNextLine=ESC+`E`,cursorPrevLine=ESC+`F`,cursorHide=ESC+`?25l`,cursorShow=ESC+`?25h`,eraseLines=n=>{let c=``;for(let u=0;u<n;u++)c+=eraseLine+(u<n-1?cursorUp():``);return n&&(c+=`\x1B[G`),c},eraseEndLine=ESC+`K`,eraseStartLine=ESC+`1K`,eraseLine=ESC+`2K`,eraseDown=ESC+`J`,eraseUp=ESC+`1J`,eraseScreen=ESC+`2J`,scrollUp=ESC+`S`,scrollDown=ESC+`T`,clearViewport=`${eraseScreen}${ESC}H`,isOldWindows=()=>{if(isBrowser||!isWindows)return!1;let n=os.release().split(`.`),c=Number(n[0]),u=Number(n[2]??0);return c<10||c===10&&u<10586},clearTerminal=isOldWindows()?`${eraseScreen}${ESC}0f`:`${eraseScreen}${ESC}3J${ESC}H`,enterAlternativeScreen=ESC+`?1049h`,exitAlternativeScreen=ESC+`?1049l`,beginSynchronizedOutput=ESC+`?2026h`,endSynchronizedOutput=ESC+`?2026l`,check=n=>n in env&&env[n]!==`0`&&env[n]!==`false`,isInCi=check(`CI`)||check(`CONTINUOUS_INTEGRATION`),getAllProperties=n=>{let c=new Set;do for(let u of Reflect.ownKeys(n))c.add([n,u]);while((n=Reflect.getPrototypeOf(n))&&n!==Object.prototype);return c};function autoBind(n,{include:c,exclude:u}={}){let p=n=>{let p=c=>typeof c==`string`?n===c:c.test(n);return c?c.some(p):u?!u.some(p):!0};for(let[c,u]of getAllProperties(n.constructor.prototype)){if(u===`constructor`||!p(u))continue;let h=Reflect.getOwnPropertyDescriptor(c,u);h&&typeof h.value==`function`&&(n[u]=n[u].bind(n))}return n}var require_signals=__commonJSMin$1(((n,c)=>{c.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&c.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&c.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),require_signal_exit=__commonJSMin$1(((n,c)=>{var u=global.process;let p=function(n){return n&&typeof n==`object`&&typeof n.removeListener==`function`&&typeof n.emit==`function`&&typeof n.reallyExit==`function`&&typeof n.listeners==`function`&&typeof n.kill==`function`&&typeof n.pid==`number`&&typeof n.on==`function`};if(!p(u))c.exports=function(){return function(){}};else{var h=__require(`assert`),x=require_signals(),w=/^win/i.test(u.platform),T=__require(`events`);typeof T!=`function`&&(T=T.EventEmitter);var O;u.__signal_exit_emitter__?O=u.__signal_exit_emitter__:(O=u.__signal_exit_emitter__=new T,O.count=0,O.emitted={}),O.infinite||(O.setMaxListeners(1/0),O.infinite=!0),c.exports=function(n,c){if(!p(global.process))return function(){};h.equal(typeof n,`function`,`a callback must be provided for exit handler`),I===!1&&L();var u=`exit`;return c&&c.alwaysLast&&(u=`afterexit`),O.on(u,n),function(){O.removeListener(u,n),O.listeners(`exit`).length===0&&O.listeners(`afterexit`).length===0&&A()}};var A=function(){!I||!p(global.process)||(I=!1,x.forEach(function(n){try{u.removeListener(n,N[n])}catch{}}),u.emit=V,u.reallyExit=z,--O.count)};c.exports.unload=A;var j=function(n,c,u){O.emitted[n]||(O.emitted[n]=!0,O.emit(n,c,u))},N={};x.forEach(function(n){N[n]=function(){p(global.process)&&u.listeners(n).length===O.count&&(A(),j(`exit`,null,n),j(`afterexit`,null,n),w&&n===`SIGHUP`&&(n=`SIGINT`),u.kill(u.pid,n))}}),c.exports.signals=function(){return x};var I=!1,L=function(){I||!p(global.process)||(I=!0,O.count+=1,x=x.filter(function(n){try{return u.on(n,N[n]),!0}catch{return!1}}),u.emit=H,u.reallyExit=B)};c.exports.load=L;var z=u.reallyExit,B=function(n){p(global.process)&&(u.exitCode=n||0,j(`exit`,u.exitCode,null),j(`afterexit`,u.exitCode,null),z.call(u,u.exitCode))},V=u.emit,H=function(n,c){if(n===`exit`&&p(global.process)){c!==void 0&&(u.exitCode=c);var h=V.apply(this,arguments);return j(`exit`,u.exitCode,null),j(`afterexit`,u.exitCode,null),h}else return V.apply(this,arguments)}}})),import_signal_exit=__toESM(require_signal_exit(),1);const consoleMethods=[`assert`,`count`,`countReset`,`debug`,`dir`,`dirxml`,`error`,`group`,`groupCollapsed`,`groupEnd`,`info`,`log`,`table`,`time`,`timeEnd`,`timeLog`,`trace`,`warn`];let originalMethods={};const patchConsole=n=>{let c=new PassThrough,u=new PassThrough;c.write=c=>{n(`stdout`,c)},u.write=c=>{n(`stderr`,c)};let p=new console.Console(c,u);for(let n of consoleMethods)originalMethods[n]=console[n],console[n]=p[n];return()=>{for(let n of consoleMethods)console[n]=originalMethods[n];originalMethods={}}};
|
|
188
|
+
`)}openOutputStream(n){this.assertNotDisposed();let c=this.requireClient(n);if(c.outputStreamOpen)throw new PtyError(`PTY_OUTPUT_STREAM_ALREADY_OPEN`,`Output stream already open for ${n}`);c.outputStreamOpen=!0;let u=c.queue.iterable();return{async*[Symbol.asyncIterator](){try{for await(let n of u)yield n}finally{c.outputStreamOpen=!1}}}}async dispose(){await this.shutdownManagedClients()}createClientState(n){let{sessionName:c,cwd:u,env:p,cols:h,rows:x}=n,w=this.createTerminal(),T=new AsyncQueue,O=null,A;try{A=this.createPty(this.tmuxPath,[`attach-session`,`-t`,c],{name:`xterm-256color`,cols:h,rows:x,cwd:u,env:p?{...process.env,...p}:process.env})}catch(n){throw w.dispose(),new PtyError(`TMUX_ATTACH_FAILED`,n instanceof Error?n.message:`Failed to attach tmux session`)}let j={pty:A,terminal:w,queue:T,parserDisposables:registerParserHooks({terminal:w,getCurrentParsed:()=>O}),sessionName:c,isClosed:!1,outputStreamOpen:!1,parseChain:Promise.resolve(),currentParsed:O};return A.onData(n=>{let c=new TextEncoder().encode(n);j.parseChain=j.parseChain.then(()=>{let u=createParsedOutput();O=u,j.currentParsed=u;try{w.write(c)}finally{O=null,j.currentParsed=null}T.push({at:new Date().toISOString(),raw:c,text:n,parsed:u})}).catch(n=>{T.fail(n instanceof Error?n:Error(`Failed to parse pty output`))})}),j}resolveClientId(n){if(this.clients.has(n))return n;let c=this.latestClientBySession.get(n);if(c&&this.clients.has(c))return c;let u=this.sessionClients.get(n);if(u){for(let c of u)if(this.clients.has(c))return this.latestClientBySession.set(n,c),c}throw new PtyError(`PTY_CLIENT_NOT_FOUND`,`PTY client not found: ${n}`)}requireClient(n){let c=this.resolveClientId(n),u=this.clients.get(c);if(!u)throw new PtyError(`PTY_CLIENT_NOT_FOUND`,`PTY client not found: ${n}`);if(u.isClosed)throw new PtyError(`PTY_CLOSED`,`PTY client is closed: ${n}`);return u}closeState(n){let c=this.clients.get(n);if(!c)return;let{sessionName:u}=c;closeClientState(c),this.clients.delete(n);let p=this.sessionClients.get(u);if(p){if(p.delete(n),p.size===0)this.sessionClients.delete(u),this.latestClientBySession.delete(u);else if(this.latestClientBySession.get(u)===n){let n=p.values().next().value;n&&this.latestClientBySession.set(u,n)}}}async shutdownManagedClients(){return this.shutdownPromise||=(async()=>{for(let[n,c]of this.clients)c.pty.kill(),this.closeState(n);this.unregisterShutdownHandlers(),this.disposed=!0})(),this.shutdownPromise}assertNotDisposed(){if(this.disposed)throw new PtyError(`PTY_CLOSED`,`TmuxPtyClient has been disposed`)}};let cliTmuxClient=null;const getCliTmuxClient=()=>(cliTmuxClient??=new TmuxPtyClient({tmuxPath:resolveTmuxBinaryPath()}),cliTmuxClient),toTmuxOutputChunk=n=>({at:n.at,rawHex:Buffer$1.from(n.raw).toString(`hex`),text:n.text,parsed:{csi:[...n.parsed.csi],osc:[...n.parsed.osc],dcs:[...n.parsed.dcs],esc:[...n.parsed.esc]}}),cliTmuxSocketRuntime={open:async n=>{let c=await getCliTmuxClient().connectSession(n.sessionName,{createIfNotexists:n.createIfNotexists,...n.cwd?{cwd:n.cwd}:{},cols:n.cols??120,rows:n.rows??32});return{sessionName:c.sessionName,runtimeId:c.clientId}},sendInput:async(n,c,u)=>{await getCliTmuxClient().sendInput(u??n,c)},resize:async(n,c,u)=>{await getCliTmuxClient().resize(u??n,c)},async*output(n,c){let u=getCliTmuxClient();for await(let p of u.openOutputStream(c??n))yield toTmuxOutputChunk(p)},close:async(n,c,u)=>{await getCliTmuxClient().close(u??n)}},toRelayFailure=n=>({ok:!1,code:`RELAY_ACCEPT_FAILED`,message:n,details:{}}),createRelayAcceptOpenSignal=()=>{let n=!1,c=()=>{},u=()=>{};return{ready:new Promise((p,h)=>{c=()=>{n||(n=!0,p())},u=c=>{n||(n=!0,h(c))}}),resolveReady:c,rejectReady:u}};async function listCliTmuxSessions(){let n=getCliTmuxClient(),c=[];try{c=await n.listSessions()}catch(n){if(!(n instanceof PtyError)||n.code!==`TMUX_SERVER_UNAVAILABLE`)throw n}return{items:c.map(n=>({sessionName:n.name}))}}async function createCliTmuxSession(n){let c=getCliTmuxClient(),u=await c.connectSession(n.sessionName,{createIfNotexists:!0,...n.cwd?{cwd:n.cwd}:{}});return await c.close(u.clientId),{ok:!0}}async function deleteCliTmuxSession(n){return await getCliTmuxClient().destroySession(n.sessionName),{ok:!0}}async function acceptCliTmuxRelaySession(n){if(n.channel!==`tmux:session`)return toRelayFailure(`Unsupported relay session channel: ${n.channel}`);let c=n.sessionName?.trim();if(!c)return toRelayFailure(`tmux relay sessionName is required`);try{let u=await connectNodeTcpSocket({relayUrl:n.server.url,sessionId:n.sessionId,token:n.acceptor.token,role:`acceptor`}),p=createRelayAcceptOpenSignal(),h={...cliTmuxSocketRuntime,open:async n=>{try{let c=await cliTmuxSocketRuntime.open(n);return p.resolveReady(),c}catch(n){throw p.rejectReady(n instanceof Error?n:Error(`Failed to open tmux session`)),n}}},x=runTmuxSessionOverSocket(u,{deviceCode:n.deviceCode,sessionName:c,createIfNotexists:n.createIfNotexists??!1,...n.cwd?{cwd:n.cwd}:{}},h);return await p.ready,x.catch(()=>{}),{ok:!0}}catch(n){return toRelayFailure(n instanceof Error?n.message:String(n))}}async function disposeCliTmuxRuntime(){if(!cliTmuxClient)return;let n=cliTmuxClient;cliTmuxClient=null,await n.dispose()}const FINAL_CLEANUP_DELAY_MS=6e4,KILL_GRACE_PERIOD_MS=5e3;var NodeCommandRunner=class{commands=new Map;async requestRun(n){if(this.commands.has(n.sessionId))throw Error(`Command session is already running: ${n.sessionId}`);let[c,...u]=n.cmd;if(!c)throw Error(`Command is required`);let p={cwd:n.cwd&&n.cwd.length>0?n.cwd:void 0,env:n.env?{...process.env,...n.env}:process.env,shell:n.shell??!1,stdio:[`ignore`,`pipe`,`pipe`]},h=typeof p.cwd==`string`?p.cwd:void 0,x;try{x=this.createActiveCommand({sessionId:n.sessionId,command:c,args:u,spawnOptions:p,cwd:h,timeoutMs:n.timeoutMs})}catch(c){return this.buildStartFailure(n.sessionId,h,c)}this.commands.set(n.sessionId,x);let w=await this.waitForStart(n.sessionId,x);return w.ok?{ok:!0,sessionId:n.sessionId,localProcessId:x.localProcessId,...x.cwd?{cwd:x.cwd}:{}}:w}async stopRun(n){let c=this.commands.get(n);c&&(this.clearTimer(c),this.clearCleanupTimer(c),this.terminate(c),this.commands.delete(n))}onOutput(n,c){let u=this.commands.get(n);if(!u)throw Error(`Unknown command session: ${n}`);this.clearCleanupTimer(u),u.listeners.add(c);for(let n of u.pendingEvents)c(n);return u.pendingEvents=[],()=>{u.listeners.delete(c),u.ended&&u.listeners.size===0&&this.scheduleCleanup(n,u)}}emit(n,c){let u=this.commands.get(n);if(u){if(u.listeners.size===0){u.pendingEvents.push(c);return}for(let n of u.listeners)n(c)}}createActiveCommand(n){let c=spawn$1(n.command,n.args,n.spawnOptions),u=String(c.pid??``);c.stdout?.setEncoding(`utf8`),c.stderr?.setEncoding(`utf8`);let p={child:c,cwd:n.cwd,localProcessId:u,listeners:new Set,pendingEvents:[],cleanupTimer:null,ended:!1,timeoutHandle:null};return n.timeoutMs&&(p.timeoutHandle=setTimeout(()=>{this.terminate(p)},n.timeoutMs)),c.stdout?.on(`data`,c=>{this.emit(n.sessionId,{sessionId:n.sessionId,stdout:c,stderr:``,eof:!1,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),c.stderr?.on(`data`,c=>{this.emit(n.sessionId,{sessionId:n.sessionId,stdout:``,stderr:c,eof:!1,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),c.once(`exit`,(c,h)=>{this.finish(n.sessionId,{sessionId:n.sessionId,stdout:``,stderr:``,eof:!0,exitCode:c,signal:h,localProcessId:u,...p.cwd?{cwd:p.cwd}:{}})}),p}finishFailure(n,c,u){this.finish(n,{sessionId:n,stdout:``,stderr:this.formatError(u),eof:!0,exitCode:null,signal:null,localProcessId:c.localProcessId,...c.cwd?{cwd:c.cwd}:{}})}async waitForStart(n,c){return await new Promise(u=>{let p=!1,h=n=>{p||(p=!0,u(n))};c.child.once(`spawn`,()=>{if(!c.localProcessId){this.clearTimer(c),this.clearCleanupTimer(c),this.commands.delete(n),this.terminate(c),h(this.buildStartFailure(n,c.cwd,Error(`Failed to start command process`)));return}h({ok:!0,sessionId:n,localProcessId:c.localProcessId,...c.cwd?{cwd:c.cwd}:{}})}),c.child.once(`error`,u=>{if(!p){this.clearTimer(c),this.clearCleanupTimer(c),this.commands.delete(n),h(this.buildStartFailure(n,c.cwd,u));return}this.finishFailure(n,c,u)})})}buildStartFailure(n,c,u){return{ok:!1,sessionId:n,error:this.formatError(u),...c?{cwd:c}:{}}}finish(n,c){let u=this.commands.get(n);!u||u.ended||(u.ended=!0,this.clearTimer(u),this.emit(n,c),u.listeners.size===0&&this.scheduleCleanup(n,u))}scheduleCleanup(n,c){this.clearCleanupTimer(c),c.cleanupTimer=setTimeout(()=>{this.commands.delete(n)},FINAL_CLEANUP_DELAY_MS)}clearCleanupTimer(n){n.cleanupTimer&&=(clearTimeout(n.cleanupTimer),null)}clearTimer(n){n.timeoutHandle&&=(clearTimeout(n.timeoutHandle),null)}terminate(n){n.child.killed||(n.child.kill(`SIGTERM`),setTimeout(()=>{n.child.killed||n.child.kill(`SIGKILL`)},KILL_GRACE_PERIOD_MS))}formatError(n){return n instanceof Error?n.message:String(n)}};function registerCliDeviceCommandRpcHandlers(n){let c=new NodeCommandRunner,u=n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_COMMAND_REQUEST_RUN,async u=>await startReportedDeviceCommandSession({commandExecutor:c,request:u,reportOutput:async c=>await n.sendRpc(WS_RPC_DEVICES_CHANNELS.DEVICE_COMMAND_REPORT_OUTPUT,c),onReportError:n=>{console.error(`Failed to report command output`,n)}}));return()=>{n.removeRpcHandler(u)}}function registerCliDeviceTmuxRpcHandlers(n){let c=[n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSIONS_LIST,async()=>await listCliTmuxSessions()),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSION_CREATE,async n=>{let c=n;return await createCliTmuxSession({sessionName:c.sessionName,...c.cwd?{cwd:c.cwd}:{}})}),n.registerRpcHandler(WS_RPC_DEVICES_CHANNELS.DEVICE_TMUX_SESSION_DELETE,async n=>await deleteCliTmuxSession({sessionName:n.sessionName}))];return()=>{for(let u of c)n.removeRpcHandler(u)}}const HTTP_URL_PATTERN=/^https?:\/\//i;function registerCliLocalFileRpcHandlers(n){let c=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.STAT_LOCAL_FILE,async n=>await statLocalFile(n)),u=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.REQUEST_LOCAL_FILE,async c=>await requestLocalFile(c,n)),p=n.registerRpcHandler(WS_RPC_FILE_CHANNELS.PUT_FILE_TO_LOCAL,async n=>await putFileToLocal(n));return()=>{n.removeRpcHandler(c),n.removeRpcHandler(u),n.removeRpcHandler(p)}}async function statLocalFile(n){try{let c=await fs$2.stat(n.local.path);return c.isFile()?{ok:!0,sha256:await hashFile(n.local.path),sizeBytes:c.size,filename:basename(n.local.path)}:{ok:!1,reason:`Path is not a file`}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Stat failed`}}}async function requestLocalFile(n,c){let{acknowledgeUpload:u=!0,constraints:p,fileId:h,local:x,uploadUrl:w}=n;try{let n=await statLocalFile({local:x});return!n.ok||!n.filename||n.sizeBytes===void 0||!n.sha256||p?.maxSizeBytes!==void 0&&n.sizeBytes>p.maxSizeBytes||!(await uploadLocalFile({path:x.path,uploadUrl:w})).ok?{ok:!1}:(u&&await c.sendRpc(WS_RPC_FILE_CHANNELS.UPLOAD_FILE,{fileId:h,filename:n.filename,sizeBytes:n.sizeBytes,sha256:n.sha256,status:`completed`}),{ok:!0})}catch{return{ok:!1}}}async function uploadLocalFile(n){try{if(!(await fs$2.stat(n.path)).isFile())return{ok:!1,reason:`Path is not a file`};let c=await fs$2.readFile(n.path),u=await fetch(n.uploadUrl,{method:`PUT`,body:c});return u.ok?{ok:!0}:{ok:!1,reason:`Upload failed (${u.status})`}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Upload failed`}}}async function putFileToLocal(n){let{downloadUrl:c,headers:u,local:p}=n;try{if(!HTTP_URL_PATTERN.test(c))return{ok:!1,reason:`Invalid download URL`};await fs$2.mkdir(dirname(p.path),{recursive:!0});let n=await fetch(c,{method:`GET`,headers:u??{}});if(!n.ok||!n.body)return{ok:!1,reason:`Download failed (${n.status})`};await pipeline(Readable.fromWeb(n.body),createWriteStream(p.path));let h=await fs$2.stat(p.path);return{ok:!0,metadata:{path:p.path,isDirectory:!1,size:h.size,createdAt:h.birthtime?.toISOString?.()??void 0,updatedAt:h.mtime?.toISOString?.()??void 0}}}catch(n){return{ok:!1,reason:n instanceof Error?n.message:`Download failed`}}}async function hashFile(n){let c=createHash$1(`sha256`);return await new Promise((u,p)=>{let h=createReadStream(n);h.on(`data`,n=>c.update(n)),h.on(`error`,p),h.on(`end`,()=>u())}),c.digest(`hex`)}let codexIntegration=null,claudeIntegration=null;const getCodexIntegration=()=>(codexIntegration??=new CodexIntegration(join(homedir$1(),`.codex`),process$1.cwd()),codexIntegration),getClaudeIntegration=()=>(claudeIntegration??=new ClaudeIntegration(process$1.cwd()),claudeIntegration),buildCliDeviceMetadata=n=>({command:{cwd:n,sourceType:`manual`},codex:{cwd:n,sourceType:`manual`}}),createCliRunRuntime=async n=>{if(!await loadAuthSession(n.endpoints))throw Error(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);let c=!1,u=null,p=new Promise(n=>{u=n}),h=async()=>{},x=createCliNetworkRuntime({deviceCode:n.deviceCode,endpoints:n.endpoints,getDeviceMetadata:async()=>buildCliDeviceMetadata(n.cwd),onExternalUrl:async()=>{throw Error(`CLI runtime does not support interactive external login`)},callbacks:{onExpired:async()=>{n.logSink.writeLine(`authentication expired; CLI runtime stopped`),await h()}}}),w=getCodexIntegration(),T={claude:getClaudeIntegration(),codex:w},O=createAgentIntegrationHandlers({integrations:T}),A=registerCliDeviceCommandRpcHandlers(x.provider),j=registerAgentDeviceRpcHandlers(x.provider,{integrations:T}),N=registerCliDeviceTmuxRpcHandlers(x.provider),I=registerCliLocalFileRpcHandlers(x.provider),L=x.provider.registerRpcHandler(WS_RPC_RELAY_CHANNELS.RELAY_SESSION_CONNECT_REQUEST,async n=>{let c=n;if(c.channel===`tmux:session`)return await acceptCliTmuxRelaySession(c);if(c.channel!==`agent:run`||!isCliAgentType(c.agentType)||!c.runId?.trim())return{ok:!1,code:`RELAY_ACCEPT_FAILED`,message:`Unsupported relay session channel: ${c.channel}`,details:{}};try{return await O.acceptRunRelaySession({agentType:c.agentType,relayUrl:c.server.url,sessionId:c.sessionId,runId:c.runId.trim(),token:c.acceptor.token}),{ok:!0}}catch(n){return{ok:!1,code:`RELAY_ACCEPT_FAILED`,message:n instanceof Error?n.message:String(n),details:{}}}});return h=async()=>{c||(c=!0,x.provider.removeRpcHandler(L),A(),j(),N(),I(),x.stop(),await disposeCliTmuxRuntime().catch(()=>{}),setCliPipelineScope(null),u?.())},{start:async()=>{n.logSink.writeLine(`Starting CLI runtime: deviceCode=${n.deviceCode} cwd=${n.cwd}`),await x.start(),await waitForRuntimeAuthentication(x),n.logSink.writeLine(`published local command and agent environments: deviceCode=${n.deviceCode} cwd=${n.cwd}`)},stop:h,waitUntilStopped:async()=>await p}};function isCliAgentType(n){return n===`claude`||n===`codex`}const DEFAULT_MAX_LOG_LINES=300,DEFAULT_VISIBLE_LOG_ROWS=12,LOG_LINE_BREAK_PATTERN=/\r?\n/g,readErrorMessage$1=n=>n instanceof Error?n.message:String(n),getAuthProviderForLoginMethod=n=>{switch(n){case`github`:return AuthProvider.GITHUB;case`google`:return AuthProvider.GOOGLE;case`slack`:return AuthProvider.SLACK;case`googleWorkspace`:return AuthProvider.GOOGLE_WORKSPACE}},normalizeLogLine=n=>n.replace(LOG_LINE_BREAK_PATTERN,` `),clamp=(n,c,u)=>Math.min(Math.max(n,c),u),getVisibleLogRows=n=>Math.max(1,n),getMaxLogViewportTop=n=>Math.max(0,n.linesLength-getVisibleLogRows(n.visibleLogRowCount)),clampLogViewportTop=n=>clamp(n.nextTop,0,getMaxLogViewportTop({linesLength:n.linesLength,visibleLogRowCount:n.visibleLogRowCount})),getVisibleLogViewport=n=>{let c=n.logLines.length,u=n.logCount;if(c===0)return{isFollowingTail:n.isFollowingLogTail,lines:[],showingFrom:0,showingTo:0,totalLogCount:u,totalRetained:c};let p=getVisibleLogRows(n.visibleLogRowCount),h=n.isFollowingLogTail?Math.max(0,c-p):clampLogViewportTop({linesLength:c,nextTop:n.logViewportTop,visibleLogRowCount:p}),x=n.logLines.slice(h,h+p);return{isFollowingTail:n.isFollowingLogTail,lines:x,showingFrom:h,showingTo:h+x.length,totalLogCount:u,totalRetained:c}},readStoredSessionEmail=n=>n?.email??null,createCliCoreStore=n=>{let c=n.maxLogLines??DEFAULT_MAX_LOG_LINES,u=createCliLogFileWriter(),p=null,h=new Promise(n=>{p=n});return createStore((x,w)=>{let T=n=>{w().exitCode===null&&(x({exitCode:n}),p?.(n),p=null)},O=n=>{w().isDisposed||x({errorMessage:null,fatalMessage:n,screen:`fatal`,statusMessage:null})},A=()=>{let n=w().loginRuntime;n&&(n.stop(),w().loginRuntime===n&&x({loginRuntime:null}))},j=async()=>{let n=w().cliRunRuntime;n&&(await n.stop().catch(()=>{}),w().cliRunRuntime===n&&x({cliRunRuntime:null}))},N=async()=>{let c=await loadBackendConfig(),u=resolveCliBackendConfig({baseUrl:n.baseUrl,ssl:n.ssl,storedBaseUrl:c?.baseUrl,storedSsl:c?.ssl});await saveBackendConfig(u);let p=deriveCliEndpoints(u);return w().isDisposed||x({resolvedEndpoints:p}),u},I=async()=>deriveCliEndpoints(await N()),L=async()=>{let n=deriveCliEndpoints(await N()),c=await loadAuthSession(n);return w().isDisposed||x({authenticatedEmail:readStoredSessionEmail(c),resolvedEndpoints:n}),{endpoints:n,session:c}},z=async()=>{let n=w().deviceCode;if(n)return n;let c=await loadOrCreateDeviceCode();return w().isDisposed||x({deviceCode:c}),c},B=async c=>{let u=n.token;if(!u)return!1;x({bootMessage:`Signing in with bootstrap token...`,screen:`boot`});let p=await I();return await loginWithBootstrapToken({deviceCode:c,endpoints:p,token:u}),w().isDisposed||x({authenticatedEmail:readStoredSessionEmail(await loadAuthSession(p))}),!0},V=async n=>{let c=w().loginRuntime;if(c)return c;x({bootMessage:`Connecting login runtime...`,screen:`boot`});let u=createCliNetworkRuntime({deviceCode:n,endpoints:await I(),onExternalUrl:async n=>{if(w().isDisposed)return;let c=w().currentProvider;x({errorMessage:null,externalUrl:n,providerLabel:c?getLoginMethodLabel(c):`External provider`,screen:`external_url`,statusMessage:null})}});if(await u.start(),w().isDisposed)throw u.stop(),Error(`CLI store disposed before login runtime was ready`);return x({currentProvider:null,errorMessage:null,loginRuntime:u,screen:`login_method`,selectedIndex:0,statusMessage:null}),u},H=async(n,c,u)=>{A(),await j();let p=u??await L();if(!p.session)throw Error(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);x({authenticatedEmail:readStoredSessionEmail(p.session),bootMessage:`Starting CLI runtime...`,cliRunRuntime:null,currentProvider:null,cwd:c,deviceCode:n,errorMessage:null,externalUrl:null,isFollowingLogTail:!0,logCount:0,logLines:[],logViewportTop:0,providerLabel:null,resolvedEndpoints:p.endpoints,screen:`boot`,statusMessage:null});let h=null;try{if(h=await createCliRunRuntime({cwd:c,deviceCode:n,endpoints:p.endpoints,logSink:{writeLine:n=>{w().appendLogLine(n)}}}),w().isDisposed){await h.stop().catch(()=>{});return}if(x({cliRunRuntime:h}),await h.start(),w().isDisposed){await h.stop().catch(()=>{});return}x({fatalMessage:null,screen:`running`}),h.waitUntilStopped().then(()=>{let n=w();n.isDisposed||n.isShuttingDown||n.setExitCode(0)})}catch(n){h&&await h.stop().catch(()=>{}),O(readErrorMessage$1(n))}},U=async n=>{let c=await L();if(!c.session)throw Error(`Login reported success, but no persisted session was found`);if(!w().isDisposed){if(n.kind===`run`){let u=w().deviceCode;if(!u)throw Error(`Missing device code`);await H(u,n.cwd,c);return}A(),x({authenticatedEmail:readStoredSessionEmail(c.session),currentProvider:null,errorMessage:null,externalUrl:null,providerLabel:null,screen:`login_method`,statusMessage:null})}},W=async(n,c={kind:`stay`})=>{let u=w().loginRuntime;if(!u){O(`Login runtime is not available`);return}x({currentProvider:n,errorMessage:null,screen:`login_method`,selectedIndex:LOGIN_METHODS.indexOf(n),statusMessage:`Preparing ${getLoginMethodLabel(n)} login...`});try{if(!await u.startLogin(getAuthProviderForLoginMethod(n),{preferredLanguage:resolveCliPreferredLanguage()}))throw Error(getRuntimeAuthError(u)??`${getLoginMethodLabel(n)} login failed`);await U(c)}catch(c){if(w().isDisposed)return;x({currentProvider:null,errorMessage:readErrorMessage$1(c),screen:`login_method`,selectedIndex:LOGIN_METHODS.indexOf(n),statusMessage:null})}};return{authenticatedEmail:null,bootMessage:`Booting ${CLI_BRAND.command}...`,cliRunRuntime:null,currentProvider:null,cwd:n.defaultCwd,deviceCode:null,errorMessage:null,exitCode:null,externalUrl:null,fatalMessage:null,isFollowingLogTail:!0,isDisposed:!1,isShuttingDown:!1,logCount:0,logLines:[],logViewportTop:0,loginRuntime:null,providerLabel:null,resolvedEndpoints:null,screen:`boot`,selectedIndex:0,statusMessage:null,visibleLogRowCount:DEFAULT_VISIBLE_LOG_ROWS,appendLogLine:n=>{let p=normalizeLogLine(n);x(n=>({...(()=>{let h=[...n.logLines,p],x=Math.max(0,h.length-c),w=x>0?h.slice(0,x):[],T=x>0?h.slice(x):h;w.length>0&&u.appendLines(w);let O=n.isFollowingLogTail?Math.max(0,T.length-getVisibleLogRows(n.visibleLogRowCount)):clampLogViewportTop({linesLength:T.length,nextTop:n.logViewportTop-x,visibleLogRowCount:n.visibleLogRowCount});return{logCount:n.logCount+1,logLines:T,logViewportTop:O}})()}))},bootstrapHeadlessLogin:async()=>{try{x({bootMessage:`Preparing device identity...`,fatalMessage:null,screen:`boot`});let n=await z();if(w().isDisposed)return;let c=await B(n);if(w().isDisposed||c)return;await V(n)}catch(n){O(readErrorMessage$1(n))}},bootstrapHeadlessRun:async()=>{try{x({bootMessage:`Preparing device identity...`,cwd:n.defaultCwd,fatalMessage:null,screen:`boot`});let c=await z();if(w().isDisposed||(await B(c),w().isDisposed))return;let u=await L();if(!u.session){O(`No valid auth session found. Run \`${CLI_BRAND.command} login --non-interactive\` first.`);return}await H(c,n.defaultCwd,u)}catch(n){O(readErrorMessage$1(n))}},bootstrapInteractive:async()=>{try{x({bootMessage:`Preparing device identity...`,fatalMessage:null,screen:`boot`});let n=await z();if(w().isDisposed||(await B(n),w().isDisposed))return;let c=await L();if(w().isDisposed)return;if(c.session){await H(n,w().cwd,c);return}await V(n)}catch(n){O(readErrorMessage$1(n))}},dispose:async()=>{w().isDisposed||(x({isDisposed:!0}),A(),await j(),await u.flush().catch(()=>{}))},jumpLogsToEnd:()=>{x(n=>({isFollowingLogTail:!0,logViewportTop:getMaxLogViewportTop({linesLength:n.logLines.length,visibleLogRowCount:n.visibleLogRowCount})}))},jumpLogsToStart:()=>{x({isFollowingLogTail:!1,logViewportTop:0})},moveLoginSelection:n=>{w().screen===`login_method`&&x(c=>({errorMessage:null,selectedIndex:moveLoginMethodSelection(c.selectedIndex,n)}))},pageLogsDown:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop+getVisibleLogRows(n.visibleLogRowCount),visibleLogRowCount:n.visibleLogRowCount})}))},pageLogsUp:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop-getVisibleLogRows(n.visibleLogRowCount),visibleLogRowCount:n.visibleLogRowCount})}))},scrollLogsDown:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop+1,visibleLogRowCount:n.visibleLogRowCount})}))},scrollLogsUp:()=>{x(n=>({isFollowingLogTail:!1,logViewportTop:clampLogViewportTop({linesLength:n.logLines.length,nextTop:n.logViewportTop-1,visibleLogRowCount:n.visibleLogRowCount})}))},setExitCode:n=>{w().isDisposed||T(n)},setVisibleLogRowCount:n=>{x(c=>{let u=getVisibleLogRows(n);return{logViewportTop:c.isFollowingLogTail?Math.max(0,c.logLines.length-u):clampLogViewportTop({linesLength:c.logLines.length,nextTop:c.logViewportTop,visibleLogRowCount:u}),visibleLogRowCount:u}})},shutdown:async n=>{w().isDisposed||w().isShuttingDown||(x({isShuttingDown:!0}),A(),await j(),await u.flush().catch(()=>{}),!w().isDisposed&&T(n))},startProviderLogin:W,submitSelectedLoginMethod:async()=>{let{screen:n,selectedIndex:c}=w();n===`login_method`&&await W(LOGIN_METHODS[c]??DEFAULT_LOGIN_METHOD,{cwd:w().cwd,kind:`run`})},waitForExit:async()=>await h}})},createStdoutSink=()=>({writeLine:n=>{stdout.write(`${n}\n`)}}),requireMethod=n=>{let c=n?.trim();if(!c||!isLoginMethod(c))throw Error(`login requires --method ${LOGIN_METHOD_OPTIONS_TEXT} when --token is not provided`);return c},throwIfFatal$1=n=>{let c=n.getState().fatalMessage;if(c)throw Error(c)},runNonInteractiveLoginCommand=async n=>{let c=createStdoutSink(),u=createCliCoreStore({baseUrl:n.baseUrl,defaultCwd:process.cwd(),ssl:n.ssl,token:n.token}),p=u.subscribe((n,u)=>{n.externalUrl&&n.externalUrl!==u.externalUrl&&(c.writeLine(`Open this URL to continue login:`),c.writeLine(n.externalUrl))});try{if(await u.getState().bootstrapHeadlessLogin(),throwIfFatal$1(u),n.token){c.writeLine(`CLI session verified and saved`);return}let p=requireMethod(n.method);await u.getState().startProviderLogin(p,{kind:`stay`}),throwIfFatal$1(u),c.writeLine(`CLI session verified and saved`)}finally{p(),await u.getState().dispose()}},packageJson$1=createRequire(import.meta.url)(`../package.json`),CLI_VERSION=typeof packageJson$1.version==`string`&&packageJson$1.version.length>0?packageJson$1.version:`0.0.0`,CLI_UPDATES_CACHE_KEY=`updates/cli.json`,CLI_UPDATES_INTERVAL_MS=720*60*1e3,readErrorMessage=n=>n instanceof Error?n.message:String(n),parseTruthyEnvFlag$1=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`||c===`yes`},shouldSkipCliUpdateCheck=n=>n===!0||parseTruthyEnvFlag$1(process.env.SYNCLESS_SKIP_UPDATE_CHECK),resolveCliReleaseChannel=n=>n.includes(`-preview`)?`preview`:n.includes(`-`)?`beta`:`stable`,resolveCliReleasePlatform=()=>process.platform===`darwin`&&process.arch===`arm64`?`darwin-arm64`:process.platform===`darwin`&&process.arch===`x64`?`darwin-x64`:process.platform===`linux`&&process.arch===`x64`?`linux-x64`:process.platform===`linux`&&process.arch===`arm64`?`linux-arm64`:null,getCliUpdatesBaseUrl=()=>{let n=``?.trim();if(n)return n;let c=``?.trim();return c&&c.length>0?c:null},createEmptyCliUpdateState=n=>({enabled:n,checkedAt:null,currentVersion:CLI_VERSION,dismissedVersion:null,errorMessage:null,result:null}),createCliUpdateErrorState=n=>({enabled:!0,checkedAt:n.previousState?.checkedAt??null,currentVersion:CLI_VERSION,dismissedVersion:n.previousState?.dismissedVersion??null,errorMessage:readErrorMessage(n.error),result:null}),resolveDismissedCliVersion=n=>n.previousDismissedVersion===n.latestVersion?n.previousDismissedVersion:null,readCliUpdateState=async n=>{let c=await n.fetch(CLI_UPDATES_CACHE_KEY);return!c||c.currentVersion!==CLI_VERSION?null:{enabled:!0,checkedAt:c.checkedAt,currentVersion:c.currentVersion,dismissedVersion:c.dismissedVersion??null,errorMessage:c.errorMessage??null,result:c.result}},writeCliUpdateState=async(n,c)=>{await n.persist(CLI_UPDATES_CACHE_KEY,{checkedAt:c.checkedAt,currentVersion:c.currentVersion,dismissedVersion:c.dismissedVersion??null,errorMessage:c.errorMessage??null,result:c.result})},getDismissableCliUpdateVersion=n=>n.result?.availability===`update_available`?n.result.manifest.latestVersion:null,dismissCliUpdate=async(n,c)=>{let u=getDismissableCliUpdateVersion(c);if(!u||c.dismissedVersion===u)return c;let p={...c,dismissedVersion:u};try{await writeCliUpdateState(n,p)}catch{}return p},dismissCliAvailableUpdateNotice=async(n,c={})=>await dismissCliUpdate(c.persistence??cliPersistenceStore,n),resolveCliUpdateInstruction=n=>{if(!n.result)return null;for(let c of n.result.manifest.actions){if(c.kind===`command`&&c.command)return c.command;if((c.kind===`download`||c.kind===`store`||c.kind===`docs`)&&c.url)return c.url}return n.result.manifest.releaseNotesUrl??null},formatCliUpdateMessage=n=>{if(n.errorMessage||!n.result||n.result.availability===`up_to_date`)return null;let c=n.result.manifest.latestVersion;if(n.result.availability===`update_available`&&n.dismissedVersion===c)return null;let u=resolveCliUpdateInstruction(n),p=n.result.availability===`update_required`?`Update required`:`Update available`;return u?`${p}: ${PRODUCT_DISPLAY_NAME} ${c} is available (current ${n.currentVersion}). Use ${u}`:`${p}: ${PRODUCT_DISPLAY_NAME} ${c} is available (current ${n.currentVersion}).`},checkCliUpdatesNow=async(n={})=>{let c=n.persistence??cliPersistenceStore,u=await readCliUpdateState(c),p=resolveCliReleasePlatform(),h=getCliUpdatesBaseUrl();if(!p||!h)return createEmptyCliUpdateState(!1);try{let x=await checkForUpdates({baseUrl:h,product:`cli`,channel:resolveCliReleaseChannel(CLI_VERSION),platform:p,currentVersion:CLI_VERSION,fetch:n.fetch??createCliObservedFetch(`cli.updates`)}),w={enabled:!0,checkedAt:new Date().toISOString(),currentVersion:CLI_VERSION,dismissedVersion:resolveDismissedCliVersion({latestVersion:x.manifest.latestVersion,previousDismissedVersion:u?.dismissedVersion}),errorMessage:null,result:x};return await writeCliUpdateState(c,w),w}catch(n){return createCliUpdateErrorState({error:n,previousState:u})}},enforceCliUpdatePolicy=async(n={})=>{if(shouldSkipCliUpdateCheck(n.skipUpdateCheck))return createEmptyCliUpdateState(!1);let c=await checkCliUpdatesNow(n),u=formatCliUpdateMessage(c);if(!u)return c;if(c.result?.availability===`update_required`)throw Error(u);return(n.writeMessage??(n=>{stderr.write(`${n}\n`)}))(u),c},startCliUpdatePolling=n=>{if(shouldSkipCliUpdateCheck(n.skipUpdateCheck))return()=>{};let c=null,u=setInterval(()=>{checkCliUpdatesNow(n).then(u=>{let p=formatCliUpdateMessage(u);if(!p||!u.result)return;let h=`${u.result.availability}:${u.result.manifest.latestVersion}`;c!==h&&(c=h,n.onUpdate(u,p))}).catch(()=>{})},CLI_UPDATES_INTERVAL_MS);return()=>{clearInterval(u)}},HOST_PLATFORM={LINUX:`linux`,MACOS:`darwin`,WINDOWS:`win32`},readProcessPlatform=()=>{let n=globalThis;return typeof n.process?.platform==`string`?n.process.platform:HOST_PLATFORM.LINUX},getCurrentHostPlatform=n=>typeof n==`string`&&n.length>0?n:readProcessPlatform(),isMacHostPlatform=n=>n===HOST_PLATFORM.MACOS,isWindowsHostPlatform=n=>n===HOST_PLATFORM.WINDOWS,isLinuxHostPlatform=n=>n===HOST_PLATFORM.LINUX,MACOS_CAFFEINATE_PATH=`/usr/bin/caffeinate`,PREVENT_SLEEP_CAFFEINATE_PATH_ENV=`SYNCLESS_E2E_CAFFEINATE_PATH`,PREVENT_SLEEP_PLATFORM_ENV=`SYNCLESS_E2E_PREVENT_SLEEP_PLATFORM`,PREVENT_SLEEP_SYSTEMD_INHIBIT_PATH_ENV=`SYNCLESS_E2E_SYSTEMD_INHIBIT_PATH`,PREVENT_SLEEP_WINDOWS_POWERSHELL_PATH_ENV=`SYNCLESS_E2E_PREVENT_SLEEP_POWERSHELL_PATH`,LINUX_SYSTEMD_INHIBIT_COMMAND=`systemd-inhibit`,WINDOWS_POWERSHELL_COMMAND=`powershell.exe`,WINDOWS_SLEEP_BLOCKER_SCRIPT=[`Add-Type -Namespace Syncless -Name Power -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags);'`,`[Syncless.Power]::SetThreadExecutionState(0x80000001) | Out-Null`,`while ($true) { Start-Sleep -Seconds 3600 }`].join(`; `),writePreventSleepWarning=n=>{process.stderr.write(`Warning: ${n}\n`)},parseTruthyEnvFlag=n=>{if(typeof n!=`string`||!n)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`||c===`yes`},shouldPreventSleepForRun=n=>n===!0||parseTruthyEnvFlag(process.env.SYNCLESS_PREVENT_SLEEP),getPreventSleepPlatform=()=>getCurrentHostPlatform(process.env[PREVENT_SLEEP_PLATFORM_ENV]),getCaffeinatePath=()=>process.env[PREVENT_SLEEP_CAFFEINATE_PATH_ENV]||MACOS_CAFFEINATE_PATH,getSystemdInhibitCommand=()=>process.env[PREVENT_SLEEP_SYSTEMD_INHIBIT_PATH_ENV]||LINUX_SYSTEMD_INHIBIT_COMMAND,getWindowsPowerShellCommand=()=>process.env[PREVENT_SLEEP_WINDOWS_POWERSHELL_PATH_ENV]||WINDOWS_POWERSHELL_COMMAND;function stopCaffeinate(n){n.exitCode!==null||n.signalCode!==null||n.kill()}function startChildSleepBlocker(n,c,u){try{let p=spawn$1(n,[...c],{stdio:`ignore`}),h=!1,x=!1,w=(n,c)=>{x||n===0||(x=!0,writePreventSleepWarning(`${u} exited early; continuing without a sleep blocker. ${c?`signal ${c}`:`exit code ${String(n)}`}`))};return p.once(`error`,n=>{h||writePreventSleepWarning(`failed to start ${u}; continuing without a sleep blocker. ${n.message}`)}),p.once(`exit`,(n,c)=>{h||w(n,c)}),p.unref(),{stop:()=>{h||(h=!0,p.exitCode!==null&&w(p.exitCode,p.signalCode),stopCaffeinate(p))}}}catch(n){return writePreventSleepWarning(`failed to start ${u}; continuing without a sleep blocker. ${n instanceof Error?n.message:String(n)}`),{stop:()=>{}}}}const startMacPreventSleepForRun=()=>{let n=getCaffeinatePath();return existsSync(n)?startChildSleepBlocker(n,[`-i`,`-w`,String(process.pid)],`caffeinate`):(writePreventSleepWarning(`macOS caffeinate was not found; continuing without a sleep blocker.`),{stop:()=>{}})},startLinuxPreventSleepForRun=()=>startChildSleepBlocker(getSystemdInhibitCommand(),[`--what=sleep:idle`,`--who=Syncless`,`--why=Syncless CLI runtime is running`,`--mode=block`,`sleep`,`infinity`],`systemd-inhibit`),startWindowsPreventSleepForRun=()=>startChildSleepBlocker(getWindowsPowerShellCommand(),[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-Command`,WINDOWS_SLEEP_BLOCKER_SCRIPT],`Windows sleep blocker`);function startPreventSleepForRun(){let n=getPreventSleepPlatform();return isMacHostPlatform(n)?startMacPreventSleepForRun():isLinuxHostPlatform(n)?startLinuxPreventSleepForRun():isWindowsHostPlatform(n)?startWindowsPreventSleepForRun():(writePreventSleepWarning(`--prevent-sleep is not supported on ${n}; continuing without a sleep blocker.`),{stop:()=>{}})}const throwIfFatal=n=>{let c=n.getState().fatalMessage;if(c)throw Error(c)},runNonInteractiveRunCommand=async n=>{let c=createStdoutSink(),u=createCliCoreStore({baseUrl:n.baseUrl,defaultCwd:process.cwd(),ssl:n.ssl,token:n.token}),p=u.subscribe((n,u)=>{if(n.logCount<=u.logCount)return;let p=n.logLines.at(-1);p&&c.writeLine(p)}),h=async()=>{await u.getState().shutdown(0)},x=()=>{h()},w=()=>{h()},T=startCliUpdatePolling({onUpdate:(n,c)=>{process.stderr.write(`${c}\n`)}}),O=shouldPreventSleepForRun(n.preventSleep)?startPreventSleepForRun():null;process.once(`SIGINT`,x),process.once(`SIGTERM`,w);try{await u.getState().bootstrapHeadlessRun(),throwIfFatal(u),await u.getState().waitForExit()}finally{O?.stop(),T(),p(),process.off(`SIGINT`,x),process.off(`SIGTERM`,w),await u.getState().dispose()}},runServiceManagerCommand=async(n,c)=>{await new Promise((u,p)=>{let h=spawn$1(n,[...c],{env:process.env,stdio:`inherit`});h.on(`error`,p),h.on(`exit`,(h,x)=>{if(h===0){u();return}p(Error(`${n} ${c.join(` `)} failed with ${x?`signal ${x}`:`exit code ${String(h)}`}`))})})},SYNCLESS_LAUNCHD_LABEL=`com.langgenius.syncless.cli`,getLaunchdDomain=()=>{let n=process.env.SYNCLESS_E2E_LAUNCHD_DOMAIN;if(n)return n;let c=process.getuid?.();if(typeof c!=`number`)throw TypeError(`Cannot resolve launchd user domain because process uid is unavailable`);return`gui/${String(c)}`},escapePlistValue=n=>n.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),formatStringEntry=n=>` <string>${escapePlistValue(n)}</string>`,getLaunchdUserServicePath=()=>join(homedir$1(),`Library`,`LaunchAgents`,`${SYNCLESS_LAUNCHD_LABEL}.plist`),getLaunchdUserServiceLogPaths=()=>{let n=getLogsDirectoryPath();return{stderr:join(n,`service-launchd.err.log`),stdout:join(n,`service-launchd.out.log`)}},buildLaunchdUserServicePlist=n=>{let c=getLaunchdUserServiceLogPaths(),u=[n.nodePath,n.cliPath,`run`,`--non-interactive`,`--prevent-sleep`,`--base-url`,n.apiBaseUrl,...n.noSsl?[`--no-ssl`]:[]];return[`<?xml version="1.0" encoding="UTF-8"?>`,`<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">`,`<plist version="1.0">`,`<dict>`,` <key>Label</key>`,` <string>${escapePlistValue(SYNCLESS_LAUNCHD_LABEL)}</string>`,` <key>ProgramArguments</key>`,` <array>`,...u.map(formatStringEntry),` </array>`,` <key>WorkingDirectory</key>`,` <string>${escapePlistValue(n.workingDirectory)}</string>`,` <key>RunAtLoad</key>`,` <true/>`,` <key>KeepAlive</key>`,` <true/>`,` <key>EnvironmentVariables</key>`,` <dict>`,` <key>SYNCLESS_SERVICE</key>`,` <string>1</string>`,` </dict>`,` <key>StandardOutPath</key>`,` <string>${escapePlistValue(c.stdout)}</string>`,` <key>StandardErrorPath</key>`,` <string>${escapePlistValue(c.stderr)}</string>`,`</dict>`,`</plist>`,``].join(`
|
|
189
|
+
`)},installLaunchdUserService=async n=>{let c=getLaunchdUserServicePath();await mkdir(dirname(c),{recursive:!0}),await mkdir(getLogsDirectoryPath(),{recursive:!0}),await writeFile(c,n,{encoding:`utf8`,mode:384});let u=getLaunchdDomain();return await runServiceManagerCommand(`launchctl`,[`bootout`,u,c]).catch(()=>void 0),await runServiceManagerCommand(`launchctl`,[`bootstrap`,u,c]),await runServiceManagerCommand(`launchctl`,[`kickstart`,`-k`,`${u}/${SYNCLESS_LAUNCHD_LABEL}`]),c},uninstallLaunchdUserService=async()=>{let n=getLaunchdUserServicePath();return await runServiceManagerCommand(`launchctl`,[`bootout`,getLaunchdDomain(),n]).catch(()=>void 0),await rm(n,{force:!0}),n},stopLaunchdUserService=async()=>{await runServiceManagerCommand(`launchctl`,[`bootout`,getLaunchdDomain(),getLaunchdUserServicePath()])},showLaunchdUserServiceStatus=async()=>{await runServiceManagerCommand(`launchctl`,[`print`,`${getLaunchdDomain()}/${SYNCLESS_LAUNCHD_LABEL}`])},showLaunchdUserServiceLogs=async()=>{let n=getLaunchdUserServiceLogPaths();await runServiceManagerCommand(`tail`,[`-f`,n.stdout,n.stderr])},DIST_DIRECTORY_NAME=`dist`,RUNTIME_DIRECTORY_NAME=`runtime`,ENV_FILES=[`.env`,`.env.local`],resolveCurrentDistDirectory=n=>{let c=fileURLToPath(n),u=dirname(c);if(u.endsWith(`/${DIST_DIRECTORY_NAME}`))return u;throw Error(`Cannot install service runtime from non-dist entrypoint: ${c}`)},getCliServiceRuntimeRoot=(n=CLI_VERSION)=>join(getCliStateDir(),RUNTIME_DIRECTORY_NAME,n),installCurrentCliRuntime=async n=>{let c=resolveCurrentDistDirectory(n.entrypointUrl),u=dirname(c),p=getCliServiceRuntimeRoot(n.version??CLI_VERSION),h=join(p,DIST_DIRECTORY_NAME);await rm(p,{force:!0,recursive:!0}),await mkdir(p,{recursive:!0}),await cp(c,h,{recursive:!0});for(let n of ENV_FILES)await cp(join(u,n),join(p,n),{force:!0}).catch(n=>{if(!(n&&typeof n==`object`&&`code`in n&&n.code===`ENOENT`))throw n});return{cliPath:join(h,`cli.js`),runtimeRoot:p}},SYNCLESS_SYSTEMD_SERVICE_NAME=`syncless.service`,getXdgConfigHome=()=>process.env.XDG_CONFIG_HOME||join(homedir$1(),`.config`),getSystemdUserServicePath=()=>join(getXdgConfigHome(),`systemd`,`user`,SYNCLESS_SYSTEMD_SERVICE_NAME),buildSystemdUserServiceUnit=n=>{let c=[n.nodePath,n.cliPath,`run`,`--non-interactive`,`--prevent-sleep`,`--base-url`,n.apiBaseUrl,...n.noSsl?[`--no-ssl`]:[]];return[`[Unit]`,`Description=Syncless CLI runtime`,`After=network-online.target`,``,`[Service]`,`Type=simple`,`WorkingDirectory=${n.workingDirectory}`,`ExecStart=${c.join(` `)}`,`Restart=always`,`RestartSec=5`,`Environment=SYNCLESS_SERVICE=1`,``,`[Install]`,`WantedBy=default.target`,``].join(`
|
|
190
|
+
`)},installSystemdUserService=async n=>{let c=getSystemdUserServicePath();return await mkdir(dirname(c),{recursive:!0}),await writeFile(c,n,{encoding:`utf8`,mode:384}),await runServiceManagerCommand(`systemctl`,[`--user`,`daemon-reload`]),await runServiceManagerCommand(`systemctl`,[`--user`,`enable`,`--now`,SYNCLESS_SYSTEMD_SERVICE_NAME]),c},uninstallSystemdUserService=async()=>{let n=getSystemdUserServicePath();return await runServiceManagerCommand(`systemctl`,[`--user`,`disable`,`--now`,SYNCLESS_SYSTEMD_SERVICE_NAME]),await rm(n,{force:!0}),await runServiceManagerCommand(`systemctl`,[`--user`,`daemon-reload`]),n},stopSystemdUserService=async()=>{await runServiceManagerCommand(`systemctl`,[`--user`,`stop`,SYNCLESS_SYSTEMD_SERVICE_NAME])},showSystemdUserServiceStatus=async()=>{await runServiceManagerCommand(`systemctl`,[`--user`,`status`,`--no-pager`,SYNCLESS_SYSTEMD_SERVICE_NAME])},showSystemdUserServiceLogs=async()=>{await runServiceManagerCommand(`journalctl`,[`--user`,`-u`,SYNCLESS_SYSTEMD_SERVICE_NAME,`-f`])},enableUserLinger=async n=>{await runServiceManagerCommand(`loginctl`,[`enable-linger`,n])},SYNCLESS_WINDOWS_TASK_NAME=`Syncless CLI Runtime`,POWERSHELL_COMMAND=`powershell.exe`,quoteWindowsCommandArg=n=>{let c=`"`,u=0;for(let p of n){if(p===`\\`){u+=1;continue}if(p===`"`){c+=`\\`.repeat(u*2+1),c+=`"`,u=0;continue}c+=`\\`.repeat(u),c+=p,u=0}return`${c}${`\\`.repeat(u*2)}"`},buildWindowsScheduledTaskArguments=n=>[n.cliPath,`run`,`--non-interactive`,`--prevent-sleep`,`--base-url`,n.apiBaseUrl,...n.noSsl?[`--no-ssl`]:[]].map(quoteWindowsCommandArg).join(` `),runPowerShellScript=async(n,c)=>{await runServiceManagerCommand(POWERSHELL_COMMAND,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-Command`,n,...c])},installWindowsScheduledTask=async n=>{let c=buildWindowsScheduledTaskArguments(n);return await runPowerShellScript([`$ErrorActionPreference = 'Stop'`,`$action = New-ScheduledTaskAction -Execute $args[0] -Argument $args[1] -WorkingDirectory $args[2]`,`$trigger = New-ScheduledTaskTrigger -AtLogOn`,`Register-ScheduledTask -TaskName $args[3] -Action $action -Trigger $trigger -Description 'Syncless CLI runtime' -Force | Out-Null`,`Start-ScheduledTask -TaskName $args[3]`].join(`; `),[n.nodePath,c,n.workingDirectory,SYNCLESS_WINDOWS_TASK_NAME]),SYNCLESS_WINDOWS_TASK_NAME},uninstallWindowsScheduledTask=async()=>(await runPowerShellScript([`$ErrorActionPreference = 'Stop'`,`try { Stop-ScheduledTask -TaskName $args[0] -ErrorAction SilentlyContinue } catch {}`,`Unregister-ScheduledTask -TaskName $args[0] -Confirm:$false`].join(`; `),[SYNCLESS_WINDOWS_TASK_NAME]),SYNCLESS_WINDOWS_TASK_NAME),stopWindowsScheduledTask=async()=>{await runPowerShellScript(`$ErrorActionPreference = 'Stop'; Stop-ScheduledTask -TaskName $args[0]`,[SYNCLESS_WINDOWS_TASK_NAME])},showWindowsScheduledTaskStatus=async()=>{await runPowerShellScript([`$ErrorActionPreference = 'Stop'`,`Get-ScheduledTask -TaskName $args[0] | Format-List *`,`Get-ScheduledTaskInfo -TaskName $args[0] | Format-List *`].join(`; `),[SYNCLESS_WINDOWS_TASK_NAME])},showWindowsScheduledTaskLogs=async()=>{await runPowerShellScript(`$ErrorActionPreference = 'Stop'; Get-Content -LiteralPath $args[0] -Tail 100 -Wait`,[getDailyLogPath()])},SERVICE_ACTIONS={INSTALL:`install`,LOGS:`logs`,STATUS:`status`,STOP:`stop`,UNINSTALL:`uninstall`},SERVICE_TARGETS={LAUNCHD_USER:`launchd-user`,SYSTEMD_USER:`systemd-user`,WINDOWS_TASK:`windows-task`},SERVICE_PLATFORM_ENV=`SYNCLESS_E2E_SERVICE_PLATFORM`,isServiceAction=n=>Object.values(SERVICE_ACTIONS).includes(n),parseServiceAction=n=>{if(isServiceAction(n))return n;throw Error(`Unknown service action: ${n}. Expected install, status, logs, stop, or uninstall.`)},resolveServiceTarget=()=>{let n=getCurrentHostPlatform(process$1.env[SERVICE_PLATFORM_ENV]);if(isLinuxHostPlatform(n))return SERVICE_TARGETS.SYSTEMD_USER;if(isMacHostPlatform(n))return SERVICE_TARGETS.LAUNCHD_USER;if(isWindowsHostPlatform(n))return SERVICE_TARGETS.WINDOWS_TASK;throw Error(`Service install supports Linux (${HOST_PLATFORM.LINUX}), macOS (${HOST_PLATFORM.MACOS}), and Windows (${HOST_PLATFORM.WINDOWS}) user services. Unsupported platform: ${n}.`)},resolveAndStoreBackendConfig=async n=>{let c=await loadBackendConfig(),u=resolveCliBackendConfig({baseUrl:n.baseUrl,ssl:n.ssl,storedBaseUrl:c?.baseUrl,storedSsl:c?.ssl});return await saveBackendConfig(u),u},ensureServiceAuth=async n=>{n.token&&await runNonInteractiveLoginCommand({baseUrl:n.baseUrl,ssl:n.ssl,token:n.token});let c=await resolveAndStoreBackendConfig(n);if(!await loadAuthSession(deriveCliEndpoints(c)))throw Error(`No valid CLI session found. Run service install with --token or run login --non-interactive first.`);return c},runServiceInstall=async n=>{let c=resolveServiceTarget(),u=await ensureServiceAuth(n),p=await installCurrentCliRuntime({entrypointUrl:import.meta.url});if(c===SERVICE_TARGETS.SYSTEMD_USER){let c=await installSystemdUserService(buildSystemdUserServiceUnit({apiBaseUrl:u.baseUrl,cliPath:p.cliPath,nodePath:process$1.execPath,noSsl:!u.ssl,workingDirectory:n.workingDirectory||process$1.cwd()}));if(n.enableLinger){let n=process$1.env.USER;if(!n)throw Error(`Cannot enable linger because USER is not set`);await enableUserLinger(n)}process$1.stdout.write(`Installed Syncless service: ${c}\n`),process$1.stdout.write(`Installed Syncless runtime: ${p.runtimeRoot}\n`);return}if(c===SERVICE_TARGETS.LAUNCHD_USER){let c=await installLaunchdUserService(buildLaunchdUserServicePlist({apiBaseUrl:u.baseUrl,cliPath:p.cliPath,nodePath:process$1.execPath,noSsl:!u.ssl,workingDirectory:n.workingDirectory||process$1.cwd()}));process$1.stdout.write(`Installed Syncless service: ${c}\n`),process$1.stdout.write(`Installed Syncless runtime: ${p.runtimeRoot}\n`);return}if(c===SERVICE_TARGETS.WINDOWS_TASK){let c=await installWindowsScheduledTask({apiBaseUrl:u.baseUrl,cliPath:p.cliPath,nodePath:process$1.execPath,noSsl:!u.ssl,workingDirectory:n.workingDirectory||process$1.cwd()});process$1.stdout.write(`Installed Syncless service: ${c}\n`),process$1.stdout.write(`Installed Syncless runtime: ${p.runtimeRoot}\n`)}},runServiceCommand=async(n,c)=>{let u=parseServiceAction(n),p=resolveServiceTarget();if(u===SERVICE_ACTIONS.INSTALL){await runServiceInstall(c);return}if(p===SERVICE_TARGETS.SYSTEMD_USER){if(u===SERVICE_ACTIONS.STATUS){await showSystemdUserServiceStatus();return}if(u===SERVICE_ACTIONS.LOGS){await showSystemdUserServiceLogs();return}if(u===SERVICE_ACTIONS.STOP){await stopSystemdUserService();return}if(u===SERVICE_ACTIONS.UNINSTALL){let n=await uninstallSystemdUserService();process$1.stdout.write(`Uninstalled Syncless service: ${n}\n`)}return}if(p===SERVICE_TARGETS.LAUNCHD_USER){if(u===SERVICE_ACTIONS.STATUS){await showLaunchdUserServiceStatus();return}if(u===SERVICE_ACTIONS.LOGS){await showLaunchdUserServiceLogs();return}if(u===SERVICE_ACTIONS.STOP){await stopLaunchdUserService();return}if(u===SERVICE_ACTIONS.UNINSTALL){let n=await uninstallLaunchdUserService();process$1.stdout.write(`Uninstalled Syncless service: ${n}\n`)}return}if(p===SERVICE_TARGETS.WINDOWS_TASK){if(u===SERVICE_ACTIONS.STATUS){await showWindowsScheduledTaskStatus();return}if(u===SERVICE_ACTIONS.LOGS){await showWindowsScheduledTaskLogs();return}if(u===SERVICE_ACTIONS.STOP){await stopWindowsScheduledTask();return}if(u===SERVICE_ACTIONS.UNINSTALL){let n=await uninstallWindowsScheduledTask();process$1.stdout.write(`Uninstalled Syncless service: ${n}\n`)}}};function debounce$1(n,c,{signal:u,edges:p}={}){let h,x=null,w=p!=null&&p.includes(`leading`),T=p==null||p.includes(`trailing`),O=()=>{x!==null&&(n.apply(h,x),h=void 0,x=null)},A=()=>{T&&O(),L()},j=null,N=()=>{j!=null&&clearTimeout(j),j=setTimeout(()=>{j=null,A()},c)},I=()=>{j!==null&&(clearTimeout(j),j=null)},L=()=>{I(),h=void 0,x=null},z=()=>{O()},B=function(...n){if(u?.aborted)return;h=this,x=n;let c=j==null;N(),w&&c&&O()};return B.schedule=N,B.cancel=L,B.flush=z,u?.addEventListener(`abort`,L,{once:!0}),B}function debounce(n,c=0,u={}){typeof u!=`object`&&(u={});let{leading:p=!1,trailing:h=!0,maxWait:x}=u,w=[,,];p&&(w[0]=`leading`),h&&(w[1]=`trailing`);let T,O=null,A=debounce$1(function(...c){T=n.apply(this,c),O=null},c,{edges:w}),j=function(...c){return x!=null&&(O===null&&(O=Date.now()),Date.now()-O>=x)?(T=n.apply(this,c),O=Date.now(),A.cancel(),A.schedule(),T):(A.apply(this,c),T)};return j.cancel=A.cancel,j.flush=()=>(A.flush(),T),j}function throttle(n,c=0,u={}){let{leading:p=!0,trailing:h=!0}=u;return debounce(n,c,{leading:p,maxWait:c,trailing:h})}const isBrowser=globalThis.window?.document!==void 0,isNode=globalThis.process?.versions?.node!==void 0,isBun=globalThis.process?.versions?.bun!==void 0,isDeno=globalThis.Deno?.version?.deno!==void 0,isElectron=globalThis.process?.versions?.electron!==void 0,isJsDom=globalThis.navigator?.userAgent?.includes(`jsdom`)===!0,isWebWorker=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,isDedicatedWorker=typeof DedicatedWorkerGlobalScope<`u`&&globalThis instanceof DedicatedWorkerGlobalScope,isSharedWorker=typeof SharedWorkerGlobalScope<`u`&&globalThis instanceof SharedWorkerGlobalScope,isServiceWorker=typeof ServiceWorkerGlobalScope<`u`&&globalThis instanceof ServiceWorkerGlobalScope,platform=globalThis.navigator?.userAgentData?.platform,isMacOs=platform===`macOS`||globalThis.navigator?.platform===`MacIntel`||globalThis.navigator?.userAgent?.includes(` Mac `)===!0||globalThis.process?.platform===`darwin`,isWindows$1=platform===`Windows`||globalThis.navigator?.platform===`Win32`||globalThis.process?.platform===`win32`,isLinux=platform===`Linux`||globalThis.navigator?.platform?.startsWith(`Linux`)===!0||globalThis.navigator?.userAgent?.includes(` Linux `)===!0||globalThis.process?.platform===`linux`,isIos=platform===`iOS`||globalThis.navigator?.platform===`MacIntel`&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),isAndroid=platform===`Android`||globalThis.navigator?.platform===`Android`||globalThis.navigator?.userAgent?.includes(` Android `)===!0||globalThis.process?.platform===`android`,ESC=`\x1B[`,SEP=`;`,isTerminalApp=!isBrowser&&process$1.env.TERM_PROGRAM===`Apple_Terminal`,isWindows=!isBrowser&&process$1.platform===`win32`,isTmux=!isBrowser&&(process$1.env.TERM?.startsWith(`screen`)||process$1.env.TERM?.startsWith(`tmux`)||process$1.env.TMUX!==void 0),cwdFunction=isBrowser?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:process$1.cwd,cursorTo=(n,c)=>{if(typeof n!=`number`)throw TypeError("The `x` argument is required");return typeof c==`number`?ESC+(c+1)+SEP+(n+1)+`H`:ESC+(n+1)+`G`},cursorUp=(n=1)=>ESC+n+`A`,cursorDown=(n=1)=>ESC+n+`B`,cursorLeft=ESC+`G`,cursorSavePosition=isTerminalApp?`\x1B7`:ESC+`s`,cursorRestorePosition=isTerminalApp?`\x1B8`:ESC+`u`,cursorGetPosition=ESC+`6n`,cursorNextLine=ESC+`E`,cursorPrevLine=ESC+`F`,cursorHide=ESC+`?25l`,cursorShow=ESC+`?25h`,eraseLines=n=>{let c=``;for(let u=0;u<n;u++)c+=eraseLine+(u<n-1?cursorUp():``);return n&&(c+=`\x1B[G`),c},eraseEndLine=ESC+`K`,eraseStartLine=ESC+`1K`,eraseLine=ESC+`2K`,eraseDown=ESC+`J`,eraseUp=ESC+`1J`,eraseScreen=ESC+`2J`,scrollUp=ESC+`S`,scrollDown=ESC+`T`,clearViewport=`${eraseScreen}${ESC}H`,isOldWindows=()=>{if(isBrowser||!isWindows)return!1;let n=os.release().split(`.`),c=Number(n[0]),u=Number(n[2]??0);return c<10||c===10&&u<10586},clearTerminal=isOldWindows()?`${eraseScreen}${ESC}0f`:`${eraseScreen}${ESC}3J${ESC}H`,enterAlternativeScreen=ESC+`?1049h`,exitAlternativeScreen=ESC+`?1049l`,beginSynchronizedOutput=ESC+`?2026h`,endSynchronizedOutput=ESC+`?2026l`,check=n=>n in env&&env[n]!==`0`&&env[n]!==`false`,isInCi=check(`CI`)||check(`CONTINUOUS_INTEGRATION`),getAllProperties=n=>{let c=new Set;do for(let u of Reflect.ownKeys(n))c.add([n,u]);while((n=Reflect.getPrototypeOf(n))&&n!==Object.prototype);return c};function autoBind(n,{include:c,exclude:u}={}){let p=n=>{let p=c=>typeof c==`string`?n===c:c.test(n);return c?c.some(p):u?!u.some(p):!0};for(let[c,u]of getAllProperties(n.constructor.prototype)){if(u===`constructor`||!p(u))continue;let h=Reflect.getOwnPropertyDescriptor(c,u);h&&typeof h.value==`function`&&(n[u]=n[u].bind(n))}return n}var require_signals=__commonJSMin$1(((n,c)=>{c.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&c.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&c.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),require_signal_exit=__commonJSMin$1(((n,c)=>{var u=global.process;let p=function(n){return n&&typeof n==`object`&&typeof n.removeListener==`function`&&typeof n.emit==`function`&&typeof n.reallyExit==`function`&&typeof n.listeners==`function`&&typeof n.kill==`function`&&typeof n.pid==`number`&&typeof n.on==`function`};if(!p(u))c.exports=function(){return function(){}};else{var h=__require(`assert`),x=require_signals(),w=/^win/i.test(u.platform),T=__require(`events`);typeof T!=`function`&&(T=T.EventEmitter);var O;u.__signal_exit_emitter__?O=u.__signal_exit_emitter__:(O=u.__signal_exit_emitter__=new T,O.count=0,O.emitted={}),O.infinite||(O.setMaxListeners(1/0),O.infinite=!0),c.exports=function(n,c){if(!p(global.process))return function(){};h.equal(typeof n,`function`,`a callback must be provided for exit handler`),I===!1&&L();var u=`exit`;return c&&c.alwaysLast&&(u=`afterexit`),O.on(u,n),function(){O.removeListener(u,n),O.listeners(`exit`).length===0&&O.listeners(`afterexit`).length===0&&A()}};var A=function(){!I||!p(global.process)||(I=!1,x.forEach(function(n){try{u.removeListener(n,N[n])}catch{}}),u.emit=V,u.reallyExit=z,--O.count)};c.exports.unload=A;var j=function(n,c,u){O.emitted[n]||(O.emitted[n]=!0,O.emit(n,c,u))},N={};x.forEach(function(n){N[n]=function(){p(global.process)&&u.listeners(n).length===O.count&&(A(),j(`exit`,null,n),j(`afterexit`,null,n),w&&n===`SIGHUP`&&(n=`SIGINT`),u.kill(u.pid,n))}}),c.exports.signals=function(){return x};var I=!1,L=function(){I||!p(global.process)||(I=!0,O.count+=1,x=x.filter(function(n){try{return u.on(n,N[n]),!0}catch{return!1}}),u.emit=H,u.reallyExit=B)};c.exports.load=L;var z=u.reallyExit,B=function(n){p(global.process)&&(u.exitCode=n||0,j(`exit`,u.exitCode,null),j(`afterexit`,u.exitCode,null),z.call(u,u.exitCode))},V=u.emit,H=function(n,c){if(n===`exit`&&p(global.process)){c!==void 0&&(u.exitCode=c);var h=V.apply(this,arguments);return j(`exit`,u.exitCode,null),j(`afterexit`,u.exitCode,null),h}else return V.apply(this,arguments)}}})),import_signal_exit=__toESM(require_signal_exit(),1);const consoleMethods=[`assert`,`count`,`countReset`,`debug`,`dir`,`dirxml`,`error`,`group`,`groupCollapsed`,`groupEnd`,`info`,`log`,`table`,`time`,`timeEnd`,`timeLog`,`trace`,`warn`];let originalMethods={};const patchConsole=n=>{let c=new PassThrough,u=new PassThrough;c.write=c=>{n(`stdout`,c)},u.write=c=>{n(`stderr`,c)};let p=new console.Console(c,u);for(let n of consoleMethods)originalMethods[n]=console[n],console[n]=p[n];return()=>{for(let n of consoleMethods)console[n]=originalMethods[n];originalMethods={}}};
|
|
190
191
|
/**
|
|
191
192
|
* @license React
|
|
192
193
|
* react-reconciler-constants.production.js
|
|
@@ -496,6 +497,6 @@ To resolve the conflict:`,(0,p.getConflictResolutionRecipe)(h,n))),x=w):u.diag.w
|
|
|
496
497
|
To resolve the conflict:`,(0,p.getConflictResolutionRecipe)(h,n))),x=w):u.diag.warn(`A view or instrument with the name `,n.name,` has already been registered and is incompatible with another registered view.
|
|
497
498
|
`,`Details:
|
|
498
499
|
`,(0,p.getIncompatibilityDetails)(h,n),`To resolve the conflict:
|
|
499
|
-
`,(0,p.getConflictResolutionRecipe)(h,n))}return x}}})),require_MultiWritableMetricStorage=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiMetricStorage=void 0,n.MultiMetricStorage=class{_backingStorages;constructor(n){this._backingStorages=n}record(n,c,u,p){this._backingStorages.forEach(h=>{h.record(n,c,u,p)})}}})),require_ObservableResult=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchObservableResultImpl=n.ObservableResultImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_HashMap(),p=require_Instruments();n.ObservableResultImpl=class{_buffer=new u.AttributeHashMap;_instrumentName;_valueType;constructor(n,c){this._instrumentName=n,this._valueType=c}observe(n,u={}){if(typeof n!=`number`){c.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${n}`);return}this._valueType===c.ValueType.INT&&!Number.isInteger(n)&&(c.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),n=Math.trunc(n),!Number.isInteger(n))||this._buffer.set(u,n)}},n.BatchObservableResultImpl=class{_buffer=new Map;observe(n,h,x={}){if(!(0,p.isObservableInstrument)(n))return;let w=this._buffer.get(n);if(w??(w=new u.AttributeHashMap,this._buffer.set(n,w)),typeof h!=`number`){c.diag.warn(`non-number value provided to metric ${n._descriptor.name}: ${h}`);return}n._descriptor.valueType===c.ValueType.INT&&!Number.isInteger(h)&&(c.diag.warn(`INT value type cannot accept a floating-point value for ${n._descriptor.name}, ignoring the fractional digits.`),h=Math.trunc(h),!Number.isInteger(h))||w.set(x,h)}}})),require_ObservableRegistry=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ObservableRegistry=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Instruments(),p=require_ObservableResult(),h=require_utils$3();n.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(n,c){this._findCallback(n,c)>=0||this._callbacks.push({callback:n,instrument:c})}removeCallback(n,c){let u=this._findCallback(n,c);u<0||this._callbacks.splice(u,1)}addBatchCallback(n,p){let h=new Set(p.filter(u.isObservableInstrument));if(h.size===0){c.diag.error(`BatchObservableCallback is not associated with valid instruments`,p);return}this._findBatchCallback(n,h)>=0||this._batchCallbacks.push({callback:n,instruments:h})}removeBatchCallback(n,c){let p=new Set(c.filter(u.isObservableInstrument)),h=this._findBatchCallback(n,p);h<0||this._batchCallbacks.splice(h,1)}async observe(n,c){let u=this._observeCallbacks(n,c),p=this._observeBatchCallbacks(n,c);return(await Promise.allSettled([...u,...p])).filter(n=>n.status===`rejected`).map(n=>n.reason)}_observeCallbacks(n,c){return this._callbacks.map(async({callback:u,instrument:x})=>{let w=new p.ObservableResultImpl(x._descriptor.name,x._descriptor.valueType),T=Promise.resolve(u(w));c!=null&&(T=(0,h.callWithTimeout)(T,c)),await T,x._metricStorages.forEach(c=>{c.record(w._buffer,n)})})}_observeBatchCallbacks(n,c){return this._batchCallbacks.map(async({callback:u,instruments:x})=>{let w=new p.BatchObservableResultImpl,T=Promise.resolve(u(w));c!=null&&(T=(0,h.callWithTimeout)(T,c)),await T,x.forEach(c=>{let u=w._buffer.get(c);u!=null&&c._metricStorages.forEach(c=>{c.record(u,n)})})})}_findCallback(n,c){return this._callbacks.findIndex(u=>u.callback===n&&u.instrument===c)}_findBatchCallback(n,c){return this._batchCallbacks.findIndex(u=>u.callback===n&&(0,h.setEquals)(u.instruments,c))}}})),require_SyncMetricStorage=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SyncMetricStorage=void 0;let c=require_MetricStorage(),u=require_DeltaMetricProcessor(),p=require_TemporalMetricProcessor();n.SyncMetricStorage=class extends c.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(n,c,h,x,w){super(n),this._aggregationCardinalityLimit=w,this._deltaMetricStorage=new u.DeltaMetricProcessor(c,this._aggregationCardinalityLimit),this._temporalMetricStorage=new p.TemporalMetricProcessor(c,x),this._attributesProcessor=h}record(n,c,u,p){c=this._attributesProcessor.process(c,u),this._deltaMetricStorage.record(n,c,u,p)}collect(n,c){let u=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(n,this._instrumentDescriptor,u,c)}}})),require_AttributesProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.createDenyListAttributesProcessor=n.createAllowListAttributesProcessor=n.createMultiAttributesProcessor=n.createNoopAttributesProcessor=void 0;var c=class{process(n,c){return n}},u=class{_processors;constructor(n){this._processors=n}process(n,c){let u=n;for(let n of this._processors)u=n.process(u,c);return u}},p=class{_allowedAttributeNames;constructor(n){this._allowedAttributeNames=n}process(n,c){let u={};return Object.keys(n).forEach(c=>{this._allowedAttributeNames.includes(c)&&(u[c]=n[c])}),u}},h=class{_deniedAttributeNames;constructor(n){this._deniedAttributeNames=n}process(n,c){let u={};return Object.keys(n).forEach(c=>{this._deniedAttributeNames.includes(c)||(u[c]=n[c])}),u}};function x(){return A}n.createNoopAttributesProcessor=x;function w(n){return new u(n)}n.createMultiAttributesProcessor=w;function T(n){return new p(n)}n.createAllowListAttributesProcessor=T;function O(n){return new h(n)}n.createDenyListAttributesProcessor=O;let A=new c})),require_MeterSharedState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterSharedState=void 0;let c=require_InstrumentDescriptor(),u=require_Meter(),p=require_AsyncMetricStorage(),h=require_MetricStorageRegistry(),x=require_MultiWritableMetricStorage(),w=require_ObservableRegistry(),T=require_SyncMetricStorage(),O=require_AttributesProcessor();n.MeterSharedState=class{metricStorageRegistry=new h.MetricStorageRegistry;observableRegistry=new w.ObservableRegistry;meter;_meterProviderSharedState;_instrumentationScope;constructor(n,c){this.meter=new u.Meter(this),this._meterProviderSharedState=n,this._instrumentationScope=c}registerMetricStorage(n){let c=this._registerMetricStorage(n,T.SyncMetricStorage);return c.length===1?c[0]:new x.MultiMetricStorage(c)}registerAsyncMetricStorage(n){return this._registerMetricStorage(n,p.AsyncMetricStorage)}async collect(n,c,u){let p=await this.observableRegistry.observe(c,u?.timeoutMillis),h=this.metricStorageRegistry.getStorages(n);if(h.length===0)return null;let x=[];return h.forEach(u=>{let p=u.collect(n,c);p!=null&&x.push(p)}),x.length===0?{errors:p}:{scopeMetrics:{scope:this._instrumentationScope,metrics:x},errors:p}}_registerMetricStorage(n,u){let p=this._meterProviderSharedState.viewRegistry.findViews(n,this._instrumentationScope).map(p=>{let h=(0,c.createInstrumentDescriptorWithView)(p,n),x=this.metricStorageRegistry.findOrUpdateCompatibleStorage(h);if(x!=null)return x;let w=new u(h,p.aggregation.createAggregator(h),p.attributesProcessor,this._meterProviderSharedState.metricCollectors,p.aggregationCardinalityLimit);return this.metricStorageRegistry.register(w),w});if(p.length===0){let c=this._meterProviderSharedState.selectAggregations(n.type).map(([c,p])=>{let h=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(c,n);if(h!=null)return h;let x=p.createAggregator(n),w=c.selectCardinalityLimit(n.type),T=new u(n,x,(0,O.createNoopAttributesProcessor)(),[c],w);return this.metricStorageRegistry.registerForCollector(c,T),T});p=p.concat(c)}return p}}})),require_MeterProviderSharedState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterProviderSharedState=void 0;let c=require_utils$3(),u=require_ViewRegistry(),p=require_MeterSharedState(),h=require_AggregationOption();n.MeterProviderSharedState=class{viewRegistry=new u.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;resource;constructor(n){this.resource=n}getMeterSharedState(n){let u=(0,c.instrumentationScopeId)(n),h=this.meterSharedStates.get(u);return h??(h=new p.MeterSharedState(this,n),this.meterSharedStates.set(u,h)),h}selectAggregations(n){let c=[];for(let u of this.metricCollectors)c.push([u,(0,h.toAggregation)(u.selectAggregation(n))]);return c}}})),require_MetricCollector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MetricCollector=void 0;let c=require_src$18();n.MetricCollector=class{_sharedState;_metricReader;constructor(n,c){this._sharedState=n,this._metricReader=c}async collect(n){let u=(0,c.millisToHrTime)(Date.now()),p=[],h=[],x=Array.from(this._sharedState.meterSharedStates.values()).map(async c=>{let x=await c.collect(this,u,n);x?.scopeMetrics!=null&&p.push(x.scopeMetrics),x?.errors!=null&&h.push(...x.errors)});return await Promise.all(x),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:p},errors:h}}async forceFlush(n){await this._metricReader.forceFlush(n)}async shutdown(n){await this._metricReader.shutdown(n)}selectAggregationTemporality(n){return this._metricReader.selectAggregationTemporality(n)}selectAggregation(n){return this._metricReader.selectAggregation(n)}selectCardinalityLimit(n){return this._metricReader.selectCardinalityLimit?.(n)??2e3}}})),require_Predicate=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExactPredicate=n.PatternPredicate=void 0;let c=/[\^$\\.+?()[\]{}|]/g;n.PatternPredicate=class n{_matchAll;_regexp;constructor(c){c===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(n.escapePattern(c)))}match(n){return this._matchAll?!0:this._regexp.test(n)}static escapePattern(n){return`^${n.replace(c,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(n){return n.includes(`*`)}},n.ExactPredicate=class{_matchAll;_pattern;constructor(n){this._matchAll=n===void 0,this._pattern=n}match(n){return!!(this._matchAll||n===this._pattern)}}})),require_InstrumentSelector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentSelector=void 0;let c=require_Predicate();n.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(n){this._nameFilter=new c.PatternPredicate(n?.name??`*`),this._type=n?.type,this._unitFilter=new c.ExactPredicate(n?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),require_MeterSelector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterSelector=void 0;let c=require_Predicate();n.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(n){this._nameFilter=new c.ExactPredicate(n?.name),this._versionFilter=new c.ExactPredicate(n?.version),this._schemaUrlFilter=new c.ExactPredicate(n?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),require_View=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.View=void 0;let c=require_Predicate(),u=require_AttributesProcessor(),p=require_InstrumentSelector(),h=require_MeterSelector(),x=require_AggregationOption();function w(n){return n.instrumentName==null&&n.instrumentType==null&&n.instrumentUnit==null&&n.meterName==null&&n.meterVersion==null&&n.meterSchemaUrl==null}function T(n){if(w(n))throw Error(`Cannot create view with no selector arguments supplied`);if(n.name!=null&&(n?.instrumentName==null||c.PatternPredicate.hasWildcard(n.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}n.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(n){T(n),n.attributesProcessors==null?this.attributesProcessor=(0,u.createNoopAttributesProcessor)():this.attributesProcessor=(0,u.createMultiAttributesProcessor)(n.attributesProcessors),this.name=n.name,this.description=n.description,this.aggregation=(0,x.toAggregation)(n.aggregation??{type:x.AggregationType.DEFAULT}),this.instrumentSelector=new p.InstrumentSelector({name:n.instrumentName,type:n.instrumentType,unit:n.instrumentUnit}),this.meterSelector=new h.MeterSelector({name:n.meterName,version:n.meterVersion,schemaUrl:n.meterSchemaUrl}),this.aggregationCardinalityLimit=n.aggregationCardinalityLimit}}})),require_MeterProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterProvider=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$17(),p=require_MeterProviderSharedState(),h=require_MetricCollector(),x=require_View();n.MeterProvider=class{_sharedState;_shutdown=!1;constructor(n){if(this._sharedState=new p.MeterProviderSharedState(n?.resource??(0,u.defaultResource)()),n?.views!=null&&n.views.length>0)for(let c of n.views)this._sharedState.viewRegistry.addView(new x.View(c));if(n?.readers!=null&&n.readers.length>0)for(let c of n.readers){let n=new h.MetricCollector(this._sharedState,c);c.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(n,u=``,p={}){return this._shutdown?(c.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,c.createNoopMeter)()):this._sharedState.getMeterSharedState({name:n,version:u,schemaUrl:p.schemaUrl}).meter}async shutdown(n){if(this._shutdown){c.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(c=>c.shutdown(n)))}async forceFlush(n){if(this._shutdown){c.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(c=>c.forceFlush(n)))}}})),require_src$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TimeoutError=n.createDenyListAttributesProcessor=n.createAllowListAttributesProcessor=n.AggregationType=n.MeterProvider=n.ConsoleMetricExporter=n.InMemoryMetricExporter=n.PeriodicExportingMetricReader=n.MetricReader=n.InstrumentType=n.DataPointType=n.AggregationTemporality=void 0;var c=require_AggregationTemporality();Object.defineProperty(n,`AggregationTemporality`,{enumerable:!0,get:function(){return c.AggregationTemporality}});var u=require_MetricData();Object.defineProperty(n,`DataPointType`,{enumerable:!0,get:function(){return u.DataPointType}}),Object.defineProperty(n,`InstrumentType`,{enumerable:!0,get:function(){return u.InstrumentType}});var p=require_MetricReader();Object.defineProperty(n,`MetricReader`,{enumerable:!0,get:function(){return p.MetricReader}});var h=require_PeriodicExportingMetricReader();Object.defineProperty(n,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return h.PeriodicExportingMetricReader}});var x=require_InMemoryMetricExporter();Object.defineProperty(n,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return x.InMemoryMetricExporter}});var w=require_ConsoleMetricExporter();Object.defineProperty(n,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return w.ConsoleMetricExporter}});var T=require_MeterProvider();Object.defineProperty(n,`MeterProvider`,{enumerable:!0,get:function(){return T.MeterProvider}});var O=require_AggregationOption();Object.defineProperty(n,`AggregationType`,{enumerable:!0,get:function(){return O.AggregationType}});var A=require_AttributesProcessor();Object.defineProperty(n,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return A.createAllowListAttributesProcessor}}),Object.defineProperty(n,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return A.createDenyListAttributesProcessor}});var j=require_utils$3();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return j.TimeoutError}})})),require_enums$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums$1();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler$1();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler$1();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_AlwaysOffSampler$1(),h=require_AlwaysOnSampler$1();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler$1();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_AlwaysOffSampler$1(),h=require_AlwaysOnSampler$1(),x=require_ParentBasedSampler$1(),w=require_TraceIdRatioBasedSampler$1();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config$1(),u=require_src$18();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase$1();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor$1();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator$1();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node$3();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler$1(),u=require_semconv$3();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_Span$1(),h=require_utility$1(),x=require_platform$3(),w=require_TracerMetrics$1(),T=require_version$2();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$18();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$18(),u=require_src$17(),p=require_Tracer$1(),h=require_config$1(),x=require_MultiSpanProcessor$1(),w=require_utility$1();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$18();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$18();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider$1();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform$3();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter$1();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter$1();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor$1();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor$1();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler$1();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler$1();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler$1();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler$1();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler$1();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})})),require_suppress_tracing=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing(),p=require_constants(),h=require_utils$2();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$1(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$2();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$2();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$2(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing(),p=require_TraceState();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$2();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$2();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter()._export}})),require_default_service_name=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._clearDefaultServiceNameCache=n.defaultServiceName=void 0;let c;function u(){if(c===void 0)try{let n=globalThis.process.argv0;c=n?`unknown_service:${n}`:`unknown_service`}catch{c=`unknown_service`}return c}n.defaultServiceName=u;function p(){c=void 0}n._clearDefaultServiceNameCache=p})),require_utils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPromiseLike=void 0,n.isPromiseLike=n=>typeof n==`object`&&!!n&&typeof n.then==`function`})),require_ResourceImpl=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultResource=n.emptyResource=n.resourceFromDetectedResource=n.resourceFromAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_default_service_name(),x=require_utils$1();var w=class n{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(c,u){let p=new n({},u);return p._rawAttributes=N(c),p._asyncAttributesPending=c.filter(([n,c])=>(0,x.isPromiseLike)(c)).length>0,p}constructor(n,c){let u=n.attributes??{};this._rawAttributes=Object.entries(u).map(([n,c])=>((0,x.isPromiseLike)(c)&&(this._asyncAttributesPending=!0),[n,c])),this._rawAttributes=N(this._rawAttributes),this._schemaUrl=I(c?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let n=0;n<this._rawAttributes.length;n++){let[c,u]=this._rawAttributes[n];this._rawAttributes[n]=[c,(0,x.isPromiseLike)(u)?await u:u]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&c.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let n={};for(let[u,p]of this._rawAttributes){if((0,x.isPromiseLike)(p)){c.diag.debug(`Unsettled resource attribute ${u} skipped`);continue}p!=null&&(n[u]??=p)}return this._asyncAttributesPending||(this._memoizedAttributes=n),n}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(c){if(c==null)return this;let u=L(this,c),p=u?{schemaUrl:u}:void 0;return n.FromAttributeList([...c.getRawAttributes(),...this.getRawAttributes()],p)}};function T(n,c){return w.FromAttributeList(Object.entries(n),c)}n.resourceFromAttributes=T;function O(n,c){return new w(n,c)}n.resourceFromDetectedResource=O;function A(){return T({})}n.emptyResource=A;function j(){return T({[p.ATTR_SERVICE_NAME]:(0,h.defaultServiceName)(),[p.ATTR_TELEMETRY_SDK_LANGUAGE]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_LANGUAGE],[p.ATTR_TELEMETRY_SDK_NAME]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_NAME],[p.ATTR_TELEMETRY_SDK_VERSION]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_VERSION]})}n.defaultResource=j;function N(n){return n.map(([n,u])=>(0,x.isPromiseLike)(u)?[n,u.catch(u=>{c.diag.debug(`promise rejection for resource attribute: %s - %s`,n,u)})]:[n,u])}function I(n){if(typeof n==`string`||n===void 0)return n;c.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,n)}function L(n,u){let p=n?.schemaUrl,h=u?.schemaUrl,x=p===void 0||p===``,w=h===void 0||h===``;if(x)return h;if(w||p===h)return p;c.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,p,h)}})),require_detect_resources=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.detectResources=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_ResourceImpl();n.detectResources=(n={})=>(n.detectors||[]).map(p=>{try{let h=(0,u.resourceFromDetectedResource)(p.detect(n));return c.diag.debug(`${p.constructor.name} found resource.`,h),h}catch(n){return c.diag.debug(`${p.constructor.name} failed: ${n.message}`),(0,u.emptyResource)()}}).reduce((n,c)=>n.merge(c),(0,u.emptyResource)())})),require_EnvDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.envDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_src$3();n.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(n){let h={},x=(0,p.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),w=(0,p.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(x)try{let n=this._parseResourceAttributes(x);Object.assign(h,n)}catch(n){c.diag.debug(`EnvDetector failed: ${n instanceof Error?n.message:n}`)}return w&&(h[u.ATTR_SERVICE_NAME]=w),{attributes:h}}_parseResourceAttributes(n){if(!n)return{};let c={},u=n.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!==``);for(let n of u){let u=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(u.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[p,h]=u,x=p.trim(),w=h.trim();if(x.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let T,O;try{T=decodeURIComponent(x),O=decodeURIComponent(w)}catch(c){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${c instanceof Error?c.message:c}`)}if(T.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${T}".`);if(O.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${T}".`);c[T]=O}return c}}})),require_semconv$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_WEBENGINE_VERSION=n.ATTR_WEBENGINE_NAME=n.ATTR_WEBENGINE_DESCRIPTION=n.ATTR_SERVICE_NAMESPACE=n.ATTR_SERVICE_INSTANCE_ID=n.ATTR_PROCESS_RUNTIME_VERSION=n.ATTR_PROCESS_RUNTIME_NAME=n.ATTR_PROCESS_RUNTIME_DESCRIPTION=n.ATTR_PROCESS_PID=n.ATTR_PROCESS_OWNER=n.ATTR_PROCESS_EXECUTABLE_PATH=n.ATTR_PROCESS_EXECUTABLE_NAME=n.ATTR_PROCESS_COMMAND_ARGS=n.ATTR_PROCESS_COMMAND=n.ATTR_OS_VERSION=n.ATTR_OS_TYPE=n.ATTR_K8S_POD_NAME=n.ATTR_K8S_NAMESPACE_NAME=n.ATTR_K8S_DEPLOYMENT_NAME=n.ATTR_K8S_CLUSTER_NAME=n.ATTR_HOST_TYPE=n.ATTR_HOST_NAME=n.ATTR_HOST_IMAGE_VERSION=n.ATTR_HOST_IMAGE_NAME=n.ATTR_HOST_IMAGE_ID=n.ATTR_HOST_ID=n.ATTR_HOST_ARCH=n.ATTR_CONTAINER_NAME=n.ATTR_CONTAINER_IMAGE_TAGS=n.ATTR_CONTAINER_IMAGE_NAME=n.ATTR_CONTAINER_ID=n.ATTR_CLOUD_REGION=n.ATTR_CLOUD_PROVIDER=n.ATTR_CLOUD_AVAILABILITY_ZONE=n.ATTR_CLOUD_ACCOUNT_ID=void 0,n.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,n.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,n.ATTR_CLOUD_PROVIDER=`cloud.provider`,n.ATTR_CLOUD_REGION=`cloud.region`,n.ATTR_CONTAINER_ID=`container.id`,n.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,n.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,n.ATTR_CONTAINER_NAME=`container.name`,n.ATTR_HOST_ARCH=`host.arch`,n.ATTR_HOST_ID=`host.id`,n.ATTR_HOST_IMAGE_ID=`host.image.id`,n.ATTR_HOST_IMAGE_NAME=`host.image.name`,n.ATTR_HOST_IMAGE_VERSION=`host.image.version`,n.ATTR_HOST_NAME=`host.name`,n.ATTR_HOST_TYPE=`host.type`,n.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,n.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,n.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,n.ATTR_K8S_POD_NAME=`k8s.pod.name`,n.ATTR_OS_TYPE=`os.type`,n.ATTR_OS_VERSION=`os.version`,n.ATTR_PROCESS_COMMAND=`process.command`,n.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,n.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,n.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,n.ATTR_PROCESS_OWNER=`process.owner`,n.ATTR_PROCESS_PID=`process.pid`,n.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,n.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,n.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,n.ATTR_SERVICE_NAMESPACE=`service.namespace`,n.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,n.ATTR_WEBENGINE_NAME=`webengine.name`,n.ATTR_WEBENGINE_VERSION=`webengine.version`})),require_getMachineId=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getMachineId=void 0;let c=__require(`process`),u;async function p(){if(!u)switch(c.platform){case`darwin`:u=(await import(`./getMachineId-darwin-BVHajbu-.js`).then(n=>__toESM(n.default))).getMachineId;break;case`linux`:u=(await import(`./getMachineId-linux-DF4P4JAH.js`).then(n=>__toESM(n.default))).getMachineId;break;case`freebsd`:u=(await import(`./getMachineId-bsd-C9rTsHCB.js`).then(n=>__toESM(n.default))).getMachineId;break;case`win32`:u=(await import(`./getMachineId-win-DvS6eAIQ.js`).then(n=>__toESM(n.default))).getMachineId;break;default:u=(await import(`./getMachineId-unsupported-BHgtlyRW.js`).then(n=>__toESM(n.default))).getMachineId;break}return u()}n.getMachineId=p})),require_utils=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalizeType=n.normalizeArch=void 0,n.normalizeArch=n=>{switch(n){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return n}},n.normalizeType=n=>{switch(n){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return n}}})),require_HostDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.hostDetector=void 0;let c=require_semconv$1(),u=__require(`os`),p=require_getMachineId(),h=require_utils();n.hostDetector=new class{detect(n){return{attributes:{[c.ATTR_HOST_NAME]:(0,u.hostname)(),[c.ATTR_HOST_ARCH]:(0,h.normalizeArch)((0,u.arch)()),[c.ATTR_HOST_ID]:(0,p.getMachineId)()}}}}})),require_OSDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.osDetector=void 0;let c=require_semconv$1(),u=__require(`os`),p=require_utils();n.osDetector=new class{detect(n){return{attributes:{[c.ATTR_OS_TYPE]:(0,p.normalizeType)((0,u.platform)()),[c.ATTR_OS_VERSION]:(0,u.release)()}}}}})),require_ProcessDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_semconv$1(),p=__require(`os`);n.processDetector=new class{detect(n){let h={[u.ATTR_PROCESS_PID]:process.pid,[u.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[u.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[u.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[u.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[u.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[u.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(h[u.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=p.userInfo();h[u.ATTR_PROCESS_OWNER]=n.username}catch(n){c.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:h}}}})),require_ServiceInstanceIdDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=void 0;let c=require_semconv$1(),u=__require(`crypto`);n.serviceInstanceIdDetector=new class{detect(n){return{attributes:{[c.ATTR_SERVICE_INSTANCE_ID]:(0,u.randomUUID)()}}}}})),require_node$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_HostDetector();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}});var u=require_OSDetector();Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}});var p=require_ProcessDetector();Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return p.processDetector}});var h=require_ServiceInstanceIdDetector();Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return h.serviceInstanceIdDetector}})})),require_platform$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_node$1();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return c.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return c.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return c.serviceInstanceIdDetector}})})),require_NoopDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.NoopDetector=void 0;var c=class{detect(){return{attributes:{}}}};n.NoopDetector=c,n.noopDetector=new c})),require_detectors=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=void 0;var c=require_EnvDetector();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return c.envDetector}});var u=require_platform$1();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_NoopDetector();Object.defineProperty(n,`noopDetector`,{enumerable:!0,get:function(){return p.noopDetector}})})),require_src$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultServiceName=n.emptyResource=n.defaultResource=n.resourceFromAttributes=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=n.detectResources=void 0;var c=require_detect_resources();Object.defineProperty(n,`detectResources`,{enumerable:!0,get:function(){return c.detectResources}});var u=require_detectors();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return u.envDetector}}),Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_ResourceImpl();Object.defineProperty(n,`resourceFromAttributes`,{enumerable:!0,get:function(){return p.resourceFromAttributes}}),Object.defineProperty(n,`defaultResource`,{enumerable:!0,get:function(){return p.defaultResource}}),Object.defineProperty(n,`emptyResource`,{enumerable:!0,get:function(){return p.emptyResource}});var h=require_default_service_name();Object.defineProperty(n,`defaultServiceName`,{enumerable:!0,get:function(){return h.defaultServiceName}})})),require_enums=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_AlwaysOffSampler(),h=require_AlwaysOnSampler();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_AlwaysOffSampler(),h=require_AlwaysOnSampler(),x=require_ParentBasedSampler(),w=require_TraceIdRatioBasedSampler();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config(),u=require_src$3();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler(),u=require_semconv();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_Span(),h=require_utility(),x=require_platform(),w=require_TracerMetrics(),T=require_version();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$3();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$3(),u=require_src$2(),p=require_Tracer(),h=require_config(),x=require_MultiSpanProcessor(),w=require_utility();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$3();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$3();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})})),require_NodeTracerProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NodeTracerProvider=void 0;let c=require_src$15(),u=require_src$1(),p=(init_esm$2(),__toCommonJS(esm_exports$2)),h=require_src$3();function x(n){if(n!==null){if(n===void 0){let n=new c.AsyncLocalStorageContextManager;n.enable(),p.context.setGlobalContextManager(n);return}n.enable(),p.context.setGlobalContextManager(n)}}function w(n){if(n!==null){if(n===void 0){p.propagation.setGlobalPropagator(new h.CompositePropagator({propagators:[new h.W3CTraceContextPropagator,new h.W3CBaggagePropagator]}));return}p.propagation.setGlobalPropagator(n)}}n.NodeTracerProvider=class extends u.BasicTracerProvider{constructor(n={}){super(n)}register(n={}){p.trace.setGlobalTracerProvider(this),x(n.contextManager),w(n.propagator)}}})),require_src=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=n.SimpleSpanProcessor=n.SamplingDecision=n.RandomIdGenerator=n.ParentBasedSampler=n.NoopSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.BatchSpanProcessor=n.BasicTracerProvider=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NodeTracerProvider=void 0;var c=require_NodeTracerProvider();Object.defineProperty(n,`NodeTracerProvider`,{enumerable:!0,get:function(){return c.NodeTracerProvider}});var u=require_src$1();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return u.AlwaysOffSampler}}),Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return u.AlwaysOnSampler}}),Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return u.BasicTracerProvider}}),Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return u.ConsoleSpanExporter}}),Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return u.InMemorySpanExporter}}),Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return u.NoopSpanProcessor}}),Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return u.ParentBasedSampler}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}}),Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return u.SamplingDecision}}),Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return u.SimpleSpanProcessor}}),Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return u.TraceIdRatioBasedSampler}})}));init_esm$2();var import_src=require_src$17(),import_src$1=require_src$16(),import_src$2=require_src$15(),import_src$3=require_src$18(),import_src$4=require_src$10(),import_src$5=require_src$9(),import_src$6=require_src$8(),import_src$7=require_src$7(),import_src$8=require_src$6(),import_src$9=require_src$5(),import_src$10=require_src$4(),import_src$11=require_src();const TRAILING_SLASH_PATTERN=/\/+$/,SIGNAL_SUFFIX_PATTERN=/\/v1\/(logs|metrics|traces)$/,normalizeOtlpSignalEndpoint=(n,c)=>{if(!n)throw Error(`OTEL_EXPORTER_OTLP_ENDPOINT is required when OTEL_ENABLED=true`);let u=n.replace(TRAILING_SLASH_PATTERN,``);return u.endsWith(`/v1/${c}`)?u:SIGNAL_SUFFIX_PATTERN.test(u)?u.replace(SIGNAL_SUFFIX_PATTERN,`/v1/${c}`):`${u}/v1/${c}`},parseOtlpHeaders=n=>{let c=n?.trim();return c?c.split(`,`).map(n=>n.trim()).filter(Boolean).reduce((n,c)=>{let u=c.indexOf(`=`);if(u<=0)return n;let p=c.slice(0,u).trim(),h=c.slice(u+1).trim();return!p||!h||(n[p]=h),n},{}):{}},scopeStorage=new AsyncLocalStorage,compactScopeAttributes=n=>{let c={};for(let[u,p]of Object.entries(n))p!=null&&(c[u]=p);return c},getCurrentScopeAttributes=()=>scopeStorage.getStore()??{},mergeScopeAttributes=(n,c)=>compactScopeAttributes({...n,...c}),runWithScopeAttributes=(n,c)=>{let u=mergeScopeAttributes(getCurrentScopeAttributes(),n);return scopeStorage.run(u,c)},normalizeError=n=>n instanceof Error?{message:n.message,name:n.name,...n.stack?{stack:n.stack}:{}}:{message:String(n),name:`Error`},toExceptionAttributes=n=>{let c=normalizeError(n.error),u=mergeScopeAttributes(getCurrentScopeAttributes(),n.attributes??{}),p={};for(let[n,c]of Object.entries(u))c!=null&&(p[n]=c);return p[`echo.exception.handled`]=n.handled,p[`echo.exception.level`]=n.level,p[`echo.exception.mechanism`]=n.mechanism,p[`error.message`]=c.message,p[`error.type`]=c.name,n.fingerprint&&n.fingerprint.length>0&&(p[`echo.exception.fingerprint`]=n.fingerprint.join(`,`)),p},setSpanErrorStatus=(n,c)=>{let u=normalizeError(c);n.setStatus({code:SpanStatusCode.ERROR,message:u.message})},recordExceptionOnSpan=(n,c)=>{let u=normalizeError(c.error);n.setAttributes(toExceptionAttributes(c)),n.recordException({message:u.message,name:u.name,...u.stack?{stack:u.stack}:{}}),setSpanErrorStatus(n,c.error)},captureExceptionAsSpan=n=>{let c={...n.exception,attributes:mergeScopeAttributes(n.spanAttributes??{},n.exception.attributes??{})},u=trace.getSpan(context$1.active());if(u){recordExceptionOnSpan(u,c);return}let p=trace.getTracer(n.serviceName).startSpan(n.spanName??`observability.exception`,{attributes:toExceptionAttributes(c)});recordExceptionOnSpan(p,c),p.end()},NODE_OTEL_RESOURCE_DETECTORS=[import_src.envDetector,import_src.processDetector,import_src.hostDetector,import_src.osDetector],buildNodeOtelResourceAttributes=n=>({"deployment.environment":n.environment,"echo.client_app":n.clientApp,"echo.runtime":n.runtime,"service.name":n.serviceName,"service.version":n.serviceVersion??`unknown`}),createNodeOtelResource=async n=>{let c=(0,import_src.defaultResource)().merge((0,import_src.detectResources)({detectors:NODE_OTEL_RESOURCE_DETECTORS})).merge((0,import_src.resourceFromAttributes)(buildNodeOtelResourceAttributes(n)));return await c.waitForAsyncAttributes?.(),c},DEFAULT_EXPORT_INTERVAL_MS=5e3,createNoopRuntimeHandle=n=>({forceFlush:async()=>{},shutdown:async()=>{},tracer:trace.getTracer(n)}),startNodeOtelRuntime=async n=>{if(n.sdk.debug&&diag.setLogger(new DiagConsoleLogger,DiagLogLevel.INFO),!n.sdk.enabled)return createNoopRuntimeHandle(n.resource.serviceName);let c=parseOtlpHeaders(n.sdk.exporterHeadersRaw),u=await createNodeOtelResource(n.resource),p=new import_src$11.NodeTracerProvider({resource:u,spanProcessors:[new import_src$10.BatchSpanProcessor(new import_src$6.OTLPTraceExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`traces`)}))],sampler:new import_src$10.TraceIdRatioBasedSampler(n.sdk.traceSamplingRatio)});p.register({contextManager:new import_src$2.AsyncLocalStorageContextManager,propagator:new import_src$3.CompositePropagator({propagators:[new import_src$3.W3CBaggagePropagator,new import_src$3.W3CTraceContextPropagator]})});let h=new import_src$9.MeterProvider({readers:[new import_src$9.PeriodicExportingMetricReader({exporter:new import_src$5.OTLPMetricExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`metrics`)}),exportIntervalMillis:DEFAULT_EXPORT_INTERVAL_MS})],resource:u});metrics.setGlobalMeterProvider(h);let x=new import_src$8.LoggerProvider({processors:[new import_src$8.BatchLogRecordProcessor(new import_src$4.OTLPLogExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`logs`)}))],resource:u});import_src$1.logs.setGlobalLoggerProvider(x);let w=(0,import_src$7.registerInstrumentations)({instrumentations:n.instrumentations??[]}),T=!1;return{forceFlush:async()=>{await Promise.all([p.forceFlush(),h.forceFlush(),x.forceFlush()])},shutdown:async()=>{T||(T=!0,w(),await Promise.all([p.shutdown(),h.shutdown(),x.shutdown()]))},tracer:trace.getTracer(n.resource.serviceName)}},runWithNewSpan=async(n,c)=>{let u=trace.getTracer(n.serviceName),p=n.root?ROOT_CONTEXT:n.parentContext??context$1.active();return await context$1.with(p,async()=>await u.startActiveSpan(n.name,{attributes:n.attributes,kind:n.kind},async n=>{try{return await c()}catch(c){let u=normalizeError(c);throw n.recordException({message:u.message,name:u.name,...u.stack?{stack:u.stack}:{}}),setSpanErrorStatus(n,c),c}finally{n.end()}}))};let EchoNodeRuntime=function(n){return n.BACKEND=`backend`,n.CLI=`cli`,n.DESKTOP_MAIN=`desktop_main`,n}({}),EchoNodeClientApp=function(n){return n.ECHO_BACKEND=`echo-backend`,n.ECHO_CLI=`echo-cli`,n.ECHO_CLIENT=`echo-client`,n.ECHO_SKILLS_SERVICE=`echo-skills-service`,n}({}),NodeOtelExceptionMechanism=function(n){return n.BOOTSTRAP_FAILURE=`bootstrap_failure`,n.COMMAND_FAILURE=`command_failure`,n.IPC_FAILURE=`ipc_failure`,n.UNCAUGHT_EXCEPTION=`uncaughtException`,n.UNHANDLED_REJECTION=`unhandledRejection`,n.WINDOW_FAILURE=`window_failure`,n}({});const FLUSH_TIMEOUT_MS=1500,runtimeState={runtime:null,startPromise:null};let hasRegisteredProcessHandlers=!1;const parseBoolean=n=>{if(typeof n!=`string`)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`},getCliServiceName=()=>process.env.OTEL_SERVICE_NAME?.trim()||`cli`,getCliEnvironment=()=>process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV?.trim()||`development`,getCliRuntime=()=>runtimeState.runtime??{backend:`none`},resolveCliObservabilityConfig=()=>({enabled:parseBoolean(process.env.OTEL_ENABLED),environment:getCliEnvironment(),exporterEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,exporterHeadersRaw:process.env.OTEL_EXPORTER_OTLP_HEADERS,serviceName:getCliServiceName(),serviceVersion:process.env.npm_package_version,traceSamplingRatio:Number(process.env.OTEL_TRACE_SAMPLING_RATIO??`1`)}),flushWithTimeout=async n=>{let c=getCliRuntime();if(c.backend===`none`)return!0;if(c.backend===`sentry`)return await getCliObservability().flush(n);try{return await Promise.race([c.handle.forceFlush(),new Promise((c,u)=>{setTimeout(()=>{u(Error(`cli otel flush timeout`))},n)})]),!0}catch{return!1}},captureCliOtelException=(n,c,u,p,h)=>{captureExceptionAsSpan({exception:{attributes:h,error:n,handled:u,level:p,mechanism:c},serviceName:getCliServiceName(),spanName:`cli.exception`})},captureCliSentryException=(n,c,u)=>{getCliObservability().captureException(n,{contexts:u?{cli:u}:void 0,level:c,tags:{crash_surface:`cli`}})},captureCliException=(n,c,u,p,h)=>{if(isExpectedNetworkLifecycleError(n))return;let x=getCliRuntime();if(x.backend===`sentry`){captureCliSentryException(n,p,h);return}x.backend===`otel`&&captureCliOtelException(n,c,u,p,h)},registerProcessHandlers=()=>{hasRegisteredProcessHandlers||=(process.on(`uncaughtException`,n=>{captureCliException(n,NodeOtelExceptionMechanism.UNCAUGHT_EXCEPTION,!1,`fatal`,{"echo.command.phase":`process`})}),process.on(`unhandledRejection`,n=>{captureCliException(n,NodeOtelExceptionMechanism.UNHANDLED_REJECTION,!1,`error`,{"echo.command.phase":`process`})}),!0)},startCliObservability=async()=>{if(runtimeState.runtime)return;if(runtimeState.startPromise){await runtimeState.startPromise.catch(()=>void 0);return}let n=(async()=>{let n=resolveCliNodeObservabilityBackendName();if(n===`sentry`)return getCliObservability(),registerProcessHandlers(),{backend:n};if(n===`none`)return registerProcessHandlers(),{backend:n};let c=resolveCliObservabilityConfig(),u=null;try{return u=await startNodeOtelRuntime({resource:{clientApp:EchoNodeClientApp.ECHO_CLI,environment:c.environment,runtime:EchoNodeRuntime.CLI,serviceName:c.serviceName,serviceVersion:c.serviceVersion},sdk:{enabled:c.enabled,exporterEndpoint:c.exporterEndpoint,exporterHeadersRaw:c.exporterHeadersRaw,traceSamplingRatio:c.traceSamplingRatio}}),registerProcessHandlers(),{backend:n,handle:u}}catch(n){throw u&&await u.shutdown().catch(()=>void 0),n}})();runtimeState.startPromise=n;try{runtimeState.runtime=await n}catch(n){console.warn(`Failed to start CLI observability; continuing without telemetry`,n),runtimeState.runtime=null}finally{runtimeState.startPromise===n&&(runtimeState.startPromise=null)}},shutdownCliObservability=async()=>{try{await runtimeState.startPromise}catch{}await flushWithTimeout(FLUSH_TIMEOUT_MS);let n=getCliRuntime();runtimeState.runtime=null,n.backend===`otel`&&await n.handle.shutdown().catch(()=>void 0)},reportCliCommandFailure=async(n,c)=>{captureCliException(n,NodeOtelExceptionMechanism.COMMAND_FAILURE,!0,`error`,{"echo.command.name":c}),await flushWithTimeout(FLUSH_TIMEOUT_MS)},runCliCommandSpan=async(n,c)=>{let u={"echo.command.cwd_basename":path.basename(n.cwd),"echo.command.interactive":n.interactive,"echo.command.name":n.commandName},p=getCliRuntime();if(p.backend===`sentry`){let p=getCliObservability().startSpan({attributes:u,name:`cli.command ${n.commandName}`,op:`cli.command`});try{let n=await c();return p.finish({status:`ok`}),n}catch(n){throw p.finish({status:`internal_error`}),n}}return p.backend===`otel`?await runWithScopeAttributes(u,async()=>await runWithNewSpan({attributes:u,name:`cli.command ${n.commandName}`,root:!0,serviceName:getCliServiceName()},c)):await c()},resolveCliCommandName=n=>{let c=n[0]?.trim();return!c||c.startsWith(`-`)?`default`:c},packageRoot=resolve(dirname(fileURLToPath(import.meta.url)),`..`),loadCliEnv=()=>{for(let n of[resolve(packageRoot,`.env`),resolve(packageRoot,`.env.local`),resolve(process.cwd(),`.env`),resolve(process.cwd(),`.env.local`)])existsSync(n)&&(0,import_main.config)({path:n,override:!1})},buildCli=()=>{let n=cac(CLI_BRAND.command);return n.usage(`[--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--non-interactive`,`Run headless login or runtime output`).option(`--skip-update-check`,`Skip update checks for this command`).option(`--token <token>`,`Bootstrap login token`).option(`--base-url <host[:port][/path]>`,`Backend host[:port][/path] without scheme`).option(`--ssl`,`Use SSL for derived HTTP/WebSocket endpoints`).option(`--method <method>`,`Login method for headless login (${LOGIN_METHOD_OPTIONS_TEXT})`),n.command(``,`Start the interactive TUI shell`).usage(`[--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).action(async n=>{if(n.nonInteractive)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);await runInteractiveApp({initialUpdateState:await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck}),baseUrl:n.baseUrl,ssl:n.ssl,token:n.token})}),n.command(`login`,`Headless login`).usage(`login --non-interactive [--token <token>] [--method <method>] [--base-url <host[:port][/path]>] [--no-ssl]`).action(async n=>{if(n.nonInteractive!==!0)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck}),await runNonInteractiveLoginCommand({baseUrl:n.baseUrl,method:n.method,ssl:n.ssl,token:n.token})}),n.command(`run`,`Headless runtime logs`).usage(`run --non-interactive [--prevent-sleep] [--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--prevent-sleep`,`On macOS, keep the system from idle sleeping while this run process is alive`).action(async n=>{if(n.nonInteractive!==!0)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);let c=await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck});await runNonInteractiveRunCommand({baseUrl:n.baseUrl,initialUpdateState:c,preventSleep:n.preventSleep,ssl:n.ssl,token:n.token})}),n.command(`logout`,`Clear the persisted CLI session`).usage(`logout`).action(async()=>{await runLogoutCommand()}),n.command(`service <action>`,`Manage the Syncless background service`).usage(`service <install|status|logs|stop|uninstall> [--target systemd-user] [--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--target <target>`,`Service manager target (auto, systemd-user)`).option(`--working-directory <path>`,`Working directory published by the service runtime`).option(`--enable-linger`,`Run loginctl enable-linger for the current user after systemd install`).action(async(n,c)=>{await runServiceCommand(n,{baseUrl:c.baseUrl,enableLinger:c.enableLinger===!0,ssl:c.ssl,target:c.target,token:c.token,workingDirectory:c.workingDirectory})}),n.command(`device <action> [deviceCode]`,`Manage the persisted device code`).usage(`device <set|clear> [deviceCode]`).action(async(n,c)=>{if(n===`set`){if(typeof c!=`string`||c.trim().length===0)throw Error(`Usage: ${CLI_BRAND.command} device set <deviceCode>`);await runDeviceSetCommand(c.trim());return}if(n===`clear`){if(typeof c==`string`&&c.trim().length>0)throw Error(`Usage: ${CLI_BRAND.command} device clear`);await runDeviceClearCommand();return}throw Error(`Unknown device command. Use \`${CLI_BRAND.command} device set <deviceCode>\` or \`${CLI_BRAND.command} device clear\`.`)}),n.help(n=>[...n,{title:`Notes`,body:[` \`${CLI_BRAND.command}\` starts the interactive TUI shell.`,` Headless usage is command-first: \`${CLI_BRAND.command} login --non-interactive\` or \`${CLI_BRAND.command} run --non-interactive\`.`,` Pass \`${CLI_BRAND.command} run --non-interactive --prevent-sleep\` or set \`${CLI_BRAND.envPrefix}_PREVENT_SLEEP=1\` to keep macOS from idle sleeping while a headless run is active.`,` Set \`${CLI_BRAND.envPrefix}_SKIP_UPDATE_CHECK=1\` or pass \`--skip-update-check\` to bypass update checks.`].join(`
|
|
500
|
+
`,(0,p.getConflictResolutionRecipe)(h,n))}return x}}})),require_MultiWritableMetricStorage=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiMetricStorage=void 0,n.MultiMetricStorage=class{_backingStorages;constructor(n){this._backingStorages=n}record(n,c,u,p){this._backingStorages.forEach(h=>{h.record(n,c,u,p)})}}})),require_ObservableResult=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchObservableResultImpl=n.ObservableResultImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_HashMap(),p=require_Instruments();n.ObservableResultImpl=class{_buffer=new u.AttributeHashMap;_instrumentName;_valueType;constructor(n,c){this._instrumentName=n,this._valueType=c}observe(n,u={}){if(typeof n!=`number`){c.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${n}`);return}this._valueType===c.ValueType.INT&&!Number.isInteger(n)&&(c.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),n=Math.trunc(n),!Number.isInteger(n))||this._buffer.set(u,n)}},n.BatchObservableResultImpl=class{_buffer=new Map;observe(n,h,x={}){if(!(0,p.isObservableInstrument)(n))return;let w=this._buffer.get(n);if(w??(w=new u.AttributeHashMap,this._buffer.set(n,w)),typeof h!=`number`){c.diag.warn(`non-number value provided to metric ${n._descriptor.name}: ${h}`);return}n._descriptor.valueType===c.ValueType.INT&&!Number.isInteger(h)&&(c.diag.warn(`INT value type cannot accept a floating-point value for ${n._descriptor.name}, ignoring the fractional digits.`),h=Math.trunc(h),!Number.isInteger(h))||w.set(x,h)}}})),require_ObservableRegistry=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ObservableRegistry=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Instruments(),p=require_ObservableResult(),h=require_utils$3();n.ObservableRegistry=class{_callbacks=[];_batchCallbacks=[];addCallback(n,c){this._findCallback(n,c)>=0||this._callbacks.push({callback:n,instrument:c})}removeCallback(n,c){let u=this._findCallback(n,c);u<0||this._callbacks.splice(u,1)}addBatchCallback(n,p){let h=new Set(p.filter(u.isObservableInstrument));if(h.size===0){c.diag.error(`BatchObservableCallback is not associated with valid instruments`,p);return}this._findBatchCallback(n,h)>=0||this._batchCallbacks.push({callback:n,instruments:h})}removeBatchCallback(n,c){let p=new Set(c.filter(u.isObservableInstrument)),h=this._findBatchCallback(n,p);h<0||this._batchCallbacks.splice(h,1)}async observe(n,c){let u=this._observeCallbacks(n,c),p=this._observeBatchCallbacks(n,c);return(await Promise.allSettled([...u,...p])).filter(n=>n.status===`rejected`).map(n=>n.reason)}_observeCallbacks(n,c){return this._callbacks.map(async({callback:u,instrument:x})=>{let w=new p.ObservableResultImpl(x._descriptor.name,x._descriptor.valueType),T=Promise.resolve(u(w));c!=null&&(T=(0,h.callWithTimeout)(T,c)),await T,x._metricStorages.forEach(c=>{c.record(w._buffer,n)})})}_observeBatchCallbacks(n,c){return this._batchCallbacks.map(async({callback:u,instruments:x})=>{let w=new p.BatchObservableResultImpl,T=Promise.resolve(u(w));c!=null&&(T=(0,h.callWithTimeout)(T,c)),await T,x.forEach(c=>{let u=w._buffer.get(c);u!=null&&c._metricStorages.forEach(c=>{c.record(u,n)})})})}_findCallback(n,c){return this._callbacks.findIndex(u=>u.callback===n&&u.instrument===c)}_findBatchCallback(n,c){return this._batchCallbacks.findIndex(u=>u.callback===n&&(0,h.setEquals)(u.instruments,c))}}})),require_SyncMetricStorage=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SyncMetricStorage=void 0;let c=require_MetricStorage(),u=require_DeltaMetricProcessor(),p=require_TemporalMetricProcessor();n.SyncMetricStorage=class extends c.MetricStorage{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(n,c,h,x,w){super(n),this._aggregationCardinalityLimit=w,this._deltaMetricStorage=new u.DeltaMetricProcessor(c,this._aggregationCardinalityLimit),this._temporalMetricStorage=new p.TemporalMetricProcessor(c,x),this._attributesProcessor=h}record(n,c,u,p){c=this._attributesProcessor.process(c,u),this._deltaMetricStorage.record(n,c,u,p)}collect(n,c){let u=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(n,this._instrumentDescriptor,u,c)}}})),require_AttributesProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.createDenyListAttributesProcessor=n.createAllowListAttributesProcessor=n.createMultiAttributesProcessor=n.createNoopAttributesProcessor=void 0;var c=class{process(n,c){return n}},u=class{_processors;constructor(n){this._processors=n}process(n,c){let u=n;for(let n of this._processors)u=n.process(u,c);return u}},p=class{_allowedAttributeNames;constructor(n){this._allowedAttributeNames=n}process(n,c){let u={};return Object.keys(n).forEach(c=>{this._allowedAttributeNames.includes(c)&&(u[c]=n[c])}),u}},h=class{_deniedAttributeNames;constructor(n){this._deniedAttributeNames=n}process(n,c){let u={};return Object.keys(n).forEach(c=>{this._deniedAttributeNames.includes(c)||(u[c]=n[c])}),u}};function x(){return A}n.createNoopAttributesProcessor=x;function w(n){return new u(n)}n.createMultiAttributesProcessor=w;function T(n){return new p(n)}n.createAllowListAttributesProcessor=T;function O(n){return new h(n)}n.createDenyListAttributesProcessor=O;let A=new c})),require_MeterSharedState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterSharedState=void 0;let c=require_InstrumentDescriptor(),u=require_Meter(),p=require_AsyncMetricStorage(),h=require_MetricStorageRegistry(),x=require_MultiWritableMetricStorage(),w=require_ObservableRegistry(),T=require_SyncMetricStorage(),O=require_AttributesProcessor();n.MeterSharedState=class{metricStorageRegistry=new h.MetricStorageRegistry;observableRegistry=new w.ObservableRegistry;meter;_meterProviderSharedState;_instrumentationScope;constructor(n,c){this.meter=new u.Meter(this),this._meterProviderSharedState=n,this._instrumentationScope=c}registerMetricStorage(n){let c=this._registerMetricStorage(n,T.SyncMetricStorage);return c.length===1?c[0]:new x.MultiMetricStorage(c)}registerAsyncMetricStorage(n){return this._registerMetricStorage(n,p.AsyncMetricStorage)}async collect(n,c,u){let p=await this.observableRegistry.observe(c,u?.timeoutMillis),h=this.metricStorageRegistry.getStorages(n);if(h.length===0)return null;let x=[];return h.forEach(u=>{let p=u.collect(n,c);p!=null&&x.push(p)}),x.length===0?{errors:p}:{scopeMetrics:{scope:this._instrumentationScope,metrics:x},errors:p}}_registerMetricStorage(n,u){let p=this._meterProviderSharedState.viewRegistry.findViews(n,this._instrumentationScope).map(p=>{let h=(0,c.createInstrumentDescriptorWithView)(p,n),x=this.metricStorageRegistry.findOrUpdateCompatibleStorage(h);if(x!=null)return x;let w=new u(h,p.aggregation.createAggregator(h),p.attributesProcessor,this._meterProviderSharedState.metricCollectors,p.aggregationCardinalityLimit);return this.metricStorageRegistry.register(w),w});if(p.length===0){let c=this._meterProviderSharedState.selectAggregations(n.type).map(([c,p])=>{let h=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(c,n);if(h!=null)return h;let x=p.createAggregator(n),w=c.selectCardinalityLimit(n.type),T=new u(n,x,(0,O.createNoopAttributesProcessor)(),[c],w);return this.metricStorageRegistry.registerForCollector(c,T),T});p=p.concat(c)}return p}}})),require_MeterProviderSharedState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterProviderSharedState=void 0;let c=require_utils$3(),u=require_ViewRegistry(),p=require_MeterSharedState(),h=require_AggregationOption();n.MeterProviderSharedState=class{viewRegistry=new u.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;resource;constructor(n){this.resource=n}getMeterSharedState(n){let u=(0,c.instrumentationScopeId)(n),h=this.meterSharedStates.get(u);return h??(h=new p.MeterSharedState(this,n),this.meterSharedStates.set(u,h)),h}selectAggregations(n){let c=[];for(let u of this.metricCollectors)c.push([u,(0,h.toAggregation)(u.selectAggregation(n))]);return c}}})),require_MetricCollector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MetricCollector=void 0;let c=require_src$18();n.MetricCollector=class{_sharedState;_metricReader;constructor(n,c){this._sharedState=n,this._metricReader=c}async collect(n){let u=(0,c.millisToHrTime)(Date.now()),p=[],h=[],x=Array.from(this._sharedState.meterSharedStates.values()).map(async c=>{let x=await c.collect(this,u,n);x?.scopeMetrics!=null&&p.push(x.scopeMetrics),x?.errors!=null&&h.push(...x.errors)});return await Promise.all(x),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:p},errors:h}}async forceFlush(n){await this._metricReader.forceFlush(n)}async shutdown(n){await this._metricReader.shutdown(n)}selectAggregationTemporality(n){return this._metricReader.selectAggregationTemporality(n)}selectAggregation(n){return this._metricReader.selectAggregation(n)}selectCardinalityLimit(n){return this._metricReader.selectCardinalityLimit?.(n)??2e3}}})),require_Predicate=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExactPredicate=n.PatternPredicate=void 0;let c=/[\^$\\.+?()[\]{}|]/g;n.PatternPredicate=class n{_matchAll;_regexp;constructor(c){c===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(n.escapePattern(c)))}match(n){return this._matchAll?!0:this._regexp.test(n)}static escapePattern(n){return`^${n.replace(c,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(n){return n.includes(`*`)}},n.ExactPredicate=class{_matchAll;_pattern;constructor(n){this._matchAll=n===void 0,this._pattern=n}match(n){return!!(this._matchAll||n===this._pattern)}}})),require_InstrumentSelector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InstrumentSelector=void 0;let c=require_Predicate();n.InstrumentSelector=class{_nameFilter;_type;_unitFilter;constructor(n){this._nameFilter=new c.PatternPredicate(n?.name??`*`),this._type=n?.type,this._unitFilter=new c.ExactPredicate(n?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}})),require_MeterSelector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterSelector=void 0;let c=require_Predicate();n.MeterSelector=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(n){this._nameFilter=new c.ExactPredicate(n?.name),this._versionFilter=new c.ExactPredicate(n?.version),this._schemaUrlFilter=new c.ExactPredicate(n?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}})),require_View=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.View=void 0;let c=require_Predicate(),u=require_AttributesProcessor(),p=require_InstrumentSelector(),h=require_MeterSelector(),x=require_AggregationOption();function w(n){return n.instrumentName==null&&n.instrumentType==null&&n.instrumentUnit==null&&n.meterName==null&&n.meterVersion==null&&n.meterSchemaUrl==null}function T(n){if(w(n))throw Error(`Cannot create view with no selector arguments supplied`);if(n.name!=null&&(n?.instrumentName==null||c.PatternPredicate.hasWildcard(n.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}n.View=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(n){T(n),n.attributesProcessors==null?this.attributesProcessor=(0,u.createNoopAttributesProcessor)():this.attributesProcessor=(0,u.createMultiAttributesProcessor)(n.attributesProcessors),this.name=n.name,this.description=n.description,this.aggregation=(0,x.toAggregation)(n.aggregation??{type:x.AggregationType.DEFAULT}),this.instrumentSelector=new p.InstrumentSelector({name:n.instrumentName,type:n.instrumentType,unit:n.instrumentUnit}),this.meterSelector=new h.MeterSelector({name:n.meterName,version:n.meterVersion,schemaUrl:n.meterSchemaUrl}),this.aggregationCardinalityLimit=n.aggregationCardinalityLimit}}})),require_MeterProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MeterProvider=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$17(),p=require_MeterProviderSharedState(),h=require_MetricCollector(),x=require_View();n.MeterProvider=class{_sharedState;_shutdown=!1;constructor(n){if(this._sharedState=new p.MeterProviderSharedState(n?.resource??(0,u.defaultResource)()),n?.views!=null&&n.views.length>0)for(let c of n.views)this._sharedState.viewRegistry.addView(new x.View(c));if(n?.readers!=null&&n.readers.length>0)for(let c of n.readers){let n=new h.MetricCollector(this._sharedState,c);c.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(n,u=``,p={}){return this._shutdown?(c.diag.warn(`A shutdown MeterProvider cannot provide a Meter`),(0,c.createNoopMeter)()):this._sharedState.getMeterSharedState({name:n,version:u,schemaUrl:p.schemaUrl}).meter}async shutdown(n){if(this._shutdown){c.diag.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(c=>c.shutdown(n)))}async forceFlush(n){if(this._shutdown){c.diag.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(c=>c.forceFlush(n)))}}})),require_src$5=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TimeoutError=n.createDenyListAttributesProcessor=n.createAllowListAttributesProcessor=n.AggregationType=n.MeterProvider=n.ConsoleMetricExporter=n.InMemoryMetricExporter=n.PeriodicExportingMetricReader=n.MetricReader=n.InstrumentType=n.DataPointType=n.AggregationTemporality=void 0;var c=require_AggregationTemporality();Object.defineProperty(n,`AggregationTemporality`,{enumerable:!0,get:function(){return c.AggregationTemporality}});var u=require_MetricData();Object.defineProperty(n,`DataPointType`,{enumerable:!0,get:function(){return u.DataPointType}}),Object.defineProperty(n,`InstrumentType`,{enumerable:!0,get:function(){return u.InstrumentType}});var p=require_MetricReader();Object.defineProperty(n,`MetricReader`,{enumerable:!0,get:function(){return p.MetricReader}});var h=require_PeriodicExportingMetricReader();Object.defineProperty(n,`PeriodicExportingMetricReader`,{enumerable:!0,get:function(){return h.PeriodicExportingMetricReader}});var x=require_InMemoryMetricExporter();Object.defineProperty(n,`InMemoryMetricExporter`,{enumerable:!0,get:function(){return x.InMemoryMetricExporter}});var w=require_ConsoleMetricExporter();Object.defineProperty(n,`ConsoleMetricExporter`,{enumerable:!0,get:function(){return w.ConsoleMetricExporter}});var T=require_MeterProvider();Object.defineProperty(n,`MeterProvider`,{enumerable:!0,get:function(){return T.MeterProvider}});var O=require_AggregationOption();Object.defineProperty(n,`AggregationType`,{enumerable:!0,get:function(){return O.AggregationType}});var A=require_AttributesProcessor();Object.defineProperty(n,`createAllowListAttributesProcessor`,{enumerable:!0,get:function(){return A.createAllowListAttributesProcessor}}),Object.defineProperty(n,`createDenyListAttributesProcessor`,{enumerable:!0,get:function(){return A.createDenyListAttributesProcessor}});var j=require_utils$3();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return j.TimeoutError}})})),require_enums$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums$1();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler$1();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler$1();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_AlwaysOffSampler$1(),h=require_AlwaysOnSampler$1();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler$1();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_AlwaysOffSampler$1(),h=require_AlwaysOnSampler$1(),x=require_ParentBasedSampler$1(),w=require_TraceIdRatioBasedSampler$1();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config$1(),u=require_src$18();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase$1();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor$1();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator$1();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node$3();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler$1(),u=require_semconv$3();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18(),p=require_Span$1(),h=require_utility$1(),x=require_platform$3(),w=require_TracerMetrics$1(),T=require_version$2();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$18();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$18(),u=require_src$17(),p=require_Tracer$1(),h=require_config$1(),x=require_MultiSpanProcessor$1(),w=require_utility$1();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$18();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$18();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$18();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$4=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider$1();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform$3();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter$1();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter$1();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor$1();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor$1();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler$1();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler$1();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler$1();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler$1();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler$1();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})})),require_suppress_tracing=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isTracingSuppressed=n.unsuppressTracing=n.suppressTracing=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function u(n){return n.setValue(c,!0)}n.suppressTracing=u;function p(n){return n.deleteValue(c)}n.unsuppressTracing=p;function h(n){return n.getValue(c)===!0}n.isTracingSuppressed=h})),require_constants=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BAGGAGE_MAX_TOTAL_LENGTH=n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=n.BAGGAGE_MAX_NAME_VALUE_PAIRS=n.BAGGAGE_HEADER=n.BAGGAGE_ITEMS_SEPARATOR=n.BAGGAGE_PROPERTIES_SEPARATOR=n.BAGGAGE_KEY_PAIR_SEPARATOR=void 0,n.BAGGAGE_KEY_PAIR_SEPARATOR=`=`,n.BAGGAGE_PROPERTIES_SEPARATOR=`;`,n.BAGGAGE_ITEMS_SEPARATOR=`,`,n.BAGGAGE_HEADER=`baggage`,n.BAGGAGE_MAX_NAME_VALUE_PAIRS=180,n.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096,n.BAGGAGE_MAX_TOTAL_LENGTH=8192})),require_utils$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.parseKeyPairsIntoRecord=n.parsePairKeyValue=n.getKeyPairs=n.serializeKeyPairs=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_constants();function p(n){return n.reduce((n,c)=>{let p=`${n}${n===``?``:u.BAGGAGE_ITEMS_SEPARATOR}${c}`;return p.length>u.BAGGAGE_MAX_TOTAL_LENGTH?n:p},``)}n.serializeKeyPairs=p;function h(n){return n.getAllEntries().map(([n,c])=>{let p=`${encodeURIComponent(n)}=${encodeURIComponent(c.value)}`;return c.metadata!==void 0&&(p+=u.BAGGAGE_PROPERTIES_SEPARATOR+c.metadata.toString()),p})}n.getKeyPairs=h;function x(n){if(!n)return;let p=n.indexOf(u.BAGGAGE_PROPERTIES_SEPARATOR),h=p===-1?n:n.substring(0,p),x=h.indexOf(u.BAGGAGE_KEY_PAIR_SEPARATOR);if(x<=0)return;let w=h.substring(0,x).trim(),T=h.substring(x+1).trim();if(!w||!T)return;let O,A;try{O=decodeURIComponent(w),A=decodeURIComponent(T)}catch{return}let j;if(p!==-1&&p<n.length-1){let u=n.substring(p+1);j=(0,c.baggageEntryMetadataFromString)(u)}return{key:O,value:A,metadata:j}}n.parsePairKeyValue=x;function w(n){let c={};return typeof n==`string`&&n.length>0&&n.split(u.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let u=x(n);u!==void 0&&u.value.length>0&&(c[u.key]=u.value)}),c}n.parseKeyPairsIntoRecord=w})),require_W3CBaggagePropagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CBaggagePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing(),p=require_constants(),h=require_utils$2();n.W3CBaggagePropagator=class{inject(n,x,w){let T=c.propagation.getBaggage(n);if(!T||(0,u.isTracingSuppressed)(n))return;let O=(0,h.getKeyPairs)(T).filter(n=>n.length<=p.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,p.BAGGAGE_MAX_NAME_VALUE_PAIRS),A=(0,h.serializeKeyPairs)(O);A.length>0&&w.set(x,p.BAGGAGE_HEADER,A)}extract(n,u,x){let w=x.get(u,p.BAGGAGE_HEADER),T=Array.isArray(w)?w.join(p.BAGGAGE_ITEMS_SEPARATOR):w;if(!T)return n;let O={};return T.length===0||(T.split(p.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let c=(0,h.parsePairKeyValue)(n);if(c){let n={value:c.value};c.metadata&&(n.metadata=c.metadata),O[c.key]=n}}),Object.entries(O).length===0)?n:c.propagation.setBaggage(n,c.propagation.createBaggage(O))}fields(){return[p.BAGGAGE_HEADER]}}})),require_anchored_clock=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AnchoredClock=void 0,n.AnchoredClock=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(n,c){this._monotonicClock=c,this._epochMillis=n.now(),this._performanceMillis=c.now()}now(){let n=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+n}}})),require_attributes=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isAttributeValue=n.isAttributeKey=n.sanitizeAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(n){let u={};if(typeof n!=`object`||!n)return u;for(let x in n){if(!Object.prototype.hasOwnProperty.call(n,x))continue;if(!p(x)){c.diag.warn(`Invalid attribute key: ${x}`);continue}let w=n[x];if(!h(w)){c.diag.warn(`Invalid attribute value set for key: ${x}`);continue}Array.isArray(w)?u[x]=w.slice():u[x]=w}return u}n.sanitizeAttributes=u;function p(n){return typeof n==`string`&&n!==``}n.isAttributeKey=p;function h(n){return n==null?!0:Array.isArray(n)?x(n):w(typeof n)}n.isAttributeValue=h;function x(n){let c;for(let u of n){if(u==null)continue;let n=typeof u;if(n!==c){if(!c){if(w(n)){c=n;continue}return!1}return!1}}return!0}function w(n){switch(n){case`number`:case`boolean`:case`string`:return!0}return!1}})),require_logging_error_handler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.loggingErrorHandler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));function u(){return n=>{c.diag.error(p(n))}}n.loggingErrorHandler=u;function p(n){return typeof n==`string`?n:JSON.stringify(h(n))}function h(n){let c={},u=n;for(;u!==null;)Object.getOwnPropertyNames(u).forEach(n=>{if(c[n])return;let p=u[n];p&&(c[n]=String(p))}),u=Object.getPrototypeOf(u);return c}})),require_global_error_handler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.globalErrorHandler=n.setGlobalErrorHandler=void 0;let c=(0,require_logging_error_handler().loggingErrorHandler)();function u(n){c=n}n.setGlobalErrorHandler=u;function p(n){try{c(n)}catch{}}n.globalErrorHandler=p})),require_environment=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n.getNumberFromEnv=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=__require(`util`);function p(n){let p=process.env[n];if(p==null||p.trim()===``)return;let h=Number(p);if(isNaN(h)){c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected a number, using defaults`);return}return h}n.getNumberFromEnv=p;function h(n){let c=process.env[n];if(!(c==null||c.trim()===``))return c}n.getStringFromEnv=h;function x(n){let p=process.env[n]?.trim().toLowerCase();return p==null||p===``?!1:p===`true`?!0:(p===`false`||c.diag.warn(`Unknown value ${(0,u.inspect)(p)} for ${n}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}n.getBooleanFromEnv=x;function w(n){return h(n)?.split(`,`).map(n=>n.trim()).filter(n=>n!==``)}n.getStringListFromEnv=w})),require_globalThis=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._globalThis=void 0,n._globalThis=globalThis})),require_version$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_semconv$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_PROCESS_RUNTIME_NAME=void 0,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`})),require_sdk_info=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SDK_INFO=void 0;let c=require_version$1(),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_semconv$2();n.SDK_INFO={[u.ATTR_TELEMETRY_SDK_NAME]:`opentelemetry`,[p.ATTR_PROCESS_RUNTIME_NAME]:`node`,[u.ATTR_TELEMETRY_SDK_LANGUAGE]:u.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[u.ATTR_TELEMETRY_SDK_VERSION]:c.VERSION}})),require_node$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.otperformance=n.SDK_INFO=n._globalThis=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=void 0;var c=require_environment();Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}});var u=require_globalThis();Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return u._globalThis}});var p=require_sdk_info();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return p.SDK_INFO}}),n.otperformance=performance})),require_platform$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getStringListFromEnv=n.getNumberFromEnv=n.getStringFromEnv=n.getBooleanFromEnv=n.otperformance=n._globalThis=n.SDK_INFO=void 0;var c=require_node$2();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return c.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return c._globalThis}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return c.otperformance}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return c.getBooleanFromEnv}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return c.getStringFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return c.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return c.getStringListFromEnv}})})),require_time=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.addHrTimes=n.isTimeInput=n.isTimeInputHrTime=n.hrTimeToMicroseconds=n.hrTimeToMilliseconds=n.hrTimeToNanoseconds=n.hrTimeToTimeStamp=n.hrTimeDuration=n.timeInputToHrTime=n.hrTime=n.getTimeOrigin=n.millisToHrTime=void 0;let c=require_platform$2(),u=9,p=10**6,h=10**9;function x(n){let c=n/1e3;return[Math.trunc(c),Math.round(n%1e3*p)]}n.millisToHrTime=x;function w(){return c.otperformance.timeOrigin}n.getTimeOrigin=w;function T(n){return V(x(c.otperformance.timeOrigin),x(typeof n==`number`?n:c.otperformance.now()))}n.hrTime=T;function O(n){if(z(n))return n;if(typeof n==`number`)return n<c.otperformance.timeOrigin?T(n):x(n);if(n instanceof Date)return x(n.getTime());throw TypeError(`Invalid input type`)}n.timeInputToHrTime=O;function A(n,c){let u=c[0]-n[0],p=c[1]-n[1];return p<0&&(--u,p+=h),[u,p]}n.hrTimeDuration=A;function j(n){let c=9,u=`${`0`.repeat(9)}${n[1]}Z`,p=u.substring(u.length-9-1);return new Date(n[0]*1e3).toISOString().replace(`000Z`,p)}n.hrTimeToTimeStamp=j;function N(n){return n[0]*h+n[1]}n.hrTimeToNanoseconds=N;function I(n){return n[0]*1e3+n[1]/1e6}n.hrTimeToMilliseconds=I;function L(n){return n[0]*1e6+n[1]/1e3}n.hrTimeToMicroseconds=L;function z(n){return Array.isArray(n)&&n.length===2&&typeof n[0]==`number`&&typeof n[1]==`number`}n.isTimeInputHrTime=z;function B(n){return z(n)||typeof n==`number`||n instanceof Date}n.isTimeInput=B;function V(n,c){let u=[n[0]+c[0],n[1]+c[1]];return u[1]>=h&&(u[1]-=h,u[0]+=1),u}n.addHrTimes=V})),require_timer_util=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.unrefTimer=void 0;function c(n){typeof n!=`number`&&n.unref()}n.unrefTimer=c})),require_ExportResult=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExportResultCode=void 0,(function(n){n[n.SUCCESS=0]=`SUCCESS`,n[n.FAILED=1]=`FAILED`})(n.ExportResultCode||={})})),require_composite=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.CompositePropagator=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2));n.CompositePropagator=class{_propagators;_fields;constructor(n={}){this._propagators=n.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields==`function`?n.fields():[]).reduce((n,c)=>n.concat(c),[])))}inject(n,u,p){for(let h of this._propagators)try{h.inject(n,u,p)}catch(n){c.diag.warn(`Failed to inject with ${h.constructor.name}. Err: ${n.message}`)}}extract(n,u,p){return this._propagators.reduce((n,h)=>{try{return h.extract(n,u,p)}catch(n){c.diag.warn(`Failed to extract with ${h.constructor.name}. Err: ${n.message}`)}return n},n)}fields(){return this._fields.slice()}}})),require_validators=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.validateValue=n.validateKey=void 0;let c=`[_0-9a-z-*/]`,u=`[a-z]${c}{0,255}`,p=`[a-z0-9]${c}{0,240}@[a-z]${c}{0,13}`,h=RegExp(`^(?:${u}|${p})$`),x=/^[ -~]{0,255}[!-~]$/,w=/,|=/;function T(n){return h.test(n)}n.validateKey=T;function O(n){return x.test(n)&&!w.test(n)}n.validateValue=O})),require_TraceState=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceState=void 0;let c=require_validators(),u=32,p=512,h=`,`,x=`=`;n.TraceState=class n{_internalState=new Map;constructor(n){n&&this._parse(n)}set(n,c){let u=this._clone();return u._internalState.has(n)&&u._internalState.delete(n),u._internalState.set(n,c),u}unset(n){let c=this._clone();return c._internalState.delete(n),c}get(n){return this._internalState.get(n)}serialize(){return this._keys().reduce((n,c)=>(n.push(c+`=`+this.get(c)),n),[]).join(`,`)}_parse(n){n.length>512||(this._internalState=n.split(`,`).reverse().reduce((n,u)=>{let p=u.trim(),h=p.indexOf(`=`);if(h!==-1){let x=p.slice(0,h),w=p.slice(h+1,u.length);(0,c.validateKey)(x)&&(0,c.validateValue)(w)&&n.set(x,w)}return n},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let c=new n;return c._internalState=new Map(this._internalState),c}}})),require_W3CTraceContextPropagator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.W3CTraceContextPropagator=n.parseTraceParent=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing(),p=require_TraceState();n.TRACE_PARENT_HEADER=`traceparent`,n.TRACE_STATE_HEADER=`tracestate`;let h=`00`,x=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function w(n){let c=x.exec(n);return!c||c[1]===`00`&&c[5]?null:{traceId:c[2],spanId:c[3],traceFlags:parseInt(c[4],16)}}n.parseTraceParent=w,n.W3CTraceContextPropagator=class{inject(p,h,x){let w=c.trace.getSpanContext(p);if(!w||(0,u.isTracingSuppressed)(p)||!(0,c.isSpanContextValid)(w))return;let T=`00-${w.traceId}-${w.spanId}-0${Number(w.traceFlags||c.TraceFlags.NONE).toString(16)}`;x.set(h,n.TRACE_PARENT_HEADER,T),w.traceState&&x.set(h,n.TRACE_STATE_HEADER,w.traceState.serialize())}extract(u,h,x){let T=x.get(h,n.TRACE_PARENT_HEADER);if(!T)return u;let O=Array.isArray(T)?T[0]:T;if(typeof O!=`string`)return u;let A=w(O);if(!A)return u;A.isRemote=!0;let j=x.get(h,n.TRACE_STATE_HEADER);if(j){let n=Array.isArray(j)?j.join(`,`):j;A.traceState=new p.TraceState(typeof n==`string`?n:void 0)}return c.trace.setSpanContext(u,A)}fields(){return[n.TRACE_PARENT_HEADER,n.TRACE_STATE_HEADER]}}})),require_rpc_metadata=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getRPCMetadata=n.deleteRPCMetadata=n.setRPCMetadata=n.RPCType=void 0;let c=(0,(init_esm$2(),__toCommonJS(esm_exports$2)).createContextKey)(`OpenTelemetry SDK Context Key RPC_METADATA`);(function(n){n.HTTP=`http`})(n.RPCType||={});function u(n,u){return n.setValue(c,u)}n.setRPCMetadata=u;function p(n){return n.deleteValue(c)}n.deleteRPCMetadata=p;function h(n){return n.getValue(c)}n.getRPCMetadata=h})),require_lodash_merge=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPlainObject=void 0;let c=`[object Object]`,u=`[object Null]`,p=`[object Undefined]`,h=Function.prototype.toString,x=h.call(Object),w=Object.getPrototypeOf,T=Object.prototype,O=T.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,j=T.toString;function N(n){if(!I(n)||L(n)!==`[object Object]`)return!1;let c=w(n);if(c===null)return!0;let u=O.call(c,`constructor`)&&c.constructor;return typeof u==`function`&&u instanceof u&&h.call(u)===x}n.isPlainObject=N;function I(n){return typeof n==`object`&&!!n}function L(n){return n==null?n===void 0?`[object Undefined]`:`[object Null]`:A&&A in Object(n)?z(n):B(n)}function z(n){let c=O.call(n,A),u=n[A],p=!1;try{n[A]=void 0,p=!0}catch{}let h=j.call(n);return p&&(c?n[A]=u:delete n[A]),h}function B(n){return j.call(n)}})),require_merge=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.merge=void 0;let c=require_lodash_merge(),u=20;function p(...n){let c=n.shift(),u=new WeakMap;for(;n.length>0;)c=x(c,n.shift(),0,u);return c}n.merge=p;function h(n){return T(n)?n.slice():n}function x(n,c,u=0,p){let I;if(!(u>20)){if(u++,j(n)||j(c)||O(c))I=h(c);else if(T(n)){if(I=n.slice(),T(c))for(let n=0,u=c.length;n<u;n++)I.push(h(c[n]));else if(A(c)){let n=Object.keys(c);for(let u=0,p=n.length;u<p;u++){let p=n[u];p===`__proto__`||p===`constructor`||p===`prototype`||(I[p]=h(c[p]))}}}else if(A(n))if(A(c)){if(!N(n,c))return c;I=Object.assign({},n);let h=Object.keys(c);for(let T=0,O=h.length;T<O;T++){let O=h[T];if(O===`__proto__`||O===`constructor`||O===`prototype`)continue;let N=c[O];if(j(N))N===void 0?delete I[O]:I[O]=N;else{let h=I[O],T=N;if(w(n,O,p)||w(c,O,p))delete I[O];else{if(A(h)&&A(T)){let u=p.get(h)||[],x=p.get(T)||[];u.push({obj:n,key:O}),x.push({obj:c,key:O}),p.set(h,u),p.set(T,x)}I[O]=x(I[O],N,u,p)}}}}else I=c;return I}}function w(n,c,u){let p=u.get(n[c])||[];for(let u=0,h=p.length;u<h;u++){let h=p[u];if(h.key===c&&h.obj===n)return!0}return!1}function T(n){return Array.isArray(n)}function O(n){return typeof n==`function`}function A(n){return!j(n)&&!T(n)&&!O(n)&&typeof n==`object`}function j(n){return typeof n==`string`||typeof n==`number`||typeof n==`boolean`||n===void 0||n instanceof Date||n instanceof RegExp||n===null}function N(n,u){return!(!(0,c.isPlainObject)(n)||!(0,c.isPlainObject)(u))}})),require_timeout=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.callWithTimeout=n.TimeoutError=void 0;var c=class n extends Error{constructor(c){super(c),Object.setPrototypeOf(this,n.prototype)}};n.TimeoutError=c;function u(n,u){let p,h=new Promise(function(n,h){p=setTimeout(function(){h(new c(`Operation timed out.`))},u)});return Promise.race([n,h]).then(n=>(clearTimeout(p),n),n=>{throw clearTimeout(p),n})}n.callWithTimeout=u})),require_url=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isUrlIgnored=n.urlMatches=void 0;function c(n,c){return typeof c==`string`?n===c:!!n.match(c)}n.urlMatches=c;function u(n,u){if(!u)return!1;for(let p of u)if(c(n,p))return!0;return!1}n.isUrlIgnored=u})),require_promise=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Deferred=void 0,n.Deferred=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((n,c)=>{this._resolve=n,this._reject=c})}get promise(){return this._promise}resolve(n){this._resolve(n)}reject(n){this._reject(n)}}})),require_callback=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BindOnceFuture=void 0;let c=require_promise();n.BindOnceFuture=class{_isCalled=!1;_deferred=new c.Deferred;_callback;_that;constructor(n,c){this._callback=n,this._that=c}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...n){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...n)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}}})),require_configuration=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.diagLogLevelFromString=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u={ALL:c.DiagLogLevel.ALL,VERBOSE:c.DiagLogLevel.VERBOSE,DEBUG:c.DiagLogLevel.DEBUG,INFO:c.DiagLogLevel.INFO,WARN:c.DiagLogLevel.WARN,ERROR:c.DiagLogLevel.ERROR,NONE:c.DiagLogLevel.NONE};function p(n){return n==null?void 0:u[n.toUpperCase()]??(c.diag.warn(`Unknown log level "${n}", expected one of ${Object.keys(u)}, using default`),c.DiagLogLevel.INFO)}n.diagLogLevelFromString=p})),require_exporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._export=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_suppress_tracing();function p(n,p){return new Promise(h=>{c.context.with((0,u.suppressTracing)(c.context.active()),()=>{n.export(p,h)})})}n._export=p})),require_src$3=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.internal=n.diagLogLevelFromString=n.BindOnceFuture=n.urlMatches=n.isUrlIgnored=n.callWithTimeout=n.TimeoutError=n.merge=n.TraceState=n.unsuppressTracing=n.suppressTracing=n.isTracingSuppressed=n.setRPCMetadata=n.getRPCMetadata=n.deleteRPCMetadata=n.RPCType=n.parseTraceParent=n.W3CTraceContextPropagator=n.TRACE_STATE_HEADER=n.TRACE_PARENT_HEADER=n.CompositePropagator=n.otperformance=n.getStringListFromEnv=n.getNumberFromEnv=n.getBooleanFromEnv=n.getStringFromEnv=n._globalThis=n.SDK_INFO=n.parseKeyPairsIntoRecord=n.ExportResultCode=n.unrefTimer=n.timeInputToHrTime=n.millisToHrTime=n.isTimeInputHrTime=n.isTimeInput=n.hrTimeToTimeStamp=n.hrTimeToNanoseconds=n.hrTimeToMilliseconds=n.hrTimeToMicroseconds=n.hrTimeDuration=n.hrTime=n.getTimeOrigin=n.addHrTimes=n.loggingErrorHandler=n.setGlobalErrorHandler=n.globalErrorHandler=n.sanitizeAttributes=n.isAttributeValue=n.AnchoredClock=n.W3CBaggagePropagator=void 0;var c=require_W3CBaggagePropagator();Object.defineProperty(n,`W3CBaggagePropagator`,{enumerable:!0,get:function(){return c.W3CBaggagePropagator}});var u=require_anchored_clock();Object.defineProperty(n,`AnchoredClock`,{enumerable:!0,get:function(){return u.AnchoredClock}});var p=require_attributes();Object.defineProperty(n,`isAttributeValue`,{enumerable:!0,get:function(){return p.isAttributeValue}}),Object.defineProperty(n,`sanitizeAttributes`,{enumerable:!0,get:function(){return p.sanitizeAttributes}});var h=require_global_error_handler();Object.defineProperty(n,`globalErrorHandler`,{enumerable:!0,get:function(){return h.globalErrorHandler}}),Object.defineProperty(n,`setGlobalErrorHandler`,{enumerable:!0,get:function(){return h.setGlobalErrorHandler}});var x=require_logging_error_handler();Object.defineProperty(n,`loggingErrorHandler`,{enumerable:!0,get:function(){return x.loggingErrorHandler}});var w=require_time();Object.defineProperty(n,`addHrTimes`,{enumerable:!0,get:function(){return w.addHrTimes}}),Object.defineProperty(n,`getTimeOrigin`,{enumerable:!0,get:function(){return w.getTimeOrigin}}),Object.defineProperty(n,`hrTime`,{enumerable:!0,get:function(){return w.hrTime}}),Object.defineProperty(n,`hrTimeDuration`,{enumerable:!0,get:function(){return w.hrTimeDuration}}),Object.defineProperty(n,`hrTimeToMicroseconds`,{enumerable:!0,get:function(){return w.hrTimeToMicroseconds}}),Object.defineProperty(n,`hrTimeToMilliseconds`,{enumerable:!0,get:function(){return w.hrTimeToMilliseconds}}),Object.defineProperty(n,`hrTimeToNanoseconds`,{enumerable:!0,get:function(){return w.hrTimeToNanoseconds}}),Object.defineProperty(n,`hrTimeToTimeStamp`,{enumerable:!0,get:function(){return w.hrTimeToTimeStamp}}),Object.defineProperty(n,`isTimeInput`,{enumerable:!0,get:function(){return w.isTimeInput}}),Object.defineProperty(n,`isTimeInputHrTime`,{enumerable:!0,get:function(){return w.isTimeInputHrTime}}),Object.defineProperty(n,`millisToHrTime`,{enumerable:!0,get:function(){return w.millisToHrTime}}),Object.defineProperty(n,`timeInputToHrTime`,{enumerable:!0,get:function(){return w.timeInputToHrTime}});var T=require_timer_util();Object.defineProperty(n,`unrefTimer`,{enumerable:!0,get:function(){return T.unrefTimer}});var O=require_ExportResult();Object.defineProperty(n,`ExportResultCode`,{enumerable:!0,get:function(){return O.ExportResultCode}});var A=require_utils$2();Object.defineProperty(n,`parseKeyPairsIntoRecord`,{enumerable:!0,get:function(){return A.parseKeyPairsIntoRecord}});var j=require_platform$2();Object.defineProperty(n,`SDK_INFO`,{enumerable:!0,get:function(){return j.SDK_INFO}}),Object.defineProperty(n,`_globalThis`,{enumerable:!0,get:function(){return j._globalThis}}),Object.defineProperty(n,`getStringFromEnv`,{enumerable:!0,get:function(){return j.getStringFromEnv}}),Object.defineProperty(n,`getBooleanFromEnv`,{enumerable:!0,get:function(){return j.getBooleanFromEnv}}),Object.defineProperty(n,`getNumberFromEnv`,{enumerable:!0,get:function(){return j.getNumberFromEnv}}),Object.defineProperty(n,`getStringListFromEnv`,{enumerable:!0,get:function(){return j.getStringListFromEnv}}),Object.defineProperty(n,`otperformance`,{enumerable:!0,get:function(){return j.otperformance}});var N=require_composite();Object.defineProperty(n,`CompositePropagator`,{enumerable:!0,get:function(){return N.CompositePropagator}});var I=require_W3CTraceContextPropagator();Object.defineProperty(n,`TRACE_PARENT_HEADER`,{enumerable:!0,get:function(){return I.TRACE_PARENT_HEADER}}),Object.defineProperty(n,`TRACE_STATE_HEADER`,{enumerable:!0,get:function(){return I.TRACE_STATE_HEADER}}),Object.defineProperty(n,`W3CTraceContextPropagator`,{enumerable:!0,get:function(){return I.W3CTraceContextPropagator}}),Object.defineProperty(n,`parseTraceParent`,{enumerable:!0,get:function(){return I.parseTraceParent}});var L=require_rpc_metadata();Object.defineProperty(n,`RPCType`,{enumerable:!0,get:function(){return L.RPCType}}),Object.defineProperty(n,`deleteRPCMetadata`,{enumerable:!0,get:function(){return L.deleteRPCMetadata}}),Object.defineProperty(n,`getRPCMetadata`,{enumerable:!0,get:function(){return L.getRPCMetadata}}),Object.defineProperty(n,`setRPCMetadata`,{enumerable:!0,get:function(){return L.setRPCMetadata}});var z=require_suppress_tracing();Object.defineProperty(n,`isTracingSuppressed`,{enumerable:!0,get:function(){return z.isTracingSuppressed}}),Object.defineProperty(n,`suppressTracing`,{enumerable:!0,get:function(){return z.suppressTracing}}),Object.defineProperty(n,`unsuppressTracing`,{enumerable:!0,get:function(){return z.unsuppressTracing}});var B=require_TraceState();Object.defineProperty(n,`TraceState`,{enumerable:!0,get:function(){return B.TraceState}});var V=require_merge();Object.defineProperty(n,`merge`,{enumerable:!0,get:function(){return V.merge}});var H=require_timeout();Object.defineProperty(n,`TimeoutError`,{enumerable:!0,get:function(){return H.TimeoutError}}),Object.defineProperty(n,`callWithTimeout`,{enumerable:!0,get:function(){return H.callWithTimeout}});var U=require_url();Object.defineProperty(n,`isUrlIgnored`,{enumerable:!0,get:function(){return U.isUrlIgnored}}),Object.defineProperty(n,`urlMatches`,{enumerable:!0,get:function(){return U.urlMatches}});var W=require_callback();Object.defineProperty(n,`BindOnceFuture`,{enumerable:!0,get:function(){return W.BindOnceFuture}});var G=require_configuration();Object.defineProperty(n,`diagLogLevelFromString`,{enumerable:!0,get:function(){return G.diagLogLevelFromString}}),n.internal={_export:require_exporter()._export}})),require_default_service_name=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n._clearDefaultServiceNameCache=n.defaultServiceName=void 0;let c;function u(){if(c===void 0)try{let n=globalThis.process.argv0;c=n?`unknown_service:${n}`:`unknown_service`}catch{c=`unknown_service`}return c}n.defaultServiceName=u;function p(){c=void 0}n._clearDefaultServiceNameCache=p})),require_utils$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.isPromiseLike=void 0,n.isPromiseLike=n=>typeof n==`object`&&!!n&&typeof n.then==`function`})),require_ResourceImpl=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultResource=n.emptyResource=n.resourceFromDetectedResource=n.resourceFromAttributes=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_default_service_name(),x=require_utils$1();var w=class n{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(c,u){let p=new n({},u);return p._rawAttributes=N(c),p._asyncAttributesPending=c.filter(([n,c])=>(0,x.isPromiseLike)(c)).length>0,p}constructor(n,c){let u=n.attributes??{};this._rawAttributes=Object.entries(u).map(([n,c])=>((0,x.isPromiseLike)(c)&&(this._asyncAttributesPending=!0),[n,c])),this._rawAttributes=N(this._rawAttributes),this._schemaUrl=I(c?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let n=0;n<this._rawAttributes.length;n++){let[c,u]=this._rawAttributes[n];this._rawAttributes[n]=[c,(0,x.isPromiseLike)(u)?await u:u]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&c.diag.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let n={};for(let[u,p]of this._rawAttributes){if((0,x.isPromiseLike)(p)){c.diag.debug(`Unsettled resource attribute ${u} skipped`);continue}p!=null&&(n[u]??=p)}return this._asyncAttributesPending||(this._memoizedAttributes=n),n}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(c){if(c==null)return this;let u=L(this,c),p=u?{schemaUrl:u}:void 0;return n.FromAttributeList([...c.getRawAttributes(),...this.getRawAttributes()],p)}};function T(n,c){return w.FromAttributeList(Object.entries(n),c)}n.resourceFromAttributes=T;function O(n,c){return new w(n,c)}n.resourceFromDetectedResource=O;function A(){return T({})}n.emptyResource=A;function j(){return T({[p.ATTR_SERVICE_NAME]:(0,h.defaultServiceName)(),[p.ATTR_TELEMETRY_SDK_LANGUAGE]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_LANGUAGE],[p.ATTR_TELEMETRY_SDK_NAME]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_NAME],[p.ATTR_TELEMETRY_SDK_VERSION]:u.SDK_INFO[p.ATTR_TELEMETRY_SDK_VERSION]})}n.defaultResource=j;function N(n){return n.map(([n,u])=>(0,x.isPromiseLike)(u)?[n,u.catch(u=>{c.diag.debug(`promise rejection for resource attribute: %s - %s`,n,u)})]:[n,u])}function I(n){if(typeof n==`string`||n===void 0)return n;c.diag.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,n)}function L(n,u){let p=n?.schemaUrl,h=u?.schemaUrl,x=p===void 0||p===``,w=h===void 0||h===``;if(x)return h;if(w||p===h)return p;c.diag.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,p,h)}})),require_detect_resources=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.detectResources=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_ResourceImpl();n.detectResources=(n={})=>(n.detectors||[]).map(p=>{try{let h=(0,u.resourceFromDetectedResource)(p.detect(n));return c.diag.debug(`${p.constructor.name} found resource.`,h),h}catch(n){return c.diag.debug(`${p.constructor.name} failed: ${n.message}`),(0,u.emptyResource)()}}).reduce((n,c)=>n.merge(c),(0,u.emptyResource)())})),require_EnvDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.envDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=(init_esm$1(),__toCommonJS(esm_exports$1)),p=require_src$3();n.envDetector=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(n){let h={},x=(0,p.getStringFromEnv)(`OTEL_RESOURCE_ATTRIBUTES`),w=(0,p.getStringFromEnv)(`OTEL_SERVICE_NAME`);if(x)try{let n=this._parseResourceAttributes(x);Object.assign(h,n)}catch(n){c.diag.debug(`EnvDetector failed: ${n instanceof Error?n.message:n}`)}return w&&(h[u.ATTR_SERVICE_NAME]=w),{attributes:h}}_parseResourceAttributes(n){if(!n)return{};let c={},u=n.split(this._COMMA_SEPARATOR).filter(n=>n.trim()!==``);for(let n of u){let u=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(u.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[p,h]=u,x=p.trim(),w=h.trim();if(x.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let T,O;try{T=decodeURIComponent(x),O=decodeURIComponent(w)}catch(c){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": ${c instanceof Error?c.message:c}`)}if(T.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${T}".`);if(O.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${T}".`);c[T]=O}return c}}})),require_semconv$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ATTR_WEBENGINE_VERSION=n.ATTR_WEBENGINE_NAME=n.ATTR_WEBENGINE_DESCRIPTION=n.ATTR_SERVICE_NAMESPACE=n.ATTR_SERVICE_INSTANCE_ID=n.ATTR_PROCESS_RUNTIME_VERSION=n.ATTR_PROCESS_RUNTIME_NAME=n.ATTR_PROCESS_RUNTIME_DESCRIPTION=n.ATTR_PROCESS_PID=n.ATTR_PROCESS_OWNER=n.ATTR_PROCESS_EXECUTABLE_PATH=n.ATTR_PROCESS_EXECUTABLE_NAME=n.ATTR_PROCESS_COMMAND_ARGS=n.ATTR_PROCESS_COMMAND=n.ATTR_OS_VERSION=n.ATTR_OS_TYPE=n.ATTR_K8S_POD_NAME=n.ATTR_K8S_NAMESPACE_NAME=n.ATTR_K8S_DEPLOYMENT_NAME=n.ATTR_K8S_CLUSTER_NAME=n.ATTR_HOST_TYPE=n.ATTR_HOST_NAME=n.ATTR_HOST_IMAGE_VERSION=n.ATTR_HOST_IMAGE_NAME=n.ATTR_HOST_IMAGE_ID=n.ATTR_HOST_ID=n.ATTR_HOST_ARCH=n.ATTR_CONTAINER_NAME=n.ATTR_CONTAINER_IMAGE_TAGS=n.ATTR_CONTAINER_IMAGE_NAME=n.ATTR_CONTAINER_ID=n.ATTR_CLOUD_REGION=n.ATTR_CLOUD_PROVIDER=n.ATTR_CLOUD_AVAILABILITY_ZONE=n.ATTR_CLOUD_ACCOUNT_ID=void 0,n.ATTR_CLOUD_ACCOUNT_ID=`cloud.account.id`,n.ATTR_CLOUD_AVAILABILITY_ZONE=`cloud.availability_zone`,n.ATTR_CLOUD_PROVIDER=`cloud.provider`,n.ATTR_CLOUD_REGION=`cloud.region`,n.ATTR_CONTAINER_ID=`container.id`,n.ATTR_CONTAINER_IMAGE_NAME=`container.image.name`,n.ATTR_CONTAINER_IMAGE_TAGS=`container.image.tags`,n.ATTR_CONTAINER_NAME=`container.name`,n.ATTR_HOST_ARCH=`host.arch`,n.ATTR_HOST_ID=`host.id`,n.ATTR_HOST_IMAGE_ID=`host.image.id`,n.ATTR_HOST_IMAGE_NAME=`host.image.name`,n.ATTR_HOST_IMAGE_VERSION=`host.image.version`,n.ATTR_HOST_NAME=`host.name`,n.ATTR_HOST_TYPE=`host.type`,n.ATTR_K8S_CLUSTER_NAME=`k8s.cluster.name`,n.ATTR_K8S_DEPLOYMENT_NAME=`k8s.deployment.name`,n.ATTR_K8S_NAMESPACE_NAME=`k8s.namespace.name`,n.ATTR_K8S_POD_NAME=`k8s.pod.name`,n.ATTR_OS_TYPE=`os.type`,n.ATTR_OS_VERSION=`os.version`,n.ATTR_PROCESS_COMMAND=`process.command`,n.ATTR_PROCESS_COMMAND_ARGS=`process.command_args`,n.ATTR_PROCESS_EXECUTABLE_NAME=`process.executable.name`,n.ATTR_PROCESS_EXECUTABLE_PATH=`process.executable.path`,n.ATTR_PROCESS_OWNER=`process.owner`,n.ATTR_PROCESS_PID=`process.pid`,n.ATTR_PROCESS_RUNTIME_DESCRIPTION=`process.runtime.description`,n.ATTR_PROCESS_RUNTIME_NAME=`process.runtime.name`,n.ATTR_PROCESS_RUNTIME_VERSION=`process.runtime.version`,n.ATTR_SERVICE_INSTANCE_ID=`service.instance.id`,n.ATTR_SERVICE_NAMESPACE=`service.namespace`,n.ATTR_WEBENGINE_DESCRIPTION=`webengine.description`,n.ATTR_WEBENGINE_NAME=`webengine.name`,n.ATTR_WEBENGINE_VERSION=`webengine.version`})),require_getMachineId=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.getMachineId=void 0;let c=__require(`process`),u;async function p(){if(!u)switch(c.platform){case`darwin`:u=(await import(`./getMachineId-darwin-BVHajbu-.js`).then(n=>__toESM(n.default))).getMachineId;break;case`linux`:u=(await import(`./getMachineId-linux-DF4P4JAH.js`).then(n=>__toESM(n.default))).getMachineId;break;case`freebsd`:u=(await import(`./getMachineId-bsd-C9rTsHCB.js`).then(n=>__toESM(n.default))).getMachineId;break;case`win32`:u=(await import(`./getMachineId-win-DvS6eAIQ.js`).then(n=>__toESM(n.default))).getMachineId;break;default:u=(await import(`./getMachineId-unsupported-BHgtlyRW.js`).then(n=>__toESM(n.default))).getMachineId;break}return u()}n.getMachineId=p})),require_utils=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.normalizeType=n.normalizeArch=void 0,n.normalizeArch=n=>{switch(n){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return n}},n.normalizeType=n=>{switch(n){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return n}}})),require_HostDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.hostDetector=void 0;let c=require_semconv$1(),u=__require(`os`),p=require_getMachineId(),h=require_utils();n.hostDetector=new class{detect(n){return{attributes:{[c.ATTR_HOST_NAME]:(0,u.hostname)(),[c.ATTR_HOST_ARCH]:(0,h.normalizeArch)((0,u.arch)()),[c.ATTR_HOST_ID]:(0,p.getMachineId)()}}}}})),require_OSDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.osDetector=void 0;let c=require_semconv$1(),u=__require(`os`),p=require_utils();n.osDetector=new class{detect(n){return{attributes:{[c.ATTR_OS_TYPE]:(0,p.normalizeType)((0,u.platform)()),[c.ATTR_OS_VERSION]:(0,u.release)()}}}}})),require_ProcessDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.processDetector=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_semconv$1(),p=__require(`os`);n.processDetector=new class{detect(n){let h={[u.ATTR_PROCESS_PID]:process.pid,[u.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[u.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[u.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[u.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[u.ATTR_PROCESS_RUNTIME_NAME]:`nodejs`,[u.ATTR_PROCESS_RUNTIME_DESCRIPTION]:`Node.js`};process.argv.length>1&&(h[u.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=p.userInfo();h[u.ATTR_PROCESS_OWNER]=n.username}catch(n){c.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:h}}}})),require_ServiceInstanceIdDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=void 0;let c=require_semconv$1(),u=__require(`crypto`);n.serviceInstanceIdDetector=new class{detect(n){return{attributes:{[c.ATTR_SERVICE_INSTANCE_ID]:(0,u.randomUUID)()}}}}})),require_node$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_HostDetector();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}});var u=require_OSDetector();Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}});var p=require_ProcessDetector();Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return p.processDetector}});var h=require_ServiceInstanceIdDetector();Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return h.serviceInstanceIdDetector}})})),require_platform$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=void 0;var c=require_node$1();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return c.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return c.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return c.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return c.serviceInstanceIdDetector}})})),require_NoopDetector=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.NoopDetector=void 0;var c=class{detect(){return{attributes:{}}}};n.NoopDetector=c,n.noopDetector=new c})),require_detectors=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.noopDetector=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=void 0;var c=require_EnvDetector();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return c.envDetector}});var u=require_platform$1();Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_NoopDetector();Object.defineProperty(n,`noopDetector`,{enumerable:!0,get:function(){return p.noopDetector}})})),require_src$2=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.defaultServiceName=n.emptyResource=n.defaultResource=n.resourceFromAttributes=n.serviceInstanceIdDetector=n.processDetector=n.osDetector=n.hostDetector=n.envDetector=n.detectResources=void 0;var c=require_detect_resources();Object.defineProperty(n,`detectResources`,{enumerable:!0,get:function(){return c.detectResources}});var u=require_detectors();Object.defineProperty(n,`envDetector`,{enumerable:!0,get:function(){return u.envDetector}}),Object.defineProperty(n,`hostDetector`,{enumerable:!0,get:function(){return u.hostDetector}}),Object.defineProperty(n,`osDetector`,{enumerable:!0,get:function(){return u.osDetector}}),Object.defineProperty(n,`processDetector`,{enumerable:!0,get:function(){return u.processDetector}}),Object.defineProperty(n,`serviceInstanceIdDetector`,{enumerable:!0,get:function(){return u.serviceInstanceIdDetector}});var p=require_ResourceImpl();Object.defineProperty(n,`resourceFromAttributes`,{enumerable:!0,get:function(){return p.resourceFromAttributes}}),Object.defineProperty(n,`defaultResource`,{enumerable:!0,get:function(){return p.defaultResource}}),Object.defineProperty(n,`emptyResource`,{enumerable:!0,get:function(){return p.emptyResource}});var h=require_default_service_name();Object.defineProperty(n,`defaultServiceName`,{enumerable:!0,get:function(){return h.defaultServiceName}})})),require_enums=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ExceptionEventName=void 0,n.ExceptionEventName=`exception`})),require_Span=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SpanImpl=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=(init_esm$1(),__toCommonJS(esm_exports$1)),h=require_enums();n.SpanImpl=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(n){let c=Date.now();if(this._spanContext=n.spanContext,this._performanceStartTime=u.otperformance.now(),this._performanceOffset=c-(this._performanceStartTime+u.otperformance.timeOrigin),this._startTimeProvided=n.startTime!=null,this._spanLimits=n.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=n.spanProcessor,this.name=n.name,this.parentSpanContext=n.parentSpanContext,this.kind=n.kind,n.links)for(let c of n.links)this.addLink(c);this.startTime=this._getTime(n.startTime??c),this.resource=n.resource,this.instrumentationScope=n.scope,this._recordEndMetrics=n.recordEndMetrics,n.attributes!=null&&this.setAttributes(n.attributes),this._spanProcessor.onStart(this,n.context)}spanContext(){return this._spanContext}setAttribute(n,p){if(p==null||this._isSpanEnded())return this;if(n.length===0)return c.diag.warn(`Invalid attribute key: ${n}`),this;if(!(0,u.isAttributeValue)(p))return c.diag.warn(`Invalid attribute value set for key: ${n}`),this;let{attributeCountLimit:h}=this._spanLimits,x=!Object.prototype.hasOwnProperty.call(this.attributes,n);return h!==void 0&&this._attributesCount>=h&&x?(this._droppedAttributesCount++,this):(this.attributes[n]=this._truncateToSize(p),x&&this._attributesCount++,this)}setAttributes(n){for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&this.setAttribute(c,n[c]);return this}addEvent(n,p,h){if(this._isSpanEnded())return this;let{eventCountLimit:x}=this._spanLimits;if(x===0)return c.diag.warn(`No events allowed.`),this._droppedEventsCount++,this;x!==void 0&&this.events.length>=x&&(this._droppedEventsCount===0&&c.diag.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),(0,u.isTimeInput)(p)&&((0,u.isTimeInput)(h)||(h=p),p=void 0);let w=(0,u.sanitizeAttributes)(p),{attributePerEventCountLimit:T}=this._spanLimits,O={},A=0,j=0;for(let n in w){if(!Object.prototype.hasOwnProperty.call(w,n))continue;let c=w[n];if(T!==void 0&&j>=T){A++;continue}O[n]=this._truncateToSize(c),j++}return this.events.push({name:n,attributes:O,time:this._getTime(h),droppedAttributesCount:A}),this}addLink(n){if(this._isSpanEnded())return this;let{linkCountLimit:p}=this._spanLimits;if(p===0)return this._droppedLinksCount++,this;p!==void 0&&this.links.length>=p&&(this._droppedLinksCount===0&&c.diag.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:h}=this._spanLimits,x=(0,u.sanitizeAttributes)(n.attributes),w={},T=0,O=0;for(let n in x){if(!Object.prototype.hasOwnProperty.call(x,n))continue;let c=x[n];if(h!==void 0&&O>=h){T++;continue}w[n]=this._truncateToSize(c),O++}let A={context:n.context};return O>0&&(A.attributes=w),T>0&&(A.droppedAttributesCount=T),this.links.push(A),this}addLinks(n){for(let c of n)this.addLink(c);return this}setStatus(n){if(this._isSpanEnded()||n.code===c.SpanStatusCode.UNSET||this.status.code===c.SpanStatusCode.OK)return this;let u={code:n.code};return n.code===c.SpanStatusCode.ERROR&&(typeof n.message==`string`?u.message=n.message:n.message!=null&&c.diag.warn(`Dropping invalid status.message of type '${typeof n.message}', expected 'string'`)),this.status=u,this}updateName(n){return this._isSpanEnded()||(this.name=n),this}end(n){if(this._isSpanEnded()){c.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(n),this._duration=(0,u.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(c.diag.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(n){if(typeof n==`number`&&n<=u.otperformance.now())return(0,u.hrTime)(n+this._performanceOffset);if(typeof n==`number`)return(0,u.millisToHrTime)(n);if(n instanceof Date)return(0,u.millisToHrTime)(n.getTime());if((0,u.isTimeInputHrTime)(n))return n;if(this._startTimeProvided)return(0,u.millisToHrTime)(Date.now());let c=u.otperformance.now()-this._performanceStartTime;return(0,u.addHrTimes)(this.startTime,(0,u.millisToHrTime)(c))}isRecording(){return this._ended===!1}recordException(n,u){let x={};typeof n==`string`?x[p.ATTR_EXCEPTION_MESSAGE]=n:n&&(n.code?x[p.ATTR_EXCEPTION_TYPE]=n.code.toString():n.name&&(x[p.ATTR_EXCEPTION_TYPE]=n.name),n.message&&(x[p.ATTR_EXCEPTION_MESSAGE]=n.message),n.stack&&(x[p.ATTR_EXCEPTION_STACKTRACE]=n.stack)),x[p.ATTR_EXCEPTION_TYPE]||x[p.ATTR_EXCEPTION_MESSAGE]?this.addEvent(h.ExceptionEventName,x,u):c.diag.warn(`Failed to record an exception ${n}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let n=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,n)}return this._ended}_truncateToLimitUtil(n,c){return n.length<=c?n:n.substring(0,c)}_truncateToSize(n){let u=this._attributeValueLengthLimit;return u<=0?(c.diag.warn(`Attribute value limit must be positive, got ${u}`),n):typeof n==`string`?this._truncateToLimitUtil(n,u):Array.isArray(n)?n.map(n=>typeof n==`string`?this._truncateToLimitUtil(n,u):n):n}}})),require_Sampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=void 0,(function(n){n[n.NOT_RECORD=0]=`NOT_RECORD`,n[n.RECORD=1]=`RECORD`,n[n.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(n.SamplingDecision||={})})),require_AlwaysOffSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOffSampler=void 0;let c=require_Sampler();n.AlwaysOffSampler=class{shouldSample(){return{decision:c.SamplingDecision.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),require_AlwaysOnSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.AlwaysOnSampler=void 0;let c=require_Sampler();n.AlwaysOnSampler=class{shouldSample(){return{decision:c.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),require_ParentBasedSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ParentBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_AlwaysOffSampler(),h=require_AlwaysOnSampler();n.ParentBasedSampler=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(n){this._root=n.root,this._root||=((0,u.globalErrorHandler)(Error(`ParentBasedSampler must have a root sampler configured`)),new h.AlwaysOnSampler),this._remoteParentSampled=n.remoteParentSampled??new h.AlwaysOnSampler,this._remoteParentNotSampled=n.remoteParentNotSampled??new p.AlwaysOffSampler,this._localParentSampled=n.localParentSampled??new h.AlwaysOnSampler,this._localParentNotSampled=n.localParentNotSampled??new p.AlwaysOffSampler}shouldSample(n,u,p,h,x,w){let T=c.trace.getSpanContext(n);return!T||!(0,c.isSpanContextValid)(T)?this._root.shouldSample(n,u,p,h,x,w):T.isRemote?T.traceFlags&c.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(n,u,p,h,x,w):this._remoteParentNotSampled.shouldSample(n,u,p,h,x,w):T.traceFlags&c.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(n,u,p,h,x,w):this._localParentNotSampled.shouldSample(n,u,p,h,x,w)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),require_TraceIdRatioBasedSampler=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_Sampler();n.TraceIdRatioBasedSampler=class{_ratio;_upperBound;constructor(n=0){this._ratio=this._normalize(n),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(n,p){return{decision:(0,c.isValidTraceId)(p)&&this._accumulate(p)<this._upperBound?u.SamplingDecision.RECORD_AND_SAMPLED:u.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(n){return typeof n!=`number`||isNaN(n)?0:n>=1?1:n<=0?0:n}_accumulate(n){let c=0;for(let u=0;u<n.length/8;u++){let p=u*8,h=parseInt(n.slice(p,p+8),16);c=(c^h)>>>0}return c}}})),require_config=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.buildSamplerFromEnv=n.loadDefaultConfig=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_AlwaysOffSampler(),h=require_AlwaysOnSampler(),x=require_ParentBasedSampler(),w=require_TraceIdRatioBasedSampler();var T;(function(n){n.AlwaysOff=`always_off`,n.AlwaysOn=`always_on`,n.ParentBasedAlwaysOff=`parentbased_always_off`,n.ParentBasedAlwaysOn=`parentbased_always_on`,n.ParentBasedTraceIdRatio=`parentbased_traceidratio`,n.TraceIdRatio=`traceidratio`})(T||={});let O=1;function A(){return{sampler:j(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}n.loadDefaultConfig=A;function j(){let n=(0,u.getStringFromEnv)(`OTEL_TRACES_SAMPLER`)??T.ParentBasedAlwaysOn;switch(n){case T.AlwaysOn:return new h.AlwaysOnSampler;case T.AlwaysOff:return new p.AlwaysOffSampler;case T.ParentBasedAlwaysOn:return new x.ParentBasedSampler({root:new h.AlwaysOnSampler});case T.ParentBasedAlwaysOff:return new x.ParentBasedSampler({root:new p.AlwaysOffSampler});case T.TraceIdRatio:return new w.TraceIdRatioBasedSampler(N());case T.ParentBasedTraceIdRatio:return new x.ParentBasedSampler({root:new w.TraceIdRatioBasedSampler(N())});default:return c.diag.error(`OTEL_TRACES_SAMPLER value "${n}" invalid, defaulting to "${T.ParentBasedAlwaysOn}".`),new x.ParentBasedSampler({root:new h.AlwaysOnSampler})}}n.buildSamplerFromEnv=j;function N(){let n=(0,u.getNumberFromEnv)(`OTEL_TRACES_SAMPLER_ARG`);return n==null?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1):n<0||n>1?(c.diag.error(`OTEL_TRACES_SAMPLER_ARG=${n} was given, but it is out of range ([0..1]), defaulting to 1.`),1):n}})),require_utility=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.reconfigureLimits=n.mergeConfig=n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;let c=require_config(),u=require_src$3();n.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128,n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function p(n){let u={sampler:(0,c.buildSamplerFromEnv)()},p=(0,c.loadDefaultConfig)(),h=Object.assign({},p,u,n);return h.generalLimits=Object.assign({},p.generalLimits,n.generalLimits||{}),h.spanLimits=Object.assign({},p.spanLimits,n.spanLimits||{}),h}n.mergeConfig=p;function h(c){let p=Object.assign({},c.spanLimits);return p.attributeCountLimit=c.spanLimits?.attributeCountLimit??c.generalLimits?.attributeCountLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??n.DEFAULT_ATTRIBUTE_COUNT_LIMIT,p.attributeValueLengthLimit=c.spanLimits?.attributeValueLengthLimit??c.generalLimits?.attributeValueLengthLimit??(0,u.getNumberFromEnv)(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??(0,u.getNumberFromEnv)(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??n.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},c,{spanLimits:p})}n.reconfigureLimits=h})),require_BatchSpanProcessorBase=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessorBase=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3();n.BatchSpanProcessorBase=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(n,p){this._exporter=n,this._maxExportBatchSize=typeof p?.maxExportBatchSize==`number`?p.maxExportBatchSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`)??512,this._maxQueueSize=typeof p?.maxQueueSize==`number`?p.maxQueueSize:(0,u.getNumberFromEnv)(`OTEL_BSP_MAX_QUEUE_SIZE`)??2048,this._scheduledDelayMillis=typeof p?.scheduledDelayMillis==`number`?p.scheduledDelayMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_SCHEDULE_DELAY`)??5e3,this._exportTimeoutMillis=typeof p?.exportTimeoutMillis==`number`?p.exportTimeoutMillis:(0,u.getNumberFromEnv)(`OTEL_BSP_EXPORT_TIMEOUT`)??3e4,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.diag.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(n,c){}onEnd(n){this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)!==0&&this._addToBuffer(n)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(n){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&c.diag.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(c.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(n),this._maybeStartTimer()}_flushAll(){return new Promise((n,c)=>{let u=[],p=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,c=p;n<c;n++)u.push(this._flushOneBatch());Promise.all(u).then(()=>{n()}).catch(c)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((n,p)=>{let h=setTimeout(()=>{p(Error(`Timeout`))},this._exportTimeoutMillis);c.context.with((0,u.suppressTracing)(c.context.active()),()=>{let c;this._finishedSpans.length<=this._maxExportBatchSize?(c=this._finishedSpans,this._finishedSpans=[]):c=this._finishedSpans.splice(0,this._maxExportBatchSize);let x=()=>this._exporter.export(c,c=>{clearTimeout(h),c.code===u.ExportResultCode.SUCCESS?n():p(c.error??Error(`BatchSpanProcessor: span export failed`))}),w=null;for(let n=0,u=c.length;n<u;n++){let u=c[n];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(w??=[],w.push(u.resource.waitForAsyncAttributes()))}w===null?x():Promise.all(w).then(x,n=>{(0,u.globalErrorHandler)(n),p(n)})})})}_maybeStartTimer(){if(this._isExporting)return;let n=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,u.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return n();this._timer===void 0&&(this._timer=setTimeout(()=>n(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),require_BatchSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BatchSpanProcessor=void 0;let c=require_BatchSpanProcessorBase();n.BatchSpanProcessor=class extends c.BatchSpanProcessorBase{onShutdown(){}}})),require_RandomIdGenerator=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=void 0;let c=8,u=16;n.RandomIdGenerator=class{generateTraceId=h(16);generateSpanId=h(8)};let p=Buffer.allocUnsafe(16);function h(n){return function(){for(let c=0;c<n/4;c++)p.writeUInt32BE(Math.random()*2**32>>>0,c*4);for(let c=0;c<n&&!(p[c]>0);c++)c===n-1&&(p[n-1]=1);return p.toString(`hex`,0,n)}}})),require_node=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_BatchSpanProcessor();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}});var u=require_RandomIdGenerator();Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}})})),require_platform=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.RandomIdGenerator=n.BatchSpanProcessor=void 0;var c=require_node();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return c.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return c.RandomIdGenerator}})})),require_semconv=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.METRIC_OTEL_SDK_SPAN_STARTED=n.METRIC_OTEL_SDK_SPAN_LIVE=n.ATTR_OTEL_SPAN_SAMPLING_RESULT=n.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0,n.ATTR_OTEL_SPAN_PARENT_ORIGIN=`otel.span.parent.origin`,n.ATTR_OTEL_SPAN_SAMPLING_RESULT=`otel.span.sampling_result`,n.METRIC_OTEL_SDK_SPAN_LIVE=`otel.sdk.span.live`,n.METRIC_OTEL_SDK_SPAN_STARTED=`otel.sdk.span.started`})),require_TracerMetrics=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TracerMetrics=void 0;let c=require_Sampler(),u=require_semconv();n.TracerMetrics=class{startedSpans;liveSpans;constructor(n){this.startedSpans=n.createCounter(u.METRIC_OTEL_SDK_SPAN_STARTED,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=n.createUpDownCounter(u.METRIC_OTEL_SDK_SPAN_LIVE,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(n,x){let w=h(x);if(this.startedSpans.add(1,{[u.ATTR_OTEL_SPAN_PARENT_ORIGIN]:p(n),[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w}),x===c.SamplingDecision.NOT_RECORD)return()=>{};let T={[u.ATTR_OTEL_SPAN_SAMPLING_RESULT]:w};return this.liveSpans.add(1,T),()=>{this.liveSpans.add(-1,T)}}};function p(n){return n?n.isRemote?`remote`:`local`:`none`}function h(n){switch(n){case c.SamplingDecision.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case c.SamplingDecision.RECORD:return`RECORD_ONLY`;case c.SamplingDecision.NOT_RECORD:return`DROP`}}})),require_version=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.VERSION=void 0,n.VERSION=`2.7.0`})),require_Tracer=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.Tracer=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3(),p=require_Span(),h=require_utility(),x=require_platform(),w=require_TracerMetrics(),T=require_version();n.Tracer=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(n,u,p,O){let A=(0,h.mergeConfig)(u);this._sampler=A.sampler,this._generalLimits=A.generalLimits,this._spanLimits=A.spanLimits,this._idGenerator=u.idGenerator||new x.RandomIdGenerator,this._resource=p,this._spanProcessor=O,this.instrumentationScope=n;let j=A.meterProvider?A.meterProvider.getMeter(`@opentelemetry/sdk-trace`,T.VERSION):c.createNoopMeter();this._tracerMetrics=new w.TracerMetrics(j)}startSpan(n,h={},x=c.context.active()){h.root&&(x=c.trace.deleteSpan(x));let w=c.trace.getSpan(x);if((0,u.isTracingSuppressed)(x))return c.diag.debug(`Instrumentation suppressed, returning Noop Span`),c.trace.wrapSpanContext(c.INVALID_SPAN_CONTEXT);let T=w?.spanContext(),O=this._idGenerator.generateSpanId(),A,j,N;!T||!c.trace.isSpanContextValid(T)?j=this._idGenerator.generateTraceId():(j=T.traceId,N=T.traceState,A=T);let I=h.kind??c.SpanKind.INTERNAL,L=(h.links??[]).map(n=>({context:n.context,attributes:(0,u.sanitizeAttributes)(n.attributes)})),z=(0,u.sanitizeAttributes)(h.attributes),B=this._sampler.shouldSample(x,j,n,I,z,L),V=this._tracerMetrics.startSpan(T,B.decision);N=B.traceState??N;let H=B.decision===c.SamplingDecision.RECORD_AND_SAMPLED?c.TraceFlags.SAMPLED:c.TraceFlags.NONE,U={traceId:j,spanId:O,traceFlags:H,traceState:N};if(B.decision===c.SamplingDecision.NOT_RECORD)return c.diag.debug(`Recording is off, propagating context in a non-recording span`),c.trace.wrapSpanContext(U);let W=(0,u.sanitizeAttributes)(Object.assign(z,B.attributes));return new p.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:x,spanContext:U,name:n,kind:I,links:L,parentSpanContext:A,attributes:W,startTime:h.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:V})}startActiveSpan(n,u,p,h){let x,w,T;if(arguments.length<2)return;arguments.length===2?T=u:arguments.length===3?(x=u,T=p):(x=u,w=p,T=h);let O=w??c.context.active(),A=this.startSpan(n,x,O),j=c.trace.setSpan(O,A);return c.context.with(j,T,void 0,A)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),require_MultiSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.MultiSpanProcessor=void 0;let c=require_src$3();n.MultiSpanProcessor=class{_spanProcessors;constructor(n){this._spanProcessors=n}forceFlush(){let n=[];for(let c of this._spanProcessors)n.push(c.forceFlush());return new Promise(u=>{Promise.all(n).then(()=>{u()}).catch(n=>{(0,c.globalErrorHandler)(n||Error(`MultiSpanProcessor: forceFlush failed`)),u()})})}onStart(n,c){for(let u of this._spanProcessors)u.onStart(n,c)}onEnding(n){for(let c of this._spanProcessors)c.onEnding&&c.onEnding(n)}onEnd(n){for(let c of this._spanProcessors)c.onEnd(n)}shutdown(){let n=[];for(let c of this._spanProcessors)n.push(c.shutdown());return new Promise((c,u)=>{Promise.all(n).then(()=>{c()},u)})}}})),require_BasicTracerProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.BasicTracerProvider=n.ForceFlushState=void 0;let c=require_src$3(),u=require_src$2(),p=require_Tracer(),h=require_config(),x=require_MultiSpanProcessor(),w=require_utility();var T;(function(n){n[n.resolved=0]=`resolved`,n[n.timeout=1]=`timeout`,n[n.error=2]=`error`,n[n.unresolved=3]=`unresolved`})(T=n.ForceFlushState||={}),n.BasicTracerProvider=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(n={}){let p=(0,c.merge)({},(0,h.loadDefaultConfig)(),(0,w.reconfigureLimits)(n));this._resource=p.resource??(0,u.defaultResource)(),this._config=Object.assign({},p,{resource:this._resource});let T=[];n.spanProcessors?.length&&T.push(...n.spanProcessors),this._activeSpanProcessor=new x.MultiSpanProcessor(T)}getTracer(n,c,u){let h=`${n}@${c||``}:${u?.schemaUrl||``}`;return this._tracers.has(h)||this._tracers.set(h,new p.Tracer({name:n,version:c,schemaUrl:u?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(h)}forceFlush(){let n=this._config.forceFlushTimeoutMillis,c=this._activeSpanProcessor._spanProcessors.map(c=>new Promise(u=>{let p,h=setTimeout(()=>{u(Error(`Span processor did not completed within timeout period of ${n} ms`)),p=T.timeout},n);c.forceFlush().then(()=>{clearTimeout(h),p!==T.timeout&&(p=T.resolved,u(p))}).catch(n=>{clearTimeout(h),p=T.error,u(n)})}));return new Promise((n,u)=>{Promise.all(c).then(c=>{let p=c.filter(n=>n!==T.resolved);p.length>0?u(p):n()}).catch(n=>u([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),require_ConsoleSpanExporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.ConsoleSpanExporter=void 0;let c=require_src$3();n.ConsoleSpanExporter=class{export(n,c){return this._sendSpans(n,c)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(n){return{resource:{attributes:n.resource.attributes},instrumentationScope:n.instrumentationScope,traceId:n.spanContext().traceId,parentSpanContext:n.parentSpanContext,traceState:n.spanContext().traceState?.serialize(),name:n.name,id:n.spanContext().spanId,kind:n.kind,timestamp:(0,c.hrTimeToMicroseconds)(n.startTime),duration:(0,c.hrTimeToMicroseconds)(n.duration),attributes:n.attributes,status:n.status,events:n.events,links:n.links}}_sendSpans(n,u){for(let c of n)console.dir(this._exportInfo(c),{depth:3});if(u)return u({code:c.ExportResultCode.SUCCESS})}}})),require_InMemorySpanExporter=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.InMemorySpanExporter=void 0;let c=require_src$3();n.InMemorySpanExporter=class{_finishedSpans=[];_stopped=!1;export(n,u){if(this._stopped)return u({code:c.ExportResultCode.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...n),setTimeout(()=>u({code:c.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}})),require_SimpleSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SimpleSpanProcessor=void 0;let c=(init_esm$2(),__toCommonJS(esm_exports$2)),u=require_src$3();n.SimpleSpanProcessor=class{_exporter;_shutdownOnce;_pendingExports;constructor(n){this._exporter=n,this._shutdownOnce=new u.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(n,c){}onEnd(n){if(this._shutdownOnce.isCalled||(n.spanContext().traceFlags&c.TraceFlags.SAMPLED)===0)return;let p=this._doExport(n).catch(n=>(0,u.globalErrorHandler)(n));this._pendingExports.add(p),p.finally(()=>this._pendingExports.delete(p))}async _doExport(n){n.resource.asyncAttributesPending&&await n.resource.waitForAsyncAttributes?.();let c=await u.internal._export(this._exporter,[n]);if(c.code!==u.ExportResultCode.SUCCESS)throw c.error??Error(`SimpleSpanProcessor: span export failed (status ${c})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),require_NoopSpanProcessor=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NoopSpanProcessor=void 0,n.NoopSpanProcessor=class{onStart(n,c){}onEnd(n){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}})),require_src$1=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.SamplingDecision=n.TraceIdRatioBasedSampler=n.ParentBasedSampler=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NoopSpanProcessor=n.SimpleSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.RandomIdGenerator=n.BatchSpanProcessor=n.BasicTracerProvider=void 0;var c=require_BasicTracerProvider();Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return c.BasicTracerProvider}});var u=require_platform();Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}});var p=require_ConsoleSpanExporter();Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return p.ConsoleSpanExporter}});var h=require_InMemorySpanExporter();Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return h.InMemorySpanExporter}});var x=require_SimpleSpanProcessor();Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return x.SimpleSpanProcessor}});var w=require_NoopSpanProcessor();Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return w.NoopSpanProcessor}});var T=require_AlwaysOffSampler();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return T.AlwaysOffSampler}});var O=require_AlwaysOnSampler();Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return O.AlwaysOnSampler}});var A=require_ParentBasedSampler();Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return A.ParentBasedSampler}});var j=require_TraceIdRatioBasedSampler();Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return j.TraceIdRatioBasedSampler}});var N=require_Sampler();Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return N.SamplingDecision}})})),require_NodeTracerProvider=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.NodeTracerProvider=void 0;let c=require_src$15(),u=require_src$1(),p=(init_esm$2(),__toCommonJS(esm_exports$2)),h=require_src$3();function x(n){if(n!==null){if(n===void 0){let n=new c.AsyncLocalStorageContextManager;n.enable(),p.context.setGlobalContextManager(n);return}n.enable(),p.context.setGlobalContextManager(n)}}function w(n){if(n!==null){if(n===void 0){p.propagation.setGlobalPropagator(new h.CompositePropagator({propagators:[new h.W3CTraceContextPropagator,new h.W3CBaggagePropagator]}));return}p.propagation.setGlobalPropagator(n)}}n.NodeTracerProvider=class extends u.BasicTracerProvider{constructor(n={}){super(n)}register(n={}){p.trace.setGlobalTracerProvider(this),x(n.contextManager),w(n.propagator)}}})),require_src=__commonJSMin$1((n=>{Object.defineProperty(n,`__esModule`,{value:!0}),n.TraceIdRatioBasedSampler=n.SimpleSpanProcessor=n.SamplingDecision=n.RandomIdGenerator=n.ParentBasedSampler=n.NoopSpanProcessor=n.InMemorySpanExporter=n.ConsoleSpanExporter=n.BatchSpanProcessor=n.BasicTracerProvider=n.AlwaysOnSampler=n.AlwaysOffSampler=n.NodeTracerProvider=void 0;var c=require_NodeTracerProvider();Object.defineProperty(n,`NodeTracerProvider`,{enumerable:!0,get:function(){return c.NodeTracerProvider}});var u=require_src$1();Object.defineProperty(n,`AlwaysOffSampler`,{enumerable:!0,get:function(){return u.AlwaysOffSampler}}),Object.defineProperty(n,`AlwaysOnSampler`,{enumerable:!0,get:function(){return u.AlwaysOnSampler}}),Object.defineProperty(n,`BasicTracerProvider`,{enumerable:!0,get:function(){return u.BasicTracerProvider}}),Object.defineProperty(n,`BatchSpanProcessor`,{enumerable:!0,get:function(){return u.BatchSpanProcessor}}),Object.defineProperty(n,`ConsoleSpanExporter`,{enumerable:!0,get:function(){return u.ConsoleSpanExporter}}),Object.defineProperty(n,`InMemorySpanExporter`,{enumerable:!0,get:function(){return u.InMemorySpanExporter}}),Object.defineProperty(n,`NoopSpanProcessor`,{enumerable:!0,get:function(){return u.NoopSpanProcessor}}),Object.defineProperty(n,`ParentBasedSampler`,{enumerable:!0,get:function(){return u.ParentBasedSampler}}),Object.defineProperty(n,`RandomIdGenerator`,{enumerable:!0,get:function(){return u.RandomIdGenerator}}),Object.defineProperty(n,`SamplingDecision`,{enumerable:!0,get:function(){return u.SamplingDecision}}),Object.defineProperty(n,`SimpleSpanProcessor`,{enumerable:!0,get:function(){return u.SimpleSpanProcessor}}),Object.defineProperty(n,`TraceIdRatioBasedSampler`,{enumerable:!0,get:function(){return u.TraceIdRatioBasedSampler}})}));init_esm$2();var import_src=require_src$17(),import_src$1=require_src$16(),import_src$2=require_src$15(),import_src$3=require_src$18(),import_src$4=require_src$10(),import_src$5=require_src$9(),import_src$6=require_src$8(),import_src$7=require_src$7(),import_src$8=require_src$6(),import_src$9=require_src$5(),import_src$10=require_src$4(),import_src$11=require_src();const TRAILING_SLASH_PATTERN=/\/+$/,SIGNAL_SUFFIX_PATTERN=/\/v1\/(logs|metrics|traces)$/,normalizeOtlpSignalEndpoint=(n,c)=>{if(!n)throw Error(`OTEL_EXPORTER_OTLP_ENDPOINT is required when OTEL_ENABLED=true`);let u=n.replace(TRAILING_SLASH_PATTERN,``);return u.endsWith(`/v1/${c}`)?u:SIGNAL_SUFFIX_PATTERN.test(u)?u.replace(SIGNAL_SUFFIX_PATTERN,`/v1/${c}`):`${u}/v1/${c}`},parseOtlpHeaders=n=>{let c=n?.trim();return c?c.split(`,`).map(n=>n.trim()).filter(Boolean).reduce((n,c)=>{let u=c.indexOf(`=`);if(u<=0)return n;let p=c.slice(0,u).trim(),h=c.slice(u+1).trim();return!p||!h||(n[p]=h),n},{}):{}},scopeStorage=new AsyncLocalStorage,compactScopeAttributes=n=>{let c={};for(let[u,p]of Object.entries(n))p!=null&&(c[u]=p);return c},getCurrentScopeAttributes=()=>scopeStorage.getStore()??{},mergeScopeAttributes=(n,c)=>compactScopeAttributes({...n,...c}),runWithScopeAttributes=(n,c)=>{let u=mergeScopeAttributes(getCurrentScopeAttributes(),n);return scopeStorage.run(u,c)},normalizeError=n=>n instanceof Error?{message:n.message,name:n.name,...n.stack?{stack:n.stack}:{}}:{message:String(n),name:`Error`},toExceptionAttributes=n=>{let c=normalizeError(n.error),u=mergeScopeAttributes(getCurrentScopeAttributes(),n.attributes??{}),p={};for(let[n,c]of Object.entries(u))c!=null&&(p[n]=c);return p[`echo.exception.handled`]=n.handled,p[`echo.exception.level`]=n.level,p[`echo.exception.mechanism`]=n.mechanism,p[`error.message`]=c.message,p[`error.type`]=c.name,n.fingerprint&&n.fingerprint.length>0&&(p[`echo.exception.fingerprint`]=n.fingerprint.join(`,`)),p},setSpanErrorStatus=(n,c)=>{let u=normalizeError(c);n.setStatus({code:SpanStatusCode.ERROR,message:u.message})},recordExceptionOnSpan=(n,c)=>{let u=normalizeError(c.error);n.setAttributes(toExceptionAttributes(c)),n.recordException({message:u.message,name:u.name,...u.stack?{stack:u.stack}:{}}),setSpanErrorStatus(n,c.error)},captureExceptionAsSpan=n=>{let c={...n.exception,attributes:mergeScopeAttributes(n.spanAttributes??{},n.exception.attributes??{})},u=trace.getSpan(context$1.active());if(u){recordExceptionOnSpan(u,c);return}let p=trace.getTracer(n.serviceName).startSpan(n.spanName??`observability.exception`,{attributes:toExceptionAttributes(c)});recordExceptionOnSpan(p,c),p.end()},NODE_OTEL_RESOURCE_DETECTORS=[import_src.envDetector,import_src.processDetector,import_src.hostDetector,import_src.osDetector],buildNodeOtelResourceAttributes=n=>({"deployment.environment":n.environment,"echo.client_app":n.clientApp,"echo.runtime":n.runtime,"service.name":n.serviceName,"service.version":n.serviceVersion??`unknown`}),createNodeOtelResource=async n=>{let c=(0,import_src.defaultResource)().merge((0,import_src.detectResources)({detectors:NODE_OTEL_RESOURCE_DETECTORS})).merge((0,import_src.resourceFromAttributes)(buildNodeOtelResourceAttributes(n)));return await c.waitForAsyncAttributes?.(),c},DEFAULT_EXPORT_INTERVAL_MS=5e3,createNoopRuntimeHandle=n=>({forceFlush:async()=>{},shutdown:async()=>{},tracer:trace.getTracer(n)}),startNodeOtelRuntime=async n=>{if(n.sdk.debug&&diag.setLogger(new DiagConsoleLogger,DiagLogLevel.INFO),!n.sdk.enabled)return createNoopRuntimeHandle(n.resource.serviceName);let c=parseOtlpHeaders(n.sdk.exporterHeadersRaw),u=await createNodeOtelResource(n.resource),p=new import_src$11.NodeTracerProvider({resource:u,spanProcessors:[new import_src$10.BatchSpanProcessor(new import_src$6.OTLPTraceExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`traces`)}))],sampler:new import_src$10.TraceIdRatioBasedSampler(n.sdk.traceSamplingRatio)});p.register({contextManager:new import_src$2.AsyncLocalStorageContextManager,propagator:new import_src$3.CompositePropagator({propagators:[new import_src$3.W3CBaggagePropagator,new import_src$3.W3CTraceContextPropagator]})});let h=new import_src$9.MeterProvider({readers:[new import_src$9.PeriodicExportingMetricReader({exporter:new import_src$5.OTLPMetricExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`metrics`)}),exportIntervalMillis:DEFAULT_EXPORT_INTERVAL_MS})],resource:u});metrics.setGlobalMeterProvider(h);let x=new import_src$8.LoggerProvider({processors:[new import_src$8.BatchLogRecordProcessor(new import_src$4.OTLPLogExporter({headers:c,url:normalizeOtlpSignalEndpoint(n.sdk.exporterEndpoint,`logs`)}))],resource:u});import_src$1.logs.setGlobalLoggerProvider(x);let w=(0,import_src$7.registerInstrumentations)({instrumentations:n.instrumentations??[]}),T=!1;return{forceFlush:async()=>{await Promise.all([p.forceFlush(),h.forceFlush(),x.forceFlush()])},shutdown:async()=>{T||(T=!0,w(),await Promise.all([p.shutdown(),h.shutdown(),x.shutdown()]))},tracer:trace.getTracer(n.resource.serviceName)}},runWithNewSpan=async(n,c)=>{let u=trace.getTracer(n.serviceName),p=n.root?ROOT_CONTEXT:n.parentContext??context$1.active();return await context$1.with(p,async()=>await u.startActiveSpan(n.name,{attributes:n.attributes,kind:n.kind},async n=>{try{return await c()}catch(c){let u=normalizeError(c);throw n.recordException({message:u.message,name:u.name,...u.stack?{stack:u.stack}:{}}),setSpanErrorStatus(n,c),c}finally{n.end()}}))};let EchoNodeRuntime=function(n){return n.BACKEND=`backend`,n.CLI=`cli`,n.DESKTOP_MAIN=`desktop_main`,n}({}),EchoNodeClientApp=function(n){return n.ECHO_BACKEND=`echo-backend`,n.ECHO_CLI=`echo-cli`,n.ECHO_CLIENT=`echo-client`,n.ECHO_SKILLS_SERVICE=`echo-skills-service`,n}({}),NodeOtelExceptionMechanism=function(n){return n.BOOTSTRAP_FAILURE=`bootstrap_failure`,n.COMMAND_FAILURE=`command_failure`,n.IPC_FAILURE=`ipc_failure`,n.UNCAUGHT_EXCEPTION=`uncaughtException`,n.UNHANDLED_REJECTION=`unhandledRejection`,n.WINDOW_FAILURE=`window_failure`,n}({});const FLUSH_TIMEOUT_MS=1500,runtimeState={runtime:null,startPromise:null};let hasRegisteredProcessHandlers=!1;const parseBoolean=n=>{if(typeof n!=`string`)return!1;let c=trimAndLowercase(n);return c===`1`||c===`true`},getCliServiceName=()=>process.env.OTEL_SERVICE_NAME?.trim()||`cli`,getCliEnvironment=()=>process.env.OBSERVABILITY_ENVIRONMENT?.trim()||process.env.NODE_ENV?.trim()||`development`,getCliRuntime=()=>runtimeState.runtime??{backend:`none`},resolveCliObservabilityConfig=()=>({enabled:parseBoolean(process.env.OTEL_ENABLED),environment:getCliEnvironment(),exporterEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,exporterHeadersRaw:process.env.OTEL_EXPORTER_OTLP_HEADERS,serviceName:getCliServiceName(),serviceVersion:process.env.npm_package_version,traceSamplingRatio:Number(process.env.OTEL_TRACE_SAMPLING_RATIO??`1`)}),flushWithTimeout=async n=>{let c=getCliRuntime();if(c.backend===`none`)return!0;if(c.backend===`sentry`)return await getCliObservability().flush(n);try{return await Promise.race([c.handle.forceFlush(),new Promise((c,u)=>{setTimeout(()=>{u(Error(`cli otel flush timeout`))},n)})]),!0}catch{return!1}},captureCliOtelException=(n,c,u,p,h)=>{captureExceptionAsSpan({exception:{attributes:h,error:n,handled:u,level:p,mechanism:c},serviceName:getCliServiceName(),spanName:`cli.exception`})},captureCliSentryException=(n,c,u)=>{getCliObservability().captureException(n,{contexts:u?{cli:u}:void 0,level:c,tags:{crash_surface:`cli`}})},captureCliException=(n,c,u,p,h)=>{if(isExpectedNetworkLifecycleError(n))return;let x=getCliRuntime();if(x.backend===`sentry`){captureCliSentryException(n,p,h);return}x.backend===`otel`&&captureCliOtelException(n,c,u,p,h)},registerProcessHandlers=()=>{hasRegisteredProcessHandlers||=(process.on(`uncaughtException`,n=>{captureCliException(n,NodeOtelExceptionMechanism.UNCAUGHT_EXCEPTION,!1,`fatal`,{"echo.command.phase":`process`})}),process.on(`unhandledRejection`,n=>{captureCliException(n,NodeOtelExceptionMechanism.UNHANDLED_REJECTION,!1,`error`,{"echo.command.phase":`process`})}),!0)},startCliObservability=async()=>{if(runtimeState.runtime)return;if(runtimeState.startPromise){await runtimeState.startPromise.catch(()=>void 0);return}let n=(async()=>{let n=resolveCliNodeObservabilityBackendName();if(n===`sentry`)return getCliObservability(),registerProcessHandlers(),{backend:n};if(n===`none`)return registerProcessHandlers(),{backend:n};let c=resolveCliObservabilityConfig(),u=null;try{return u=await startNodeOtelRuntime({resource:{clientApp:EchoNodeClientApp.ECHO_CLI,environment:c.environment,runtime:EchoNodeRuntime.CLI,serviceName:c.serviceName,serviceVersion:c.serviceVersion},sdk:{enabled:c.enabled,exporterEndpoint:c.exporterEndpoint,exporterHeadersRaw:c.exporterHeadersRaw,traceSamplingRatio:c.traceSamplingRatio}}),registerProcessHandlers(),{backend:n,handle:u}}catch(n){throw u&&await u.shutdown().catch(()=>void 0),n}})();runtimeState.startPromise=n;try{runtimeState.runtime=await n}catch(n){console.warn(`Failed to start CLI observability; continuing without telemetry`,n),runtimeState.runtime=null}finally{runtimeState.startPromise===n&&(runtimeState.startPromise=null)}},shutdownCliObservability=async()=>{try{await runtimeState.startPromise}catch{}await flushWithTimeout(FLUSH_TIMEOUT_MS);let n=getCliRuntime();runtimeState.runtime=null,n.backend===`otel`&&await n.handle.shutdown().catch(()=>void 0)},reportCliCommandFailure=async(n,c)=>{captureCliException(n,NodeOtelExceptionMechanism.COMMAND_FAILURE,!0,`error`,{"echo.command.name":c}),await flushWithTimeout(FLUSH_TIMEOUT_MS)},runCliCommandSpan=async(n,c)=>{let u={"echo.command.cwd_basename":path.basename(n.cwd),"echo.command.interactive":n.interactive,"echo.command.name":n.commandName},p=getCliRuntime();if(p.backend===`sentry`){let p=getCliObservability().startSpan({attributes:u,name:`cli.command ${n.commandName}`,op:`cli.command`});try{let n=await c();return p.finish({status:`ok`}),n}catch(n){throw p.finish({status:`internal_error`}),n}}return p.backend===`otel`?await runWithScopeAttributes(u,async()=>await runWithNewSpan({attributes:u,name:`cli.command ${n.commandName}`,root:!0,serviceName:getCliServiceName()},c)):await c()},resolveCliCommandName=n=>{let c=n[0]?.trim();return!c||c.startsWith(`-`)?`default`:c},PREVENT_SLEEP_ARG=`--prevent-sleep`,resolvePreventSleepOption=n=>n.preventSleep===!0||n[`prevent-sleep`]===!0||process.argv.slice(2).includes(PREVENT_SLEEP_ARG)?!0:n.preventSleep??n[`prevent-sleep`],packageRoot=resolve(dirname(fileURLToPath(import.meta.url)),`..`),loadCliEnv=()=>{for(let n of[resolve(packageRoot,`.env`),resolve(packageRoot,`.env.local`),resolve(process.cwd(),`.env`),resolve(process.cwd(),`.env.local`)])existsSync(n)&&(0,import_main.config)({path:n,override:!1})},buildCli=()=>{let n=cac(CLI_BRAND.command);return n.usage(`[--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--non-interactive`,`Run headless login or runtime output`).option(`--skip-update-check`,`Skip update checks for this command`).option(`--token <token>`,`Bootstrap login token`).option(`--base-url <host[:port][/path]>`,`Backend host[:port][/path] without scheme`).option(`--ssl`,`Use SSL for derived HTTP/WebSocket endpoints`).option(`--method <method>`,`Login method for headless login (${LOGIN_METHOD_OPTIONS_TEXT})`),n.command(``,`Start the interactive TUI shell`).usage(`[--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).action(async n=>{if(n.nonInteractive)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);await runInteractiveApp({initialUpdateState:await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck}),baseUrl:n.baseUrl,ssl:n.ssl,token:n.token})}),n.command(`login`,`Headless login`).usage(`login --non-interactive [--token <token>] [--method <method>] [--base-url <host[:port][/path]>] [--no-ssl]`).action(async n=>{if(n.nonInteractive!==!0)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck}),await runNonInteractiveLoginCommand({baseUrl:n.baseUrl,method:n.method,ssl:n.ssl,token:n.token})}),n.command(`run`,`Headless runtime logs`).usage(`run --non-interactive [--prevent-sleep] [--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--prevent-sleep`,`On macOS, keep the system from idle sleeping while this run process is alive`).action(async n=>{if(n.nonInteractive!==!0)throw Error(`Use \`${CLI_BRAND.command} login --non-interactive ...\` or \`${CLI_BRAND.command} run --non-interactive ...\` for headless usage.`);let c=await enforceCliUpdatePolicy({skipUpdateCheck:n.skipUpdateCheck});await runNonInteractiveRunCommand({baseUrl:n.baseUrl,initialUpdateState:c,preventSleep:resolvePreventSleepOption(n),ssl:n.ssl,token:n.token})}),n.command(`logout`,`Clear the persisted CLI session`).usage(`logout`).action(async()=>{await runLogoutCommand()}),n.command(`service <action>`,`Manage the Syncless background service`).usage(`service <install|status|logs|stop|uninstall> [--token <token>] [--base-url <host[:port][/path]>] [--no-ssl]`).option(`--working-directory <path>`,`Working directory published by the service runtime`).option(`--enable-linger`,`Run loginctl enable-linger for the current user after systemd install`).action(async(n,c)=>{await runServiceCommand(n,{baseUrl:c.baseUrl,enableLinger:c.enableLinger===!0,ssl:c.ssl,token:c.token,workingDirectory:c.workingDirectory})}),n.command(`device <action> [deviceCode]`,`Manage the persisted device code`).usage(`device <set|clear> [deviceCode]`).action(async(n,c)=>{if(n===`set`){if(typeof c!=`string`||c.trim().length===0)throw Error(`Usage: ${CLI_BRAND.command} device set <deviceCode>`);await runDeviceSetCommand(c.trim());return}if(n===`clear`){if(typeof c==`string`&&c.trim().length>0)throw Error(`Usage: ${CLI_BRAND.command} device clear`);await runDeviceClearCommand();return}throw Error(`Unknown device command. Use \`${CLI_BRAND.command} device set <deviceCode>\` or \`${CLI_BRAND.command} device clear\`.`)}),n.help(n=>[...n,{title:`Notes`,body:[` \`${CLI_BRAND.command}\` starts the interactive TUI shell.`,` Headless usage is command-first: \`${CLI_BRAND.command} login --non-interactive\` or \`${CLI_BRAND.command} run --non-interactive\`.`,` Pass \`${CLI_BRAND.command} run --non-interactive --prevent-sleep\` or set \`${CLI_BRAND.envPrefix}_PREVENT_SLEEP=1\` to keep macOS from idle sleeping while a headless run is active.`,` Set \`${CLI_BRAND.envPrefix}_SKIP_UPDATE_CHECK=1\` or pass \`--skip-update-check\` to bypass update checks.`].join(`
|
|
500
501
|
`)}]),n},runCli=async(n=process.argv.slice(2))=>{loadCliEnv(),await startCliObservability();let c=buildCli();c.parse([process.execPath,CLI_BRAND.command,...n],{run:!1}),await runCliCommandSpan({commandName:resolveCliCommandName(n),cwd:process.cwd(),interactive:n.includes(`--non-interactive`)===!1},async()=>{await Promise.resolve(c.runMatchedCommand())})},fail=async n=>{isExpectedNetworkLifecycleError(n)&&(await shutdownCliObservability(),process.exit(0)),await reportCliCommandFailure(n,resolveCliCommandName(process.argv.slice(2))),n instanceof Error?console.error(`Error: ${n.message}`):console.error(`Error: ${String(n)}`),await shutdownCliObservability(),process.exit(1)};process.argv[1]&&resolve(process.argv[1])===fileURLToPath(import.meta.url)&&Promise.resolve(runCli()).then(async()=>{await shutdownCliObservability()}).catch(async n=>{await fail(n)});export{runCli};
|
|
501
|
-
//# debugId=
|
|
502
|
+
//# debugId=9a28fe3b-16c0-5dba-8b31-6c738c6b2685
|