@tanagram/lore 0.1.14 → 0.1.15
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/README.md +3 -2
- package/dist/index.js +75 -72
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,65 +1,94 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
3
|
-
var H9=Object.create;var s_=Object.defineProperty;var F9=Object.getOwnPropertyDescriptor;var V9=Object.getOwnPropertyNames;var q9=Object.getPrototypeOf,$9=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sg=(t,e)=>{for(var n in e)s_(t,n,{get:e[n],enumerable:!0})},kC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V9(e))!$9.call(t,o)&&o!==n&&s_(t,o,{get:()=>e[o],enumerable:!(r=F9(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?H9(q9(t)):{},kC(e||!t||!t.__esModule?s_(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>kC(s_({},"__esModule",{value:!0}),t);var Oo,ig=z(()=>{Oo="1.9.1"});function Y9(t){let e=new Set([t]),n=new Set,r=t.match(GC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(GC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var GC,BC,jC=z(()=>{ig();GC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;BC=Y9(Oo)});function jr(t,e,n,r=!1){var o;let s=gl[Sl]=(o=gl[Sl])!==null&&o!==void 0?o:{version:Oo};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==Oo){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Oo}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Oo}.`),!0}function Dn(t){var e,n;let r=(e=gl[Sl])===null||e===void 0?void 0:e.version;if(!(!r||!BC(r)))return(n=gl[Sl])===null||n===void 0?void 0:n[t]}function Hr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Oo}.`);let n=gl[Sl];n&&delete n[t]}var W9,Sl,gl,Oi=z(()=>{ig();jC();W9=Oo.split(".")[0],Sl=Symbol.for(`opentelemetry.js.api.${W9}`),gl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Al(t,e,n){let r=Dn("diag");if(r)return r[t](e,...n)}var i_,HC=z(()=>{Oi();i_=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Al("debug",this._namespace,e)}error(...e){return Al("error",this._namespace,e)}info(...e){return Al("info",this._namespace,e)}warn(...e){return Al("warn",this._namespace,e)}verbose(...e){return Al("verbose",this._namespace,e)}}});var dt,a_=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(dt||(dt={}))});function FC(t,e){t<dt.NONE?t=dt.NONE:t>dt.ALL&&(t=dt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",dt.ERROR),warn:n("warn",dt.WARN),info:n("info",dt.INFO),debug:n("debug",dt.DEBUG),verbose:n("verbose",dt.VERBOSE)}}var VC=z(()=>{a_()});var z9,St,Ni=z(()=>{HC();VC();a_();Oi();z9="diag",St=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=Dn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:dt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=Dn("diag"),p=FC((a=s.logLevel)!==null&&a!==void 0?a:dt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return jr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Hr(z9,n)},n.createComponentLogger=o=>new i_(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var c_,qC=z(()=>{c_=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var $C,YC=z(()=>{$C=Symbol("BaggageEntryMetadata")});function WC(t={}){return new c_(new Map(Object.entries(t)))}function zC(t){return typeof t!="string"&&(K9.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:$C,toString(){return t}}}var K9,ag=z(()=>{Ni();qC();YC();K9=St.instance()});function Un(t){return Symbol.for(t)}var cg,za,Rl=z(()=>{cg=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},za=new cg});var ug,lg,u_,KC=z(()=>{ug=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],lg={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(lg[e]=console[e])}u_=class{constructor(){function e(n){return function(...r){let o=lg[n];if(typeof o!="function"&&(o=lg.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<ug.length;n++)this[ug[n].n]=e(ug[n].c)}}});function QC(){return Sg}var pg,Ka,dg,_g,fg,mg,yl,hg,Tg,Eg,Sg,Q9,X9,J9,Z9,eQ,tQ,nQ,gg=z(()=>{pg=class{constructor(){}createGauge(e,n){return X9}createHistogram(e,n){return J9}createCounter(e,n){return Q9}createUpDownCounter(e,n){return Z9}createObservableGauge(e,n){return tQ}createObservableCounter(e,n){return eQ}createObservableUpDownCounter(e,n){return nQ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},Ka=class{},dg=class extends Ka{add(e,n){}},_g=class extends Ka{add(e,n){}},fg=class extends Ka{record(e,n){}},mg=class extends Ka{record(e,n){}},yl=class{addCallback(e){}removeCallback(e){}},hg=class extends yl{},Tg=class extends yl{},Eg=class extends yl{},Sg=new pg,Q9=new dg,X9=new fg,J9=new mg,Z9=new _g,eQ=new hg,tQ=new Tg,nQ=new Eg});var l_,XC=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(l_||(l_={}))});var p_,d_,Ag=z(()=>{p_={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},d_={set(t,e,n){t!=null&&(t[e]=n)}}});var __,JC=z(()=>{Rl();__=class{active(){return za}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var Rg,rQ,Fr,Il=z(()=>{JC();Oi();Ni();Rg="context",rQ=new __,Fr=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return jr(Rg,e,St.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return Dn(Rg)||rQ}disable(){this._getContextManager().disable(),Hr(Rg,St.instance())}}});var Vt,yg=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Vt||(Vt={}))});var Ol,bi,f_,m_=z(()=>{yg();Ol="0000000000000000",bi="00000000000000000000000000000000",f_={traceId:bi,spanId:Ol,traceFlags:Vt.NONE}});var Vr,h_=z(()=>{m_();Vr=class{constructor(e=f_){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function T_(t){return t.getValue(Ig)||void 0}function ZC(){return T_(Fr.getInstance().active())}function Nl(t,e){return t.setValue(Ig,e)}function eP(t){return t.deleteValue(Ig)}function tP(t,e){return Nl(t,new Vr(e))}function E_(t){var e;return(e=T_(t))===null||e===void 0?void 0:e.spanContext()}var Ig,Og=z(()=>{Rl();h_();Il();Ig=Un("OpenTelemetry Context Key SPAN")});function nP(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(S_[t.charCodeAt(r)]|0)+(S_[t.charCodeAt(r+1)]|0)+(S_[t.charCodeAt(r+2)]|0)+(S_[t.charCodeAt(r+3)]|0);return n===e}function Ng(t){return nP(t,32)&&t!==bi}function bg(t){return nP(t,16)&&t!==Ol}function No(t){return Ng(t.traceId)&&bg(t.spanId)}function rP(t){return new Vr(t)}var S_,g_=z(()=>{m_();h_();S_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function oQ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var Cg,Qa,Pg=z(()=>{Il();Og();h_();g_();Cg=Fr.getInstance(),Qa=class{startSpan(e,n,r=Cg.active()){if(!!n?.root)return new Vr;let s=r&&E_(r);return oQ(s)&&No(s)?new Vr(s):new Vr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Cg.active(),l=this.startSpan(e,s,c),p=Nl(c,l);return Cg.with(p,a,void 0,l)}}});var sQ,Xa,Mg=z(()=>{Pg();sQ=new Qa,Xa=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):sQ}}});var A_,oP=z(()=>{Pg();A_=class{getTracer(e,n,r){return new Qa}}});var iQ,Ci,xg=z(()=>{Mg();oP();iQ=new A_,Ci=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Xa(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:iQ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var R_,sP=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(R_||(R_={}))});var Ne,iP=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Ne||(Ne={}))});var Be,aP=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function cP(t){return uQ.test(t)}function uP(t){return lQ.test(t)&&!pQ.test(t)}var vg,aQ,cQ,uQ,lQ,pQ,lP=z(()=>{vg="[_0-9a-z-*/]",aQ=`[a-z]${vg}{0,255}`,cQ=`[a-z0-9]${vg}{0,240}@[a-z]${vg}{0,13}`,uQ=new RegExp(`^(?:${aQ}|${cQ})$`),lQ=/^[ -~]{0,255}[!-~]$/,pQ=/,|=/});var pP,dQ,dP,_P,y_,fP=z(()=>{lP();pP=32,dQ=512,dP=",",_P="=",y_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+_P+this.get(n)),e),[]).join(dP)}_parse(e){e.length>dQ||(this._internalState=e.split(dP).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(_P);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);cP(i)&&uP(a)&&n.set(i,a)}return n},new Map),this._internalState.size>pP&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pP))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function mP(t){return new y_(t)}var hP=z(()=>{fP()});var P,TP=z(()=>{Il();P=Fr.getInstance()});var wn,EP=z(()=>{Ni();wn=St.instance()});var Lg,SP,gP=z(()=>{gg();Lg=class{getMeter(e,n,r){return Sg}},SP=new Lg});var Dg,I_,AP=z(()=>{gP();Oi();Ni();Dg="metrics",I_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return jr(Dg,e,St.instance())}getMeterProvider(){return Dn(Dg)||SP}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Hr(Dg,St.instance())}}});var Ug,RP=z(()=>{AP();Ug=I_.getInstance()});var O_,yP=z(()=>{O_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function kg(t){return t.getValue(wg)||void 0}function IP(){return kg(Fr.getInstance().active())}function OP(t,e){return t.setValue(wg,e)}function NP(t){return t.deleteValue(wg)}var wg,bP=z(()=>{Il();Rl();wg=Un("OpenTelemetry Baggage Key")});var Gg,_Q,N_,CP=z(()=>{Oi();yP();Ag();bP();ag();Ni();Gg="propagation",_Q=new O_,N_=class t{constructor(){this.createBaggage=WC,this.getBaggage=kg,this.getActiveBaggage=IP,this.setBaggage=OP,this.deleteBaggage=NP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return jr(Gg,e,St.instance())}inject(e,n,r=d_){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=p_){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Hr(Gg,St.instance())}_getGlobalPropagator(){return Dn(Gg)||_Q}}});var Ar,PP=z(()=>{CP();Ar=N_.getInstance()});var Bg,b_,MP=z(()=>{Oi();xg();g_();Og();Ni();Bg="trace",b_=class t{constructor(){this._proxyTracerProvider=new Ci,this.wrapSpanContext=rP,this.isSpanContextValid=No,this.deleteSpan=eP,this.getSpan=T_,this.getActiveSpan=ZC,this.getSpanContext=E_,this.setSpan=Nl,this.setSpanContext=tP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=jr(Bg,this._proxyTracerProvider,St.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return Dn(Bg)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Hr(Bg,St.instance()),this._proxyTracerProvider=new Ci}}});var X,xP=z(()=>{MP();X=b_.getInstance()});var v={};sg(v,{DiagConsoleLogger:()=>u_,DiagLogLevel:()=>dt,INVALID_SPANID:()=>Ol,INVALID_SPAN_CONTEXT:()=>f_,INVALID_TRACEID:()=>bi,ProxyTracer:()=>Xa,ProxyTracerProvider:()=>Ci,ROOT_CONTEXT:()=>za,SamplingDecision:()=>R_,SpanKind:()=>Ne,SpanStatusCode:()=>Be,TraceFlags:()=>Vt,ValueType:()=>l_,baggageEntryMetadataFromString:()=>zC,context:()=>P,createContextKey:()=>Un,createNoopMeter:()=>QC,createTraceState:()=>mP,default:()=>fQ,defaultTextMapGetter:()=>p_,defaultTextMapSetter:()=>d_,diag:()=>wn,isSpanContextValid:()=>No,isValidSpanId:()=>bg,isValidTraceId:()=>Ng,metrics:()=>Ug,propagation:()=>Ar,trace:()=>X});var fQ,b=z(()=>{ag();Rl();KC();a_();gg();XC();Ag();Mg();xg();sP();iP();aP();yg();hP();g_();m_();TP();EP();RP();PP();xP();fQ={context:P,diag:wn,metrics:Ug,propagation:Ar,trace:X}});var bl=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isTracingSuppressed=is.unsuppressTracing=is.suppressTracing=void 0;var mQ=(b(),O(v)),jg=(0,mQ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function hQ(t){return t.setValue(jg,!0)}is.suppressTracing=hQ;function TQ(t){return t.deleteValue(jg)}is.unsuppressTracing=TQ;function EQ(t){return t.getValue(jg)===!0}is.isTracingSuppressed=EQ});var Hg=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.BAGGAGE_MAX_TOTAL_LENGTH=qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=qt.BAGGAGE_HEADER=qt.BAGGAGE_ITEMS_SEPARATOR=qt.BAGGAGE_PROPERTIES_SEPARATOR=qt.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;qt.BAGGAGE_KEY_PAIR_SEPARATOR="=";qt.BAGGAGE_PROPERTIES_SEPARATOR=";";qt.BAGGAGE_ITEMS_SEPARATOR=",";qt.BAGGAGE_HEADER="baggage";qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;qt.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Fg=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.parseKeyPairsIntoRecord=qr.parsePairKeyValue=qr.getKeyPairs=qr.serializeKeyPairs=void 0;var SQ=(b(),O(v)),Ja=Hg();function gQ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Ja.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Ja.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}qr.serializeKeyPairs=gQ;function AQ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Ja.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}qr.getKeyPairs=AQ;function vP(t){if(!t)return;let e=t.indexOf(Ja.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Ja.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,SQ.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}qr.parsePairKeyValue=vP;function RQ(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Ja.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=vP(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}qr.parseKeyPairsIntoRecord=RQ});var LP=E(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});C_.W3CBaggagePropagator=void 0;var Vg=(b(),O(v)),yQ=bl(),Pi=Hg(),qg=Fg(),$g=class{inject(e,n,r){let o=Vg.propagation.getBaggage(e);if(!o||(0,yQ.isTracingSuppressed)(e))return;let s=(0,qg.getKeyPairs)(o).filter(a=>a.length<=Pi.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Pi.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,qg.serializeKeyPairs)(s);i.length>0&&r.set(n,Pi.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Pi.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Pi.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Pi.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,qg.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:Vg.propagation.setBaggage(e,Vg.propagation.createBaggage(i))}fields(){return[Pi.BAGGAGE_HEADER]}};C_.W3CBaggagePropagator=$g});var DP=E(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.AnchoredClock=void 0;var Yg=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};P_.AnchoredClock=Yg});var BP=E(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isAttributeValue=as.isAttributeKey=as.sanitizeAttributes=void 0;var UP=(b(),O(v));function IQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!wP(n)){UP.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!kP(r)){UP.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}as.sanitizeAttributes=IQ;function wP(t){return typeof t=="string"&&t!==""}as.isAttributeKey=wP;function kP(t){return t==null?!0:Array.isArray(t)?OQ(t):GP(typeof t)}as.isAttributeValue=kP;function OQ(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(GP(r)){e=r;continue}return!1}return!1}}return!0}function GP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Wg=E(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_.loggingErrorHandler=void 0;var NQ=(b(),O(v));function bQ(){return t=>{NQ.diag.error(CQ(t))}}M_.loggingErrorHandler=bQ;function CQ(t){return typeof t=="string"?t:JSON.stringify(PQ(t))}function PQ(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var HP=E(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.globalErrorHandler=Za.setGlobalErrorHandler=void 0;var MQ=Wg(),jP=(0,MQ.loggingErrorHandler)();function xQ(t){jP=t}Za.setGlobalErrorHandler=xQ;function vQ(t){try{jP(t)}catch{}}Za.globalErrorHandler=vQ});var $P=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getStringListFromEnv=$r.getBooleanFromEnv=$r.getStringFromEnv=$r.getNumberFromEnv=void 0;var FP=(b(),O(v)),VP=U("util");function LQ(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}$r.getNumberFromEnv=LQ;function qP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$r.getStringFromEnv=qP;function DQ(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$r.getBooleanFromEnv=DQ;function UQ(t){return qP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$r.getStringListFromEnv=UQ});var YP=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_._globalThis=void 0;x_._globalThis=globalThis});var WP=E(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});v_.VERSION=void 0;v_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var zg=z(()=>{});var zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,wQ,Kg,kQ,GQ,BQ,jQ,Qg,HQ,FQ,VQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,JQ,ZQ,eX,tX,nX,rX,oX,Xg,sX,iX,aX,cX,uX,lX,pX,dX,_X,fX,mX,hX,Jg,TX,EX,Zg,eA,SX,gX,AX,RX,yX,IX,OX,NX,bX,CX,PX,MX,xX,vX,LX,DX,UX,Cl,ec,tA,wX,kX,Mi,GX,BX,jX,HX,nA,rA,FX,oA,VX,qX,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,uJ,lJ,pJ,sA,dJ,_J,fJ,mJ,hJ,TJ,EJ,SJ,gJ,AJ,RJ,yJ,IJ,OJ,NJ,bJ,CJ,PJ,MJ,iA,xJ,aA,vJ,LJ,DJ,UJ,wJ,kJ,GJ,BJ,jJ,fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,HJ,FJ,VJ,qJ,$J,YJ,WJ,zJ,KJ,QJ,XJ,JJ,ZJ,e5,t5,n5,r5,o5,s5,i5,a5,c5,u5,l5,p5,d5,_5,f5,m5,h5,T5,E5,S5,g5,A5,R5,y5,I5,O5,N5,b5,C5,P5,M5,x5,v5,L5,D5,aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL,U5,w5,k5,G5,B5,j5,H5,F5,V5,q5,$5,Y5,EL,SL,gL,AL,RL,W5,z5,K5,Q5,X5,J5,yL,IL,OL,Z5,eZ,tZ,nZ,NL,bL,CL,PL,rZ,oZ,sZ,iZ,aZ,ML,xL,vL,LL,DL,UL,wL,cZ,uZ,lZ,pZ,dZ,_Z,fZ,mZ,kL,GL,BL,jL,HL,hZ,TZ,EZ,SZ,gZ,AZ,FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,RZ,yZ,IZ,OZ,NZ,bZ,CZ,PZ,MZ,xZ,vZ,LZ,DZ,UZ,wZ,kZ,GZ,BZ,jZ,HZ,FZ,VZ,u0,l0,p0,d0,_0,qZ,$Z,YZ,WZ,zZ,KZ,f0,m0,QZ,XZ,JZ,h0,T0,ZZ,e6,t6,E0,S0,g0,A0,R0,y0,I0,O0,N0,b0,C0,P0,M0,x0,v0,L0,D0,n6,r6,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,h6,T6,E6,S6,U0,w0,g6,A6,R6,k0=z(()=>{zg();zP="aws.lambda.invoked_arn",KP="db.system",QP="db.connection_string",XP="db.user",JP="db.jdbc.driver_classname",ZP="db.name",eM="db.statement",tM="db.operation",nM="db.mssql.instance_name",rM="db.cassandra.keyspace",oM="db.cassandra.page_size",sM="db.cassandra.consistency_level",iM="db.cassandra.table",aM="db.cassandra.idempotence",cM="db.cassandra.speculative_execution_count",uM="db.cassandra.coordinator.id",lM="db.cassandra.coordinator.dc",pM="db.hbase.namespace",dM="db.redis.database_index",_M="db.mongodb.collection",fM="db.sql.table",mM="exception.type",hM="exception.message",TM="exception.stacktrace",EM="exception.escaped",SM="faas.trigger",gM="faas.execution",AM="faas.document.collection",RM="faas.document.operation",yM="faas.document.time",IM="faas.document.name",OM="faas.time",NM="faas.cron",bM="faas.coldstart",CM="faas.invoked_name",PM="faas.invoked_provider",MM="faas.invoked_region",xM="net.transport",vM="net.peer.ip",LM="net.peer.port",DM="net.peer.name",UM="net.host.ip",wM="net.host.port",kM="net.host.name",GM="net.host.connection.type",BM="net.host.connection.subtype",jM="net.host.carrier.name",HM="net.host.carrier.mcc",FM="net.host.carrier.mnc",VM="net.host.carrier.icc",qM="peer.service",$M="enduser.id",YM="enduser.role",WM="enduser.scope",zM="thread.id",KM="thread.name",QM="code.function",XM="code.namespace",JM="code.filepath",ZM="code.lineno",ex="http.method",tx="http.url",nx="http.target",rx="http.host",ox="http.scheme",sx="http.status_code",ix="http.flavor",ax="http.user_agent",cx="http.request_content_length",ux="http.request_content_length_uncompressed",lx="http.response_content_length",px="http.response_content_length_uncompressed",dx="http.server_name",_x="http.route",fx="http.client_ip",mx="aws.dynamodb.table_names",hx="aws.dynamodb.consumed_capacity",Tx="aws.dynamodb.item_collection_metrics",Ex="aws.dynamodb.provisioned_read_capacity",Sx="aws.dynamodb.provisioned_write_capacity",gx="aws.dynamodb.consistent_read",Ax="aws.dynamodb.projection",Rx="aws.dynamodb.limit",yx="aws.dynamodb.attributes_to_get",Ix="aws.dynamodb.index_name",Ox="aws.dynamodb.select",Nx="aws.dynamodb.global_secondary_indexes",bx="aws.dynamodb.local_secondary_indexes",Cx="aws.dynamodb.exclusive_start_table",Px="aws.dynamodb.table_count",Mx="aws.dynamodb.scan_forward",xx="aws.dynamodb.segment",vx="aws.dynamodb.total_segments",Lx="aws.dynamodb.count",Dx="aws.dynamodb.scanned_count",Ux="aws.dynamodb.attribute_definitions",wx="aws.dynamodb.global_secondary_index_updates",kx="messaging.system",Gx="messaging.destination",Bx="messaging.destination_kind",jx="messaging.temp_destination",Hx="messaging.protocol",Fx="messaging.protocol_version",Vx="messaging.url",qx="messaging.message_id",$x="messaging.conversation_id",Yx="messaging.message_payload_size_bytes",Wx="messaging.message_payload_compressed_size_bytes",zx="messaging.operation",Kx="messaging.consumer_id",Qx="messaging.rabbitmq.routing_key",Xx="messaging.kafka.message_key",Jx="messaging.kafka.consumer_group",Zx="messaging.kafka.client_id",ev="messaging.kafka.partition",tv="messaging.kafka.tombstone",nv="rpc.system",rv="rpc.service",ov="rpc.method",sv="rpc.grpc.status_code",iv="rpc.jsonrpc.version",av="rpc.jsonrpc.request_id",cv="rpc.jsonrpc.error_code",uv="rpc.jsonrpc.error_message",lv="message.type",pv="message.id",dv="message.compressed_size",_v="message.uncompressed_size",wQ=zP,Kg=KP,kQ=QP,GQ=XP,BQ=JP,jQ=ZP,Qg=eM,HQ=tM,FQ=nM,VQ=rM,qQ=oM,$Q=sM,YQ=iM,WQ=aM,zQ=cM,KQ=uM,QQ=lM,XQ=pM,JQ=dM,ZQ=_M,eX=fM,tX=mM,nX=hM,rX=TM,oX=EM,Xg=SM,sX=gM,iX=AM,aX=RM,cX=yM,uX=IM,lX=OM,pX=NM,dX=bM,_X=CM,fX=PM,mX=MM,hX=xM,Jg=vM,TX=LM,EX=DM,Zg=UM,eA=wM,SX=kM,gX=GM,AX=BM,RX=jM,yX=HM,IX=FM,OX=VM,NX=qM,bX=$M,CX=YM,PX=WM,MX=zM,xX=KM,vX=QM,LX=XM,DX=JM,UX=ZM,Cl=ex,ec=tx,tA=nx,wX=rx,kX=ox,Mi=sx,GX=ix,BX=ax,jX=cx,HX=ux,nA=lx,rA=px,FX=dx,oA=_x,VX=fx,qX=mx,$X=hx,YX=Tx,WX=Ex,zX=Sx,KX=gx,QX=Ax,XX=Rx,JX=yx,ZX=Ix,eJ=Ox,tJ=Nx,nJ=bx,rJ=Cx,oJ=Px,sJ=Mx,iJ=xx,aJ=vx,cJ=Lx,uJ=Dx,lJ=Ux,pJ=wx,sA=kx,dJ=Gx,_J=Bx,fJ=jx,mJ=Hx,hJ=Fx,TJ=Vx,EJ=qx,SJ=$x,gJ=Yx,AJ=Wx,RJ=zx,yJ=Kx,IJ=Qx,OJ=Xx,NJ=Jx,bJ=Zx,CJ=ev,PJ=tv,MJ=nv,iA=rv,xJ=ov,aA=sv,vJ=iv,LJ=av,DJ=cv,UJ=uv,wJ=lv,kJ=pv,GJ=dv,BJ=_v,jJ=We([zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v]),fv="other_sql",mv="mssql",hv="mysql",Tv="oracle",Ev="db2",Sv="postgresql",gv="redshift",Av="hive",Rv="cloudscape",yv="hsqldb",Iv="progress",Ov="maxdb",Nv="hanadb",bv="ingres",Cv="firstsql",Pv="edb",Mv="cache",xv="adabas",vv="firebird",Lv="derby",Dv="filemaker",Uv="informix",wv="instantdb",kv="interbase",Gv="mariadb",Bv="netezza",jv="pervasive",Hv="pointbase",Fv="sqlite",Vv="sybase",qv="teradata",$v="vertica",Yv="h2",Wv="coldfusion",zv="cassandra",Kv="hbase",Qv="mongodb",Xv="redis",Jv="couchbase",Zv="couchdb",eL="cosmosdb",tL="dynamodb",nL="neo4j",rL="geode",oL="elasticsearch",sL="memcached",iL="cockroachdb",HJ=fv,FJ=mv,VJ=hv,qJ=Tv,$J=Ev,YJ=Sv,WJ=gv,zJ=Av,KJ=Rv,QJ=yv,XJ=Iv,JJ=Ov,ZJ=Nv,e5=bv,t5=Cv,n5=Pv,r5=Mv,o5=xv,s5=vv,i5=Lv,a5=Dv,c5=Uv,u5=wv,l5=kv,p5=Gv,d5=Bv,_5=jv,f5=Hv,m5=Fv,h5=Vv,T5=qv,E5=$v,S5=Yv,g5=Wv,A5=zv,R5=Kv,y5=Qv,I5=Xv,O5=Jv,N5=Zv,b5=eL,C5=tL,P5=nL,M5=rL,x5=oL,v5=sL,L5=iL,D5=We([fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL]),aL="all",cL="each_quorum",uL="quorum",lL="local_quorum",pL="one",dL="two",_L="three",fL="local_one",mL="any",hL="serial",TL="local_serial",U5=aL,w5=cL,k5=uL,G5=lL,B5=pL,j5=dL,H5=_L,F5=fL,V5=mL,q5=hL,$5=TL,Y5=We([aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL]),EL="datasource",SL="http",gL="pubsub",AL="timer",RL="other",W5=EL,z5=SL,K5=gL,Q5=AL,X5=RL,J5=We([EL,SL,gL,AL,RL]),yL="insert",IL="edit",OL="delete",Z5=yL,eZ=IL,tZ=OL,nZ=We([yL,IL,OL]),NL="alibaba_cloud",bL="aws",CL="azure",PL="gcp",rZ=NL,oZ=bL,sZ=CL,iZ=PL,aZ=We([NL,bL,CL,PL]),ML="ip_tcp",xL="ip_udp",vL="ip",LL="unix",DL="pipe",UL="inproc",wL="other",cZ=ML,uZ=xL,lZ=vL,pZ=LL,dZ=DL,_Z=UL,fZ=wL,mZ=We([ML,xL,vL,LL,DL,UL,wL]),kL="wifi",GL="wired",BL="cell",jL="unavailable",HL="unknown",hZ=kL,TZ=GL,EZ=BL,SZ=jL,gZ=HL,AZ=We([kL,GL,BL,jL,HL]),FL="gprs",VL="edge",qL="umts",$L="cdma",YL="evdo_0",WL="evdo_a",zL="cdma2000_1xrtt",KL="hsdpa",QL="hsupa",XL="hspa",JL="iden",ZL="evdo_b",e0="lte",t0="ehrpd",n0="hspap",r0="gsm",o0="td_scdma",s0="iwlan",i0="nr",a0="nrnsa",c0="lte_ca",RZ=FL,yZ=VL,IZ=qL,OZ=$L,NZ=YL,bZ=WL,CZ=zL,PZ=KL,MZ=QL,xZ=XL,vZ=JL,LZ=ZL,DZ=e0,UZ=t0,wZ=n0,kZ=r0,GZ=o0,BZ=s0,jZ=i0,HZ=a0,FZ=c0,VZ=We([FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0]),u0="1.0",l0="1.1",p0="2.0",d0="SPDY",_0="QUIC",qZ=u0,$Z=l0,YZ=p0,WZ=d0,zZ=_0,KZ={HTTP_1_0:u0,HTTP_1_1:l0,HTTP_2_0:p0,SPDY:d0,QUIC:_0},f0="queue",m0="topic",QZ=f0,XZ=m0,JZ=We([f0,m0]),h0="receive",T0="process",ZZ=h0,e6=T0,t6=We([h0,T0]),E0=0,S0=1,g0=2,A0=3,R0=4,y0=5,I0=6,O0=7,N0=8,b0=9,C0=10,P0=11,M0=12,x0=13,v0=14,L0=15,D0=16,n6=E0,r6=S0,o6=g0,s6=A0,i6=R0,a6=y0,c6=I0,u6=O0,l6=N0,p6=b0,d6=C0,_6=P0,f6=M0,m6=x0,h6=v0,T6=L0,E6=D0,S6={OK:E0,CANCELLED:S0,UNKNOWN:g0,INVALID_ARGUMENT:A0,DEADLINE_EXCEEDED:R0,NOT_FOUND:y0,ALREADY_EXISTS:I0,PERMISSION_DENIED:O0,RESOURCE_EXHAUSTED:N0,FAILED_PRECONDITION:b0,ABORTED:C0,OUT_OF_RANGE:P0,UNIMPLEMENTED:M0,INTERNAL:x0,UNAVAILABLE:v0,DATA_LOSS:L0,UNAUTHENTICATED:D0},U0="SENT",w0="RECEIVED",g6=U0,A6=w0,R6=We([U0,w0])});var G0=z(()=>{k0()});var B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,y6,I6,O6,N6,b6,C6,P6,M6,x6,v6,L6,D6,U6,w6,k6,G6,B6,j6,H6,F6,V6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,s8,i8,a8,c8,u8,l8,p8,d8,_8,f8,m8,h8,T8,E8,S8,g8,A8,R8,y8,I8,O8,N8,b8,C8,P8,M8,x8,v8,L8,D8,U8,w8,k8,G8,B8,cA,j8,H8,F8,V8,q8,$8,Y8,W8,z8,K8,dU,_U,fU,mU,Q8,X8,J8,Z8,e7,hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU,t7,n7,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,f7,m7,h7,T7,E7,LU,DU,S7,g7,A7,UU,wU,kU,GU,BU,jU,HU,R7,y7,I7,O7,N7,b7,C7,P7,FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU,M7,x7,v7,L7,D7,U7,w7,k7,G7,B7,j7,H7,ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw,F7,V7,q7,$7,Y7,W7,z7,K7,Q7,X7,J7,uw=z(()=>{zg();B0="cloud.provider",j0="cloud.account.id",H0="cloud.region",F0="cloud.availability_zone",V0="cloud.platform",q0="aws.ecs.container.arn",$0="aws.ecs.cluster.arn",Y0="aws.ecs.launchtype",W0="aws.ecs.task.arn",z0="aws.ecs.task.family",K0="aws.ecs.task.revision",Q0="aws.eks.cluster.arn",X0="aws.log.group.names",J0="aws.log.group.arns",Z0="aws.log.stream.names",eD="aws.log.stream.arns",tD="container.name",nD="container.id",rD="container.runtime",oD="container.image.name",sD="container.image.tag",iD="deployment.environment",aD="device.id",cD="device.model.identifier",uD="device.model.name",lD="faas.name",pD="faas.id",dD="faas.version",_D="faas.instance",fD="faas.max_memory",mD="host.id",hD="host.name",TD="host.type",ED="host.arch",SD="host.image.name",gD="host.image.id",AD="host.image.version",RD="k8s.cluster.name",yD="k8s.node.name",ID="k8s.node.uid",OD="k8s.namespace.name",ND="k8s.pod.uid",bD="k8s.pod.name",CD="k8s.container.name",PD="k8s.replicaset.uid",MD="k8s.replicaset.name",xD="k8s.deployment.uid",vD="k8s.deployment.name",LD="k8s.statefulset.uid",DD="k8s.statefulset.name",UD="k8s.daemonset.uid",wD="k8s.daemonset.name",kD="k8s.job.uid",GD="k8s.job.name",BD="k8s.cronjob.uid",jD="k8s.cronjob.name",HD="os.type",FD="os.description",VD="os.name",qD="os.version",$D="process.pid",YD="process.executable.name",WD="process.executable.path",zD="process.command",KD="process.command_line",QD="process.command_args",XD="process.owner",JD="process.runtime.name",ZD="process.runtime.version",eU="process.runtime.description",tU="service.name",nU="service.namespace",rU="service.instance.id",oU="service.version",sU="telemetry.sdk.name",iU="telemetry.sdk.language",aU="telemetry.sdk.version",cU="telemetry.auto.version",uU="webengine.name",lU="webengine.version",pU="webengine.description",y6=B0,I6=j0,O6=H0,N6=F0,b6=V0,C6=q0,P6=$0,M6=Y0,x6=W0,v6=z0,L6=K0,D6=Q0,U6=X0,w6=J0,k6=Z0,G6=eD,B6=tD,j6=nD,H6=rD,F6=oD,V6=sD,q6=iD,$6=aD,Y6=cD,W6=uD,z6=lD,K6=pD,Q6=dD,X6=_D,J6=fD,Z6=mD,e8=hD,t8=TD,n8=ED,r8=SD,o8=gD,s8=AD,i8=RD,a8=yD,c8=ID,u8=OD,l8=ND,p8=bD,d8=CD,_8=PD,f8=MD,m8=xD,h8=vD,T8=LD,E8=DD,S8=UD,g8=wD,A8=kD,R8=GD,y8=BD,I8=jD,O8=HD,N8=FD,b8=VD,C8=qD,P8=$D,M8=YD,x8=WD,v8=zD,L8=KD,D8=QD,U8=XD,w8=JD,k8=ZD,G8=eU,B8=tU,cA=nU,j8=rU,H8=oU,F8=sU,V8=iU,q8=aU,$8=cU,Y8=uU,W8=lU,z8=pU,K8=We([B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU]),dU="alibaba_cloud",_U="aws",fU="azure",mU="gcp",Q8=dU,X8=_U,J8=fU,Z8=mU,e7=We([dU,_U,fU,mU]),hU="alibaba_cloud_ecs",TU="alibaba_cloud_fc",EU="aws_ec2",SU="aws_ecs",gU="aws_eks",AU="aws_lambda",RU="aws_elastic_beanstalk",yU="azure_vm",IU="azure_container_instances",OU="azure_aks",NU="azure_functions",bU="azure_app_service",CU="gcp_compute_engine",PU="gcp_cloud_run",MU="gcp_kubernetes_engine",xU="gcp_cloud_functions",vU="gcp_app_engine",t7=hU,n7=TU,r7=EU,o7=SU,s7=gU,i7=AU,a7=RU,c7=yU,u7=IU,l7=OU,p7=NU,d7=bU,_7=CU,f7=PU,m7=MU,h7=xU,T7=vU,E7=We([hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU]),LU="ec2",DU="fargate",S7=LU,g7=DU,A7=We([LU,DU]),UU="amd64",wU="arm32",kU="arm64",GU="ia64",BU="ppc32",jU="ppc64",HU="x86",R7=UU,y7=wU,I7=kU,O7=GU,N7=BU,b7=jU,C7=HU,P7=We([UU,wU,kU,GU,BU,jU,HU]),FU="windows",VU="linux",qU="darwin",$U="freebsd",YU="netbsd",WU="openbsd",zU="dragonflybsd",KU="hpux",QU="aix",XU="solaris",JU="z_os",M7=FU,x7=VU,v7=qU,L7=$U,D7=YU,U7=WU,w7=zU,k7=KU,G7=QU,B7=XU,j7=JU,H7=We([FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU]),ZU="cpp",ew="dotnet",tw="erlang",nw="go",rw="java",ow="nodejs",sw="php",iw="python",aw="ruby",cw="webjs",F7=ZU,V7=ew,q7=tw,$7=nw,Y7=rw,W7=ow,z7=sw,K7=iw,Q7=aw,X7=cw,J7=We([ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw])});var lw=z(()=>{uw()});var Z7,eee,tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,hee,Tee,Eee,See,gee,Aee,Ree,yee,uA,lA,Iee,tc,Oee,pA,dA,Nee,xi,bee,Cee,Pee,Mee,xee,vee,Lee,Dee,Uee,wee,_A,kee,Gee,Bee,jee,Hee,Fee,vi,Vee,qee,$ee,Yee,Wee,zee,Kee,Qee,Xee,Jee,Zee,ete,tte,bo,Co,nte,rte,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,mte,hte,Tte,fA,mA,Ete,hA,TA,Ste,gte,Ate,Rte,yte,Ite,Ote,Nte,bte,Cte,Pte,Mte,xte,vte,EA,SA,Lte,gA,Dte,AA,Ute,wte,kte,Gte,Bte,jte,Hte,Fte,Vte,qte,$te,Yte,Wte,zte,Kte,Qte,Xte,Jte,Zte,ene,tne,nne,rne,one,cs,sne,ine,ane,RA,pw=z(()=>{Z7="aspnetcore.diagnostics.exception.result",eee="aborted",tee="handled",nee="skipped",ree="unhandled",oee="aspnetcore.diagnostics.handler.type",see="aspnetcore.rate_limiting.policy",iee="aspnetcore.rate_limiting.result",aee="acquired",cee="endpoint_limiter",uee="global_limiter",lee="request_canceled",pee="aspnetcore.request.is_unhandled",dee="aspnetcore.routing.is_fallback",_ee="aspnetcore.routing.match_status",fee="failure",mee="success",hee="aspnetcore.user.is_authenticated",Tee="client.address",Eee="client.port",See="code.column.number",gee="code.file.path",Aee="code.function.name",Ree="code.line.number",yee="code.stacktrace",uA="db.collection.name",lA="db.namespace",Iee="db.operation.batch.size",tc="db.operation.name",Oee="db.query.summary",pA="db.query.text",dA="db.response.status_code",Nee="db.stored_procedure.name",xi="db.system.name",bee="mariadb",Cee="microsoft.sql_server",Pee="mysql",Mee="postgresql",xee="dotnet.gc.heap.generation",vee="gen0",Lee="gen1",Dee="gen2",Uee="loh",wee="poh",_A="error.type",kee="_OTHER",Gee="exception.escaped",Bee="exception.message",jee="exception.stacktrace",Hee="exception.type",Fee=t=>`http.request.header.${t}`,vi="http.request.method",Vee="_OTHER",qee="CONNECT",$ee="DELETE",Yee="GET",Wee="HEAD",zee="OPTIONS",Kee="PATCH",Qee="POST",Xee="PUT",Jee="TRACE",Zee="http.request.method_original",ete="http.request.resend_count",tte=t=>`http.response.header.${t}`,bo="http.response.status_code",Co="http.route",nte="jvm.gc.action",rte="jvm.gc.name",ote="jvm.memory.pool.name",ste="jvm.memory.type",ite="heap",ate="non_heap",cte="jvm.thread.daemon",ute="jvm.thread.state",lte="blocked",pte="new",dte="runnable",_te="terminated",fte="timed_waiting",mte="waiting",hte="network.local.address",Tte="network.local.port",fA="network.peer.address",mA="network.peer.port",Ete="network.protocol.name",hA="network.protocol.version",TA="network.transport",Ste="pipe",gte="quic",Ate="tcp",Rte="udp",yte="unix",Ite="network.type",Ote="ipv4",Nte="ipv6",bte="otel.scope.name",Cte="otel.scope.version",Pte="otel.status_code",Mte="ERROR",xte="OK",vte="otel.status_description",EA="server.address",SA="server.port",Lte="service.instance.id",gA="service.name",Dte="service.namespace",AA="service.version",Ute="signalr.connection.status",wte="app_shutdown",kte="normal_closure",Gte="timeout",Bte="signalr.transport",jte="long_polling",Hte="server_sent_events",Fte="web_sockets",Vte="telemetry.sdk.language",qte="cpp",$te="dotnet",Yte="erlang",Wte="go",zte="java",Kte="nodejs",Qte="php",Xte="python",Jte="ruby",Zte="rust",ene="swift",tne="webjs",nne="telemetry.sdk.name",rne="telemetry.sdk.version",one="url.fragment",cs="url.full",sne="url.path",ine="url.query",ane="url.scheme",RA="user_agent.original"});var cne,une,lne,pne,dne,_ne,fne,mne,hne,Tne,Ene,Sne,gne,Ane,Rne,yne,Ine,One,Nne,bne,Cne,Pne,Mne,xne,vne,Lne,Dne,Une,wne,kne,Gne,Bne,jne,Hne,Fne,Vne,qne,$ne,Yne,Wne,zne,Kne,Qne,Xne,Jne,Zne,ere,tre,nre,rre,ore,dw=z(()=>{cne="aspnetcore.diagnostics.exceptions",une="aspnetcore.rate_limiting.active_request_leases",lne="aspnetcore.rate_limiting.queued_requests",pne="aspnetcore.rate_limiting.request.time_in_queue",dne="aspnetcore.rate_limiting.request_lease.duration",_ne="aspnetcore.rate_limiting.requests",fne="aspnetcore.routing.match_attempts",mne="db.client.operation.duration",hne="dotnet.assembly.count",Tne="dotnet.exceptions",Ene="dotnet.gc.collections",Sne="dotnet.gc.heap.total_allocated",gne="dotnet.gc.last_collection.heap.fragmentation.size",Ane="dotnet.gc.last_collection.heap.size",Rne="dotnet.gc.last_collection.memory.committed_size",yne="dotnet.gc.pause.time",Ine="dotnet.jit.compilation.time",One="dotnet.jit.compiled_il.size",Nne="dotnet.jit.compiled_methods",bne="dotnet.monitor.lock_contentions",Cne="dotnet.process.cpu.count",Pne="dotnet.process.cpu.time",Mne="dotnet.process.memory.working_set",xne="dotnet.thread_pool.queue.length",vne="dotnet.thread_pool.thread.count",Lne="dotnet.thread_pool.work_item.count",Dne="dotnet.timer.count",Une="http.client.request.duration",wne="http.server.request.duration",kne="jvm.class.count",Gne="jvm.class.loaded",Bne="jvm.class.unloaded",jne="jvm.cpu.count",Hne="jvm.cpu.recent_utilization",Fne="jvm.cpu.time",Vne="jvm.gc.duration",qne="jvm.memory.committed",$ne="jvm.memory.limit",Yne="jvm.memory.used",Wne="jvm.memory.used_after_last_gc",zne="jvm.thread.count",Kne="kestrel.active_connections",Qne="kestrel.active_tls_handshakes",Xne="kestrel.connection.duration",Jne="kestrel.queued_connections",Zne="kestrel.queued_requests",ere="kestrel.rejected_connections",tre="kestrel.tls_handshake.duration",nre="kestrel.upgraded_connections",rre="signalr.server.active_connections",ore="signalr.server.connection.duration"});var sre,_w=z(()=>{sre="exception"});var Ae={};sg(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>eee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>tee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>nee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>ree,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>aee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>cee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>uee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>lee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>fee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>mee,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>Z7,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>oee,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>see,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>iee,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>pee,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>dee,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>_ee,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>hee,ATTR_CLIENT_ADDRESS:()=>Tee,ATTR_CLIENT_PORT:()=>Eee,ATTR_CODE_COLUMN_NUMBER:()=>See,ATTR_CODE_FILE_PATH:()=>gee,ATTR_CODE_FUNCTION_NAME:()=>Aee,ATTR_CODE_LINE_NUMBER:()=>Ree,ATTR_CODE_STACKTRACE:()=>yee,ATTR_DB_COLLECTION_NAME:()=>uA,ATTR_DB_NAMESPACE:()=>lA,ATTR_DB_OPERATION_BATCH_SIZE:()=>Iee,ATTR_DB_OPERATION_NAME:()=>tc,ATTR_DB_QUERY_SUMMARY:()=>Oee,ATTR_DB_QUERY_TEXT:()=>pA,ATTR_DB_RESPONSE_STATUS_CODE:()=>dA,ATTR_DB_STORED_PROCEDURE_NAME:()=>Nee,ATTR_DB_SYSTEM_NAME:()=>xi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>xee,ATTR_ERROR_TYPE:()=>_A,ATTR_EXCEPTION_ESCAPED:()=>Gee,ATTR_EXCEPTION_MESSAGE:()=>Bee,ATTR_EXCEPTION_STACKTRACE:()=>jee,ATTR_EXCEPTION_TYPE:()=>Hee,ATTR_HTTP_REQUEST_HEADER:()=>Fee,ATTR_HTTP_REQUEST_METHOD:()=>vi,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>Zee,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>ete,ATTR_HTTP_RESPONSE_HEADER:()=>tte,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>bo,ATTR_HTTP_ROUTE:()=>Co,ATTR_JVM_GC_ACTION:()=>nte,ATTR_JVM_GC_NAME:()=>rte,ATTR_JVM_MEMORY_POOL_NAME:()=>ote,ATTR_JVM_MEMORY_TYPE:()=>ste,ATTR_JVM_THREAD_DAEMON:()=>cte,ATTR_JVM_THREAD_STATE:()=>ute,ATTR_NETWORK_LOCAL_ADDRESS:()=>hte,ATTR_NETWORK_LOCAL_PORT:()=>Tte,ATTR_NETWORK_PEER_ADDRESS:()=>fA,ATTR_NETWORK_PEER_PORT:()=>mA,ATTR_NETWORK_PROTOCOL_NAME:()=>Ete,ATTR_NETWORK_PROTOCOL_VERSION:()=>hA,ATTR_NETWORK_TRANSPORT:()=>TA,ATTR_NETWORK_TYPE:()=>Ite,ATTR_OTEL_SCOPE_NAME:()=>bte,ATTR_OTEL_SCOPE_VERSION:()=>Cte,ATTR_OTEL_STATUS_CODE:()=>Pte,ATTR_OTEL_STATUS_DESCRIPTION:()=>vte,ATTR_SERVER_ADDRESS:()=>EA,ATTR_SERVER_PORT:()=>SA,ATTR_SERVICE_INSTANCE_ID:()=>Lte,ATTR_SERVICE_NAME:()=>gA,ATTR_SERVICE_NAMESPACE:()=>Dte,ATTR_SERVICE_VERSION:()=>AA,ATTR_SIGNALR_CONNECTION_STATUS:()=>Ute,ATTR_SIGNALR_TRANSPORT:()=>Bte,ATTR_TELEMETRY_SDK_LANGUAGE:()=>Vte,ATTR_TELEMETRY_SDK_NAME:()=>nne,ATTR_TELEMETRY_SDK_VERSION:()=>rne,ATTR_URL_FRAGMENT:()=>one,ATTR_URL_FULL:()=>cs,ATTR_URL_PATH:()=>sne,ATTR_URL_QUERY:()=>ine,ATTR_URL_SCHEME:()=>ane,ATTR_USER_AGENT_ORIGINAL:()=>RA,AWSECSLAUNCHTYPEVALUES_EC2:()=>S7,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>g7,AwsEcsLaunchtypeValues:()=>A7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>t7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>n7,CLOUDPLATFORMVALUES_AWS_EC2:()=>r7,CLOUDPLATFORMVALUES_AWS_ECS:()=>o7,CLOUDPLATFORMVALUES_AWS_EKS:()=>s7,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>a7,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>i7,CLOUDPLATFORMVALUES_AZURE_AKS:()=>l7,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>d7,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>u7,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>p7,CLOUDPLATFORMVALUES_AZURE_VM:()=>c7,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>T7,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>h7,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>f7,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>_7,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>m7,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>Q8,CLOUDPROVIDERVALUES_AWS:()=>X8,CLOUDPROVIDERVALUES_AZURE:()=>J8,CLOUDPROVIDERVALUES_GCP:()=>Z8,CloudPlatformValues:()=>E7,CloudProviderValues:()=>e7,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>U5,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>V5,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>w5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>F5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>G5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>$5,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>B5,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>k5,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>q5,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>H5,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>j5,DBSYSTEMVALUES_ADABAS:()=>o5,DBSYSTEMVALUES_CACHE:()=>r5,DBSYSTEMVALUES_CASSANDRA:()=>A5,DBSYSTEMVALUES_CLOUDSCAPE:()=>KJ,DBSYSTEMVALUES_COCKROACHDB:()=>L5,DBSYSTEMVALUES_COLDFUSION:()=>g5,DBSYSTEMVALUES_COSMOSDB:()=>b5,DBSYSTEMVALUES_COUCHBASE:()=>O5,DBSYSTEMVALUES_COUCHDB:()=>N5,DBSYSTEMVALUES_DB2:()=>$J,DBSYSTEMVALUES_DERBY:()=>i5,DBSYSTEMVALUES_DYNAMODB:()=>C5,DBSYSTEMVALUES_EDB:()=>n5,DBSYSTEMVALUES_ELASTICSEARCH:()=>x5,DBSYSTEMVALUES_FILEMAKER:()=>a5,DBSYSTEMVALUES_FIREBIRD:()=>s5,DBSYSTEMVALUES_FIRSTSQL:()=>t5,DBSYSTEMVALUES_GEODE:()=>M5,DBSYSTEMVALUES_H2:()=>S5,DBSYSTEMVALUES_HANADB:()=>ZJ,DBSYSTEMVALUES_HBASE:()=>R5,DBSYSTEMVALUES_HIVE:()=>zJ,DBSYSTEMVALUES_HSQLDB:()=>QJ,DBSYSTEMVALUES_INFORMIX:()=>c5,DBSYSTEMVALUES_INGRES:()=>e5,DBSYSTEMVALUES_INSTANTDB:()=>u5,DBSYSTEMVALUES_INTERBASE:()=>l5,DBSYSTEMVALUES_MARIADB:()=>p5,DBSYSTEMVALUES_MAXDB:()=>JJ,DBSYSTEMVALUES_MEMCACHED:()=>v5,DBSYSTEMVALUES_MONGODB:()=>y5,DBSYSTEMVALUES_MSSQL:()=>FJ,DBSYSTEMVALUES_MYSQL:()=>VJ,DBSYSTEMVALUES_NEO4J:()=>P5,DBSYSTEMVALUES_NETEZZA:()=>d5,DBSYSTEMVALUES_ORACLE:()=>qJ,DBSYSTEMVALUES_OTHER_SQL:()=>HJ,DBSYSTEMVALUES_PERVASIVE:()=>_5,DBSYSTEMVALUES_POINTBASE:()=>f5,DBSYSTEMVALUES_POSTGRESQL:()=>YJ,DBSYSTEMVALUES_PROGRESS:()=>XJ,DBSYSTEMVALUES_REDIS:()=>I5,DBSYSTEMVALUES_REDSHIFT:()=>WJ,DBSYSTEMVALUES_SQLITE:()=>m5,DBSYSTEMVALUES_SYBASE:()=>h5,DBSYSTEMVALUES_TERADATA:()=>T5,DBSYSTEMVALUES_VERTICA:()=>E5,DB_SYSTEM_NAME_VALUE_MARIADB:()=>bee,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>Cee,DB_SYSTEM_NAME_VALUE_MYSQL:()=>Pee,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>Mee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>vee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>Lee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>Dee,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>Uee,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>wee,DbCassandraConsistencyLevelValues:()=>Y5,DbSystemValues:()=>D5,ERROR_TYPE_VALUE_OTHER:()=>kee,EVENT_EXCEPTION:()=>sre,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>tZ,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>eZ,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>Z5,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>rZ,FAASINVOKEDPROVIDERVALUES_AWS:()=>oZ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>sZ,FAASINVOKEDPROVIDERVALUES_GCP:()=>iZ,FAASTRIGGERVALUES_DATASOURCE:()=>W5,FAASTRIGGERVALUES_HTTP:()=>z5,FAASTRIGGERVALUES_OTHER:()=>X5,FAASTRIGGERVALUES_PUBSUB:()=>K5,FAASTRIGGERVALUES_TIMER:()=>Q5,FaasDocumentOperationValues:()=>nZ,FaasInvokedProviderValues:()=>aZ,FaasTriggerValues:()=>J5,HOSTARCHVALUES_AMD64:()=>R7,HOSTARCHVALUES_ARM32:()=>y7,HOSTARCHVALUES_ARM64:()=>I7,HOSTARCHVALUES_IA64:()=>O7,HOSTARCHVALUES_PPC32:()=>N7,HOSTARCHVALUES_PPC64:()=>b7,HOSTARCHVALUES_X86:()=>C7,HTTPFLAVORVALUES_HTTP_1_0:()=>qZ,HTTPFLAVORVALUES_HTTP_1_1:()=>$Z,HTTPFLAVORVALUES_HTTP_2_0:()=>YZ,HTTPFLAVORVALUES_QUIC:()=>zZ,HTTPFLAVORVALUES_SPDY:()=>WZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>qee,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>$ee,HTTP_REQUEST_METHOD_VALUE_GET:()=>Yee,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>Wee,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>zee,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>Vee,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>Kee,HTTP_REQUEST_METHOD_VALUE_POST:()=>Qee,HTTP_REQUEST_METHOD_VALUE_PUT:()=>Xee,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>Jee,HostArchValues:()=>P7,HttpFlavorValues:()=>KZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>ite,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>ate,JVM_THREAD_STATE_VALUE_BLOCKED:()=>lte,JVM_THREAD_STATE_VALUE_NEW:()=>pte,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>dte,JVM_THREAD_STATE_VALUE_TERMINATED:()=>_te,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>fte,JVM_THREAD_STATE_VALUE_WAITING:()=>mte,MESSAGETYPEVALUES_RECEIVED:()=>A6,MESSAGETYPEVALUES_SENT:()=>g6,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>QZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>XZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>e6,MESSAGINGOPERATIONVALUES_RECEIVE:()=>ZZ,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>cne,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>une,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>lne,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>_ne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>dne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>pne,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>fne,METRIC_DB_CLIENT_OPERATION_DURATION:()=>mne,METRIC_DOTNET_ASSEMBLY_COUNT:()=>hne,METRIC_DOTNET_EXCEPTIONS:()=>Tne,METRIC_DOTNET_GC_COLLECTIONS:()=>Ene,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>Sne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>gne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>Ane,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>Rne,METRIC_DOTNET_GC_PAUSE_TIME:()=>yne,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>Ine,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>One,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>Nne,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>bne,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>Cne,METRIC_DOTNET_PROCESS_CPU_TIME:()=>Pne,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>Mne,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>xne,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>vne,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>Lne,METRIC_DOTNET_TIMER_COUNT:()=>Dne,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>Une,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>wne,METRIC_JVM_CLASS_COUNT:()=>kne,METRIC_JVM_CLASS_LOADED:()=>Gne,METRIC_JVM_CLASS_UNLOADED:()=>Bne,METRIC_JVM_CPU_COUNT:()=>jne,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Hne,METRIC_JVM_CPU_TIME:()=>Fne,METRIC_JVM_GC_DURATION:()=>Vne,METRIC_JVM_MEMORY_COMMITTED:()=>qne,METRIC_JVM_MEMORY_LIMIT:()=>$ne,METRIC_JVM_MEMORY_USED:()=>Yne,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>Wne,METRIC_JVM_THREAD_COUNT:()=>zne,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Kne,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Qne,METRIC_KESTREL_CONNECTION_DURATION:()=>Xne,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Jne,METRIC_KESTREL_QUEUED_REQUESTS:()=>Zne,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>ere,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>tre,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>nre,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>rre,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>ore,MessageTypeValues:()=>R6,MessagingDestinationKindValues:()=>JZ,MessagingOperationValues:()=>t6,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>OZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>yZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>UZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>LZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>RZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>kZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>PZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>xZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>wZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>MZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>vZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>BZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>DZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>FZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>jZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>HZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>GZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>IZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>EZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>SZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>gZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>hZ,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>TZ,NETTRANSPORTVALUES_INPROC:()=>_Z,NETTRANSPORTVALUES_IP:()=>lZ,NETTRANSPORTVALUES_IP_TCP:()=>cZ,NETTRANSPORTVALUES_IP_UDP:()=>uZ,NETTRANSPORTVALUES_OTHER:()=>fZ,NETTRANSPORTVALUES_PIPE:()=>dZ,NETTRANSPORTVALUES_UNIX:()=>pZ,NETWORK_TRANSPORT_VALUE_PIPE:()=>Ste,NETWORK_TRANSPORT_VALUE_QUIC:()=>gte,NETWORK_TRANSPORT_VALUE_TCP:()=>Ate,NETWORK_TRANSPORT_VALUE_UDP:()=>Rte,NETWORK_TRANSPORT_VALUE_UNIX:()=>yte,NETWORK_TYPE_VALUE_IPV4:()=>Ote,NETWORK_TYPE_VALUE_IPV6:()=>Nte,NetHostConnectionSubtypeValues:()=>VZ,NetHostConnectionTypeValues:()=>AZ,NetTransportValues:()=>mZ,OSTYPEVALUES_AIX:()=>G7,OSTYPEVALUES_DARWIN:()=>v7,OSTYPEVALUES_DRAGONFLYBSD:()=>w7,OSTYPEVALUES_FREEBSD:()=>L7,OSTYPEVALUES_HPUX:()=>k7,OSTYPEVALUES_LINUX:()=>x7,OSTYPEVALUES_NETBSD:()=>D7,OSTYPEVALUES_OPENBSD:()=>U7,OSTYPEVALUES_SOLARIS:()=>B7,OSTYPEVALUES_WINDOWS:()=>M7,OSTYPEVALUES_Z_OS:()=>j7,OTEL_STATUS_CODE_VALUE_ERROR:()=>Mte,OTEL_STATUS_CODE_VALUE_OK:()=>xte,OsTypeValues:()=>H7,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>d6,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>c6,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>r6,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>T6,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>i6,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>p6,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>m6,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>s6,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>a6,RPCGRPCSTATUSCODEVALUES_OK:()=>n6,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>_6,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>u6,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>l6,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>E6,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>h6,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>f6,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>o6,RpcGrpcStatusCodeValues:()=>S6,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>JX,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>lJ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>KX,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>$X,SEMATTRS_AWS_DYNAMODB_COUNT:()=>cJ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>rJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>tJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>pJ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>ZX,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>YX,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>XX,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>nJ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>QX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>WX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>zX,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>uJ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>sJ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>iJ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>eJ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>oJ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>qX,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>aJ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>wQ,SEMATTRS_CODE_FILEPATH:()=>DX,SEMATTRS_CODE_FUNCTION:()=>vX,SEMATTRS_CODE_LINENO:()=>UX,SEMATTRS_CODE_NAMESPACE:()=>LX,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>$Q,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>QQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>KQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>WQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>VQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>qQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>zQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>YQ,SEMATTRS_DB_CONNECTION_STRING:()=>kQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>XQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>BQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>ZQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>FQ,SEMATTRS_DB_NAME:()=>jQ,SEMATTRS_DB_OPERATION:()=>HQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>JQ,SEMATTRS_DB_SQL_TABLE:()=>eX,SEMATTRS_DB_STATEMENT:()=>Qg,SEMATTRS_DB_SYSTEM:()=>Kg,SEMATTRS_DB_USER:()=>GQ,SEMATTRS_ENDUSER_ID:()=>bX,SEMATTRS_ENDUSER_ROLE:()=>CX,SEMATTRS_ENDUSER_SCOPE:()=>PX,SEMATTRS_EXCEPTION_ESCAPED:()=>oX,SEMATTRS_EXCEPTION_MESSAGE:()=>nX,SEMATTRS_EXCEPTION_STACKTRACE:()=>rX,SEMATTRS_EXCEPTION_TYPE:()=>tX,SEMATTRS_FAAS_COLDSTART:()=>dX,SEMATTRS_FAAS_CRON:()=>pX,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>iX,SEMATTRS_FAAS_DOCUMENT_NAME:()=>uX,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>aX,SEMATTRS_FAAS_DOCUMENT_TIME:()=>cX,SEMATTRS_FAAS_EXECUTION:()=>sX,SEMATTRS_FAAS_INVOKED_NAME:()=>_X,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>fX,SEMATTRS_FAAS_INVOKED_REGION:()=>mX,SEMATTRS_FAAS_TIME:()=>lX,SEMATTRS_FAAS_TRIGGER:()=>Xg,SEMATTRS_HTTP_CLIENT_IP:()=>VX,SEMATTRS_HTTP_FLAVOR:()=>GX,SEMATTRS_HTTP_HOST:()=>wX,SEMATTRS_HTTP_METHOD:()=>Cl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>jX,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>HX,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>nA,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>rA,SEMATTRS_HTTP_ROUTE:()=>oA,SEMATTRS_HTTP_SCHEME:()=>kX,SEMATTRS_HTTP_SERVER_NAME:()=>FX,SEMATTRS_HTTP_STATUS_CODE:()=>Mi,SEMATTRS_HTTP_TARGET:()=>tA,SEMATTRS_HTTP_URL:()=>ec,SEMATTRS_HTTP_USER_AGENT:()=>BX,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>GJ,SEMATTRS_MESSAGE_ID:()=>kJ,SEMATTRS_MESSAGE_TYPE:()=>wJ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>BJ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>yJ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>SJ,SEMATTRS_MESSAGING_DESTINATION:()=>dJ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>_J,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>bJ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>NJ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>OJ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>CJ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>PJ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>EJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>AJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>gJ,SEMATTRS_MESSAGING_OPERATION:()=>RJ,SEMATTRS_MESSAGING_PROTOCOL:()=>mJ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>hJ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>IJ,SEMATTRS_MESSAGING_SYSTEM:()=>sA,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>fJ,SEMATTRS_MESSAGING_URL:()=>TJ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>OX,SEMATTRS_NET_HOST_CARRIER_MCC:()=>yX,SEMATTRS_NET_HOST_CARRIER_MNC:()=>IX,SEMATTRS_NET_HOST_CARRIER_NAME:()=>RX,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>AX,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>gX,SEMATTRS_NET_HOST_IP:()=>Zg,SEMATTRS_NET_HOST_NAME:()=>SX,SEMATTRS_NET_HOST_PORT:()=>eA,SEMATTRS_NET_PEER_IP:()=>Jg,SEMATTRS_NET_PEER_NAME:()=>EX,SEMATTRS_NET_PEER_PORT:()=>TX,SEMATTRS_NET_TRANSPORT:()=>hX,SEMATTRS_PEER_SERVICE:()=>NX,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>aA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>DJ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>UJ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>LJ,SEMATTRS_RPC_JSONRPC_VERSION:()=>vJ,SEMATTRS_RPC_METHOD:()=>xJ,SEMATTRS_RPC_SERVICE:()=>iA,SEMATTRS_RPC_SYSTEM:()=>MJ,SEMATTRS_THREAD_ID:()=>MX,SEMATTRS_THREAD_NAME:()=>xX,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>P6,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>C6,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>M6,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>x6,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>v6,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>L6,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>D6,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>w6,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>U6,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>G6,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>k6,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>I6,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>N6,SEMRESATTRS_CLOUD_PLATFORM:()=>b6,SEMRESATTRS_CLOUD_PROVIDER:()=>y6,SEMRESATTRS_CLOUD_REGION:()=>O6,SEMRESATTRS_CONTAINER_ID:()=>j6,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>F6,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>V6,SEMRESATTRS_CONTAINER_NAME:()=>B6,SEMRESATTRS_CONTAINER_RUNTIME:()=>H6,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>q6,SEMRESATTRS_DEVICE_ID:()=>$6,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>Y6,SEMRESATTRS_DEVICE_MODEL_NAME:()=>W6,SEMRESATTRS_FAAS_ID:()=>K6,SEMRESATTRS_FAAS_INSTANCE:()=>X6,SEMRESATTRS_FAAS_MAX_MEMORY:()=>J6,SEMRESATTRS_FAAS_NAME:()=>z6,SEMRESATTRS_FAAS_VERSION:()=>Q6,SEMRESATTRS_HOST_ARCH:()=>n8,SEMRESATTRS_HOST_ID:()=>Z6,SEMRESATTRS_HOST_IMAGE_ID:()=>o8,SEMRESATTRS_HOST_IMAGE_NAME:()=>r8,SEMRESATTRS_HOST_IMAGE_VERSION:()=>s8,SEMRESATTRS_HOST_NAME:()=>e8,SEMRESATTRS_HOST_TYPE:()=>t8,SEMRESATTRS_K8S_CLUSTER_NAME:()=>i8,SEMRESATTRS_K8S_CONTAINER_NAME:()=>d8,SEMRESATTRS_K8S_CRONJOB_NAME:()=>I8,SEMRESATTRS_K8S_CRONJOB_UID:()=>y8,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>g8,SEMRESATTRS_K8S_DAEMONSET_UID:()=>S8,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>h8,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>m8,SEMRESATTRS_K8S_JOB_NAME:()=>R8,SEMRESATTRS_K8S_JOB_UID:()=>A8,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>u8,SEMRESATTRS_K8S_NODE_NAME:()=>a8,SEMRESATTRS_K8S_NODE_UID:()=>c8,SEMRESATTRS_K8S_POD_NAME:()=>p8,SEMRESATTRS_K8S_POD_UID:()=>l8,SEMRESATTRS_K8S_REPLICASET_NAME:()=>f8,SEMRESATTRS_K8S_REPLICASET_UID:()=>_8,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>E8,SEMRESATTRS_K8S_STATEFULSET_UID:()=>T8,SEMRESATTRS_OS_DESCRIPTION:()=>N8,SEMRESATTRS_OS_NAME:()=>b8,SEMRESATTRS_OS_TYPE:()=>O8,SEMRESATTRS_OS_VERSION:()=>C8,SEMRESATTRS_PROCESS_COMMAND:()=>v8,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>D8,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>L8,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>M8,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>x8,SEMRESATTRS_PROCESS_OWNER:()=>U8,SEMRESATTRS_PROCESS_PID:()=>P8,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>G8,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>w8,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>k8,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>j8,SEMRESATTRS_SERVICE_NAME:()=>B8,SEMRESATTRS_SERVICE_NAMESPACE:()=>cA,SEMRESATTRS_SERVICE_VERSION:()=>H8,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>$8,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>V8,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>F8,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>q8,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>z8,SEMRESATTRS_WEBENGINE_NAME:()=>Y8,SEMRESATTRS_WEBENGINE_VERSION:()=>W8,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>wte,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>kte,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>Gte,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>jte,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>Hte,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>Fte,SemanticAttributes:()=>jJ,SemanticResourceAttributes:()=>K8,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>F7,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>V7,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>q7,TELEMETRYSDKLANGUAGEVALUES_GO:()=>$7,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>Y7,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>W7,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>z7,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>K7,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>Q7,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>X7,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>qte,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>$te,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>Yte,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Wte,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>zte,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Kte,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Qte,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Xte,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Jte,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Zte,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>ene,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>tne,TelemetrySdkLanguageValues:()=>J7});var le=z(()=>{G0();lw();pw();dw();_w()});var fw=E(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});L_.ATTR_PROCESS_RUNTIME_NAME=void 0;L_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var mw=E(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});U_.SDK_INFO=void 0;var ire=WP(),D_=(le(),O(Ae)),are=fw();U_.SDK_INFO={[D_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[are.ATTR_PROCESS_RUNTIME_NAME]:"node",[D_.ATTR_TELEMETRY_SDK_LANGUAGE]:D_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[D_.ATTR_TELEMETRY_SDK_VERSION]:ire.VERSION}});var hw=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.otperformance=$t.SDK_INFO=$t._globalThis=$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getBooleanFromEnv=$t.getStringFromEnv=void 0;var w_=$P();Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return w_.getStringFromEnv}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return w_.getBooleanFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return w_.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return w_.getStringListFromEnv}});var cre=YP();Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return cre._globalThis}});var ure=mw();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return ure.SDK_INFO}});$t.otperformance=performance});var yA=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getStringListFromEnv=Yt.getNumberFromEnv=Yt.getStringFromEnv=Yt.getBooleanFromEnv=Yt.otperformance=Yt._globalThis=Yt.SDK_INFO=void 0;var Li=hw();Object.defineProperty(Yt,"SDK_INFO",{enumerable:!0,get:function(){return Li.SDK_INFO}});Object.defineProperty(Yt,"_globalThis",{enumerable:!0,get:function(){return Li._globalThis}});Object.defineProperty(Yt,"otperformance",{enumerable:!0,get:function(){return Li.otperformance}});Object.defineProperty(Yt,"getBooleanFromEnv",{enumerable:!0,get:function(){return Li.getBooleanFromEnv}});Object.defineProperty(Yt,"getStringFromEnv",{enumerable:!0,get:function(){return Li.getStringFromEnv}});Object.defineProperty(Yt,"getNumberFromEnv",{enumerable:!0,get:function(){return Li.getNumberFromEnv}});Object.defineProperty(Yt,"getStringListFromEnv",{enumerable:!0,get:function(){return Li.getStringListFromEnv}})});var gw=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var k_=yA(),Tw=9,lre=6,pre=Math.pow(10,lre),G_=Math.pow(10,Tw);function Pl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*pre);return[n,r]}be.millisToHrTime=Pl;function dre(){return k_.otperformance.timeOrigin}be.getTimeOrigin=dre;function Ew(t){let e=Pl(k_.otperformance.timeOrigin),n=Pl(typeof t=="number"?t:k_.otperformance.now());return Sw(e,n)}be.hrTime=Ew;function _re(t){if(IA(t))return t;if(typeof t=="number")return t<k_.otperformance.timeOrigin?Ew(t):Pl(t);if(t instanceof Date)return Pl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=_re;function fre(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=G_),[n,r]}be.hrTimeDuration=fre;function mre(t){let e=Tw,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=mre;function hre(t){return t[0]*G_+t[1]}be.hrTimeToNanoseconds=hre;function Tre(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=Tre;function Ere(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=Ere;function IA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=IA;function Sre(t){return IA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=Sre;function Sw(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=G_&&(n[1]-=G_,n[0]+=1),n}be.addHrTimes=Sw});var Aw=E(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.unrefTimer=void 0;function gre(t){typeof t!="number"&&t.unref()}B_.unrefTimer=gre});var Rw=E(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.ExportResultCode=void 0;var Are;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Are=Ml.ExportResultCode||(Ml.ExportResultCode={}))});var Iw=E(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});j_.CompositePropagator=void 0;var yw=(b(),O(v)),OA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){yw.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){yw.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};j_.CompositePropagator=OA});var Ow=E(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.validateValue=nc.validateKey=void 0;var NA="[_0-9a-z-*/]",Rre=`[a-z]${NA}{0,255}`,yre=`[a-z0-9]${NA}{0,240}@[a-z]${NA}{0,13}`,Ire=new RegExp(`^(?:${Rre}|${yre})$`),Ore=/^[ -~]{0,255}[!-~]$/,Nre=/,|=/;function bre(t){return Ire.test(t)}nc.validateKey=bre;function Cre(t){return Ore.test(t)&&!Nre.test(t)}nc.validateValue=Cre});var CA=E(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.TraceState=void 0;var Nw=Ow(),bw=32,Pre=512,Cw=",",Pw="=",bA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+Pw+this.get(n)),e),[]).join(Cw)}_parse(e){e.length>Pre||(this._internalState=e.split(Cw).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Pw);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Nw.validateKey)(i)&&(0,Nw.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>bw&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,bw))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};H_.TraceState=bA});var xw=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.W3CTraceContextPropagator=Wt.parseTraceParent=Wt.TRACE_STATE_HEADER=Wt.TRACE_PARENT_HEADER=void 0;var F_=(b(),O(v)),Mre=bl(),xre=CA();Wt.TRACE_PARENT_HEADER="traceparent";Wt.TRACE_STATE_HEADER="tracestate";var vre="00",Lre="(?!ff)[\\da-f]{2}",Dre="(?![0]{32})[\\da-f]{32}",Ure="(?![0]{16})[\\da-f]{16}",wre="[\\da-f]{2}",kre=new RegExp(`^\\s?(${Lre})-(${Dre})-(${Ure})-(${wre})(-.*)?\\s?$`);function Mw(t){let e=kre.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Wt.parseTraceParent=Mw;var PA=class{inject(e,n,r){let o=F_.trace.getSpanContext(e);if(!o||(0,Mre.isTracingSuppressed)(e)||!(0,F_.isSpanContextValid)(o))return;let s=`${vre}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||F_.TraceFlags.NONE).toString(16)}`;r.set(n,Wt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Wt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Wt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Mw(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Wt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new xre.TraceState(typeof c=="string"?c:void 0)}return F_.trace.setSpanContext(e,i)}fields(){return[Wt.TRACE_PARENT_HEADER,Wt.TRACE_STATE_HEADER]}};Wt.W3CTraceContextPropagator=PA});var vw=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.getRPCMetadata=Rr.deleteRPCMetadata=Rr.setRPCMetadata=Rr.RPCType=void 0;var Gre=(b(),O(v)),MA=(0,Gre.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Bre;(function(t){t.HTTP="http"})(Bre=Rr.RPCType||(Rr.RPCType={}));function jre(t,e){return t.setValue(MA,e)}Rr.setRPCMetadata=jre;function Hre(t){return t.deleteValue(MA)}Rr.deleteRPCMetadata=Hre;function Fre(t){return t.getValue(MA)}Rr.getRPCMetadata=Fre});var kw=E(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});V_.isPlainObject=void 0;var Vre="[object Object]",qre="[object Null]",$re="[object Undefined]",Yre=Function.prototype,Lw=Yre.toString,Wre=Lw.call(Object),zre=Object.getPrototypeOf,Dw=Object.prototype,Uw=Dw.hasOwnProperty,Di=Symbol?Symbol.toStringTag:void 0,ww=Dw.toString;function Kre(t){if(!Qre(t)||Xre(t)!==Vre)return!1;let e=zre(t);if(e===null)return!0;let n=Uw.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Lw.call(n)===Wre}V_.isPlainObject=Kre;function Qre(t){return t!=null&&typeof t=="object"}function Xre(t){return t==null?t===void 0?$re:qre:Di&&Di in Object(t)?Jre(t):Zre(t)}function Jre(t){let e=Uw.call(t,Di),n=t[Di],r=!1;try{t[Di]=void 0,r=!0}catch{}let o=ww.call(t);return r&&(e?t[Di]=n:delete t[Di]),o}function Zre(t){return ww.call(t)}});var Fw=E(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.merge=void 0;var Gw=kw(),eoe=20;function toe(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=jw(e,t.shift(),0,n);return e}Y_.merge=toe;function xA(t){return $_(t)?t.slice():t}function jw(t,e,n=0,r){let o;if(!(n>eoe)){if(n++,q_(t)||q_(e)||Hw(e))o=xA(e);else if($_(t)){if(o=t.slice(),$_(e))for(let s=0,i=e.length;s<i;s++)o.push(xA(e[s]));else if(xl(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=xA(e[c])}}}else if(xl(t))if(xl(e)){if(!noe(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(q_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(Bw(t,c,r)||Bw(e,c,r))delete o[c];else{if(xl(p)&&xl(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=jw(o[c],l,n,r)}}}}else o=e;return o}}function Bw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function $_(t){return Array.isArray(t)}function Hw(t){return typeof t=="function"}function xl(t){return!q_(t)&&!$_(t)&&!Hw(t)&&typeof t=="object"}function q_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function noe(t,e){return!(!(0,Gw.isPlainObject)(t)||!(0,Gw.isPlainObject)(e))}});var Vw=E(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.callWithTimeout=rc.TimeoutError=void 0;var W_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};rc.TimeoutError=W_;function roe(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new W_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}rc.callWithTimeout=roe});var $w=E(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.isUrlIgnored=oc.urlMatches=void 0;function qw(t,e){return typeof e=="string"?t===e:!!t.match(e)}oc.urlMatches=qw;function ooe(t,e){if(!e)return!1;for(let n of e)if(qw(t,n))return!0;return!1}oc.isUrlIgnored=ooe});var Yw=E(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.Deferred=void 0;var vA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};z_.Deferred=vA});var Ww=E(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.BindOnceFuture=void 0;var soe=Yw(),LA=class{_isCalled=!1;_deferred=new soe.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};K_.BindOnceFuture=LA});var Kw=E(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_.diagLogLevelFromString=void 0;var Po=(b(),O(v)),zw={ALL:Po.DiagLogLevel.ALL,VERBOSE:Po.DiagLogLevel.VERBOSE,DEBUG:Po.DiagLogLevel.DEBUG,INFO:Po.DiagLogLevel.INFO,WARN:Po.DiagLogLevel.WARN,ERROR:Po.DiagLogLevel.ERROR,NONE:Po.DiagLogLevel.NONE};function ioe(t){if(t==null)return;let e=zw[t.toUpperCase()];return e??(Po.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(zw)}, using default`),Po.DiagLogLevel.INFO)}Q_.diagLogLevelFromString=ioe});var Xw=E(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_._export=void 0;var Qw=(b(),O(v)),aoe=bl();function coe(t,e){return new Promise(n=>{Qw.context.with((0,aoe.suppressTracing)(Qw.context.active()),()=>{t.export(e,n)})})}X_._export=coe});var Te=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var uoe=LP();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return uoe.W3CBaggagePropagator}});var loe=DP();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return loe.AnchoredClock}});var Jw=BP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return Jw.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return Jw.sanitizeAttributes}});var Zw=HP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return Zw.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Zw.setGlobalErrorHandler}});var poe=Wg();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return poe.loggingErrorHandler}});var Qn=gw();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return Qn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return Qn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return Qn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return Qn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Qn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Qn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return Qn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return Qn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return Qn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return Qn.timeInputToHrTime}});var doe=Aw();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return doe.unrefTimer}});var _oe=Rw();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return _oe.ExportResultCode}});var foe=Fg();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return foe.parseKeyPairsIntoRecord}});var Ui=yA();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return Ui.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return Ui._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return Ui.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return Ui.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return Ui.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return Ui.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return Ui.otperformance}});var moe=Iw();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return moe.CompositePropagator}});var J_=xw();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return J_.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return J_.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return J_.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return J_.parseTraceParent}});var Z_=vw();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return Z_.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return Z_.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return Z_.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return Z_.setRPCMetadata}});var DA=bl();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return DA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return DA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return DA.unsuppressTracing}});var hoe=CA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return hoe.TraceState}});var Toe=Fw();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return Toe.merge}});var ek=Vw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return ek.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return ek.callWithTimeout}});var tk=$w();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return tk.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return tk.urlMatches}});var Eoe=Ww();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return Eoe.BindOnceFuture}});var Soe=Kw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return Soe.diagLogLevelFromString}});var goe=Xw();y.internal={_export:goe._export}});var nk=E(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.VERSION=void 0;ef.VERSION="0.214.0"});var rk=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.SeverityNumber=void 0;var Aoe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Aoe=vl.SeverityNumber||(vl.SeverityNumber={}))});var nf=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.NOOP_LOGGER=sc.NoopLogger=void 0;var tf=class{emit(e){}};sc.NoopLogger=tf;sc.NOOP_LOGGER=new tf});var ok=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.API_BACKWARDS_COMPATIBILITY_VERSION=Yr.makeGetter=Yr._global=Yr.GLOBAL_LOGS_API_KEY=void 0;Yr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Yr._global=globalThis;function Roe(t,e,n){return r=>r===t?e:n}Yr.makeGetter=Roe;Yr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var UA=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.NOOP_LOGGER_PROVIDER=ic.NoopLoggerProvider=void 0;var yoe=nf(),rf=class{getLogger(e,n,r){return new yoe.NoopLogger}};ic.NoopLoggerProvider=rf;ic.NOOP_LOGGER_PROVIDER=new rf});var sk=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.ProxyLogger=void 0;var Ioe=nf(),wA=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ioe.NOOP_LOGGER}};of.ProxyLogger=wA});var ik=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ProxyLoggerProvider=void 0;var Ooe=UA(),Noe=sk(),kA=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Noe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ooe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};sf.ProxyLoggerProvider=kA});var ck=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.LogsAPI=void 0;var Xn=ok(),boe=UA(),ak=ik(),GA=class t{constructor(){this._proxyLoggerProvider=new ak.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Xn._global[Xn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Xn._global[Xn.GLOBAL_LOGS_API_KEY]=(0,Xn.makeGetter)(Xn.API_BACKWARDS_COMPATIBILITY_VERSION,e,boe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Xn._global[Xn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Xn._global,Xn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Xn._global[Xn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ak.ProxyLoggerProvider}};af.LogsAPI=GA});var BA=E(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.logs=Wr.NoopLogger=Wr.NOOP_LOGGER=Wr.SeverityNumber=void 0;var Coe=rk();Object.defineProperty(Wr,"SeverityNumber",{enumerable:!0,get:function(){return Coe.SeverityNumber}});var uk=nf();Object.defineProperty(Wr,"NOOP_LOGGER",{enumerable:!0,get:function(){return uk.NOOP_LOGGER}});Object.defineProperty(Wr,"NoopLogger",{enumerable:!0,get:function(){return uk.NoopLogger}});var Poe=ck();Wr.logs=Poe.LogsAPI.getInstance()});var lk=E(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.disableInstrumentations=ac.enableInstrumentations=void 0;function Moe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}ac.enableInstrumentations=Moe;function xoe(t){t.forEach(e=>e.disable())}ac.disableInstrumentations=xoe});var _k=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.registerInstrumentations=void 0;var pk=(b(),O(v)),voe=BA(),dk=lk();function Loe(t){let e=t.tracerProvider||pk.trace.getTracerProvider(),n=t.meterProvider||pk.metrics.getMeterProvider(),r=t.loggerProvider||voe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,dk.enableInstrumentations)(o,e,n,r),()=>{(0,dk.disableInstrumentations)(o)}}cf.registerInstrumentations=Loe});var Rk=E(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.satisfies=void 0;var VA=(b(),O(v)),Ek=/^(?: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-]+)*))?$/,Doe=/^(?<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-]+)*))?$/,Uoe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function woe(t,e,n){if(!koe(t))return VA.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Hoe(t);if(!r)return!1;let o=[],s=Sk(r,e,o,n);return s&&!n?.includePrerelease?Boe(r,o):s}uf.satisfies=woe;function koe(t){return typeof t=="string"&&Ek.test(t)}function Sk(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(jA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=cse(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!jA(t,s,n,r))return!1;return!0}return jA(t,e,n,r)}function jA(t,e,n,r){if(e=joe(e,r),e.includes(" "))return Sk(t,e,n,r);{let o=Foe(e);return n.push(o),Goe(t,o)}}function Goe(t,e){if(e.invalid)return!1;if(!e.version||FA(e.version))return!0;let n=mk(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=mk(r,o)}return Uoe[e.op]?.includes(n)}function Boe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function joe(t,e){return t=t.trim(),t=ise(t,e),t=sse(t),t=ase(t,e),t=t.trim(),t}function sn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Hoe(t){let e=t.match(Ek);if(!e){VA.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Foe(t){if(!t)return{};let e=t.match(Doe);if(!e)return VA.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function FA(t){return t==="*"||t==="x"||t==="X"}function fk(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Voe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function qoe(t,e){if(FA(t)||FA(e))return 0;let[n,r]=Voe(fk(t),fk(e));return n>r?1:n<r?-1:0}function mk(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=qoe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var gk="[a-zA-Z0-9-]",Ak="0|[1-9]\\d*",$oe=`\\d*[a-zA-Z-]${gk}*`,Yoe="((?:<|>)?=?)",hk=`(?:${Ak}|${$oe})`,Woe=`(?:-(${hk}(?:\\.${hk})*))`,Tk=`${gk}+`,zoe=`(?:\\+(${Tk}(?:\\.${Tk})*))`,HA=`${Ak}|x|X|\\*`,Ll=`[v=\\s]*(${HA})(?:\\.(${HA})(?:\\.(${HA})(?:${Woe})?${zoe}?)?)?`,Koe=`^${Yoe}\\s*${Ll}$`,Qoe=new RegExp(Koe),Xoe=`^\\s*(${Ll})\\s+-\\s+(${Ll})\\s*$`,Joe=new RegExp(Xoe),Zoe="(?:~>?)",ese=`^${Zoe}${Ll}$`,tse=new RegExp(ese),nse="(?:\\^)",rse=`^${nse}${Ll}$`,ose=new RegExp(rse);function sse(t){let e=tse;return t.replace(e,(n,r,o,s,i)=>{let a;return sn(r)?a="":sn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:sn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function ise(t,e){let n=ose,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return sn(s)?l="":sn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:sn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function ase(t,e){let n=Qoe;return t.replace(n,(r,o,s,i,a,c)=>{let l=sn(s),p=l||sn(i),d=p||sn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function cse(t,e){let n=Joe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(sn(s)?o="":sn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:sn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,sn(d)?p="":sn(_)?p=`<${+d+1}.0.0-0`:sn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var qA=E(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.massUnwrap=vt.unwrap=vt.massWrap=vt.wrap=void 0;var an=console.error.bind(console);function Dl(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var use=(t,e,n)=>{if(!t||!t[e]){an("no original function "+String(e)+" to wrap");return}if(!n){an("no wrapper function"),an(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){an("original object and wrapper must be functions");return}let o=n(r,e);return Dl(o,"__original",r),Dl(o,"__unwrap",()=>{t[e]===o&&Dl(t,e,r)}),Dl(o,"__wrapped",!0),Dl(t,e,o),o};vt.wrap=use;var lse=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,vt.wrap)(r,o,n)})})};vt.massWrap=lse;var pse=(t,e)=>{if(!t||!t[e]){an("no function to unwrap."),an(new Error().stack);return}let n=t[e];if(!n.__unwrap)an("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};vt.unwrap=pse;var dse=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,vt.unwrap)(n,r)})})};vt.massUnwrap=dse;function Ul(t){t&&t.logger&&(typeof t.logger!="function"?an("new logger isn't a function, not replacing"):an=t.logger)}vt.default=Ul;Ul.wrap=vt.wrap;Ul.massWrap=vt.massWrap;Ul.unwrap=vt.unwrap;Ul.massUnwrap=vt.massUnwrap});var yk=E(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.InstrumentationAbstract=void 0;var $A=(b(),O(v)),_se=BA(),lf=qA(),YA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=$A.diag.createComponentLogger({namespace:e}),this._tracer=$A.trace.getTracer(e,n),this._meter=$A.metrics.getMeter(e,n),this._logger=_se.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=lf.wrap;_unwrap=lf.unwrap;_massWrap=lf.massWrap;_massUnwrap=lf.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};pf.InstrumentationAbstract=YA});var Ok=E(($0e,Ik)=>{var cc=1e3,uc=cc*60,lc=uc*60,wi=lc*24,fse=wi*7,mse=wi*365.25;Ik.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return hse(t);if(n==="number"&&isFinite(t))return e.long?Ese(t):Tse(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function hse(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*mse;case"weeks":case"week":case"w":return n*fse;case"days":case"day":case"d":return n*wi;case"hours":case"hour":case"hrs":case"hr":case"h":return n*lc;case"minutes":case"minute":case"mins":case"min":case"m":return n*uc;case"seconds":case"second":case"secs":case"sec":case"s":return n*cc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Tse(t){var e=Math.abs(t);return e>=wi?Math.round(t/wi)+"d":e>=lc?Math.round(t/lc)+"h":e>=uc?Math.round(t/uc)+"m":e>=cc?Math.round(t/cc)+"s":t+"ms"}function Ese(t){var e=Math.abs(t);return e>=wi?df(t,e,wi,"day"):e>=lc?df(t,e,lc,"hour"):e>=uc?df(t,e,uc,"minute"):e>=cc?df(t,e,cc,"second"):t+" ms"}function df(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var WA=E((Y0e,Nk)=>{function Sse(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ok(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function h(...T){if(!h.enabled)return;let S=h,R=Number(new Date),I=R-(d||R);S.diff=I,S.prev=d,S.curr=R,d=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let x=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let on=T[x];B=ve.call(S,on),T.splice(x,1),x--}return B}),n.formatArgs.call(S,T),(S.log||n.log).apply(S,T)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:T=>{_=T}}),typeof n.init=="function"&&n.init(h),h}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,h=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,h=_,f++):(_++,f++);else if(m!==-1)f=m+1,h++,_=h;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Nk.exports=Sse});var bk=E((gn,_f)=>{gn.formatArgs=Ase;gn.save=Rse;gn.load=yse;gn.useColors=gse;gn.storage=Ise();gn.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();gn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gse(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ase(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+_f.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}gn.log=console.debug||console.log||(()=>{});function Rse(t){try{t?gn.storage.setItem("debug",t):gn.storage.removeItem("debug")}catch{}}function yse(){let t;try{t=gn.storage.getItem("debug")||gn.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Ise(){try{return localStorage}catch{}}_f.exports=WA()(gn);var{formatters:Ose}=_f.exports;Ose.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Pk=E((W0e,Ck)=>{"use strict";Ck.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var vk=E((z0e,xk)=>{"use strict";var Nse=U("os"),Mk=U("tty"),Jn=Pk(),{env:gt}=process,us;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?us=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(us=1);"FORCE_COLOR"in gt&&(gt.FORCE_COLOR==="true"?us=1:gt.FORCE_COLOR==="false"?us=0:us=gt.FORCE_COLOR.length===0?1:Math.min(parseInt(gt.FORCE_COLOR,10),3));function zA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function KA(t,e){if(us===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(t&&!e&&us===void 0)return 0;let n=us||0;if(gt.TERM==="dumb")return n;if(process.platform==="win32"){let r=Nse.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in gt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in gt)||gt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in gt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gt.TEAMCITY_VERSION)?1:0;if(gt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in gt){let r=parseInt((gt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gt.TERM)||"COLORTERM"in gt?1:n}function bse(t){let e=KA(t,t&&t.isTTY);return zA(e)}xk.exports={supportsColor:bse,stdout:zA(KA(!0,Mk.isatty(1))),stderr:zA(KA(!0,Mk.isatty(2)))}});var Dk=E((At,mf)=>{var Cse=U("tty"),ff=U("util");At.init=Use;At.log=vse;At.formatArgs=Mse;At.save=Lse;At.load=Dse;At.useColors=Pse;At.destroy=ff.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");At.colors=[6,2,3,4,5,1];try{let t=vk();t&&(t.stderr||t).level>=2&&(At.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}At.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function Pse(){return"colors"in At.inspectOpts?!!At.inspectOpts.colors:Cse.isatty(process.stderr.fd)}function Mse(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
3
|
+
var V9=Object.create;var a_=Object.defineProperty;var q9=Object.getOwnPropertyDescriptor;var $9=Object.getOwnPropertyNames;var Y9=Object.getPrototypeOf,W9=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),aS=(t,e)=>{for(var n in e)a_(t,n,{get:e[n],enumerable:!0})},jC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $9(e))!W9.call(t,o)&&o!==n&&a_(t,o,{get:()=>e[o],enumerable:!(r=q9(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?V9(Y9(t)):{},jC(e||!t||!t.__esModule?a_(n,"default",{value:t,enumerable:!0}):n,t)),N=t=>jC(a_({},"__esModule",{value:!0}),t);var No,cS=z(()=>{No="1.9.1"});function z9(t){let e=new Set([t]),n=new Set,r=t.match(HC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(HC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var HC,FC,VC=z(()=>{cS();HC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;FC=z9(No)});function jr(t,e,n,r=!1){var o;let s=Sl[gl]=(o=Sl[gl])!==null&&o!==void 0?o:{version:No};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==No){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${No}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${No}.`),!0}function Dn(t){var e,n;let r=(e=Sl[gl])===null||e===void 0?void 0:e.version;if(!(!r||!FC(r)))return(n=Sl[gl])===null||n===void 0?void 0:n[t]}function Hr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${No}.`);let n=Sl[gl];n&&delete n[t]}var K9,gl,Sl,Ni=z(()=>{cS();VC();K9=No.split(".")[0],gl=Symbol.for(`opentelemetry.js.api.${K9}`),Sl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Al(t,e,n){let r=Dn("diag");if(r)return r[t](e,...n)}var c_,qC=z(()=>{Ni();c_=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Al("debug",this._namespace,e)}error(...e){return Al("error",this._namespace,e)}info(...e){return Al("info",this._namespace,e)}warn(...e){return Al("warn",this._namespace,e)}verbose(...e){return Al("verbose",this._namespace,e)}}});var pt,u_=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(pt||(pt={}))});function $C(t,e){t<pt.NONE?t=pt.NONE:t>pt.ALL&&(t=pt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",pt.ERROR),warn:n("warn",pt.WARN),info:n("info",pt.INFO),debug:n("debug",pt.DEBUG),verbose:n("verbose",pt.VERBOSE)}}var YC=z(()=>{u_()});var Q9,Et,Oi=z(()=>{qC();YC();u_();Ni();Q9="diag",Et=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=Dn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:pt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=Dn("diag"),p=$C((a=s.logLevel)!==null&&a!==void 0?a:pt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return jr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Hr(Q9,n)},n.createComponentLogger=o=>new c_(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var l_,WC=z(()=>{l_=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var zC,KC=z(()=>{zC=Symbol("BaggageEntryMetadata")});function QC(t={}){return new l_(new Map(Object.entries(t)))}function XC(t){return typeof t!="string"&&(X9.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:zC,toString(){return t}}}var X9,uS=z(()=>{Oi();WC();KC();X9=Et.instance()});function Un(t){return Symbol.for(t)}var lS,za,Rl=z(()=>{lS=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},za=new lS});var pS,dS,p_,JC=z(()=>{pS=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],dS={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(dS[e]=console[e])}p_=class{constructor(){function e(n){return function(...r){let o=dS[n];if(typeof o!="function"&&(o=dS.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<pS.length;n++)this[pS[n].n]=e(pS[n].c)}}});function ZC(){return AS}var _S,Ka,fS,mS,hS,TS,yl,ES,gS,SS,AS,J9,Z9,eQ,tQ,nQ,rQ,oQ,RS=z(()=>{_S=class{constructor(){}createGauge(e,n){return Z9}createHistogram(e,n){return eQ}createCounter(e,n){return J9}createUpDownCounter(e,n){return tQ}createObservableGauge(e,n){return rQ}createObservableCounter(e,n){return nQ}createObservableUpDownCounter(e,n){return oQ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},Ka=class{},fS=class extends Ka{add(e,n){}},mS=class extends Ka{add(e,n){}},hS=class extends Ka{record(e,n){}},TS=class extends Ka{record(e,n){}},yl=class{addCallback(e){}removeCallback(e){}},ES=class extends yl{},gS=class extends yl{},SS=class extends yl{},AS=new _S,J9=new fS,Z9=new hS,eQ=new TS,tQ=new mS,nQ=new ES,rQ=new gS,oQ=new SS});var d_,eP=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(d_||(d_={}))});var __,f_,yS=z(()=>{__={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},f_={set(t,e,n){t!=null&&(t[e]=n)}}});var m_,tP=z(()=>{Rl();m_=class{active(){return za}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var IS,sQ,Fr,Il=z(()=>{tP();Ni();Oi();IS="context",sQ=new m_,Fr=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return jr(IS,e,Et.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return Dn(IS)||sQ}disable(){this._getContextManager().disable(),Hr(IS,Et.instance())}}});var Ft,NS=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Ft||(Ft={}))});var Nl,bi,h_,T_=z(()=>{NS();Nl="0000000000000000",bi="00000000000000000000000000000000",h_={traceId:bi,spanId:Nl,traceFlags:Ft.NONE}});var Vr,E_=z(()=>{T_();Vr=class{constructor(e=h_){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function g_(t){return t.getValue(OS)||void 0}function nP(){return g_(Fr.getInstance().active())}function Ol(t,e){return t.setValue(OS,e)}function rP(t){return t.deleteValue(OS)}function oP(t,e){return Ol(t,new Vr(e))}function S_(t){var e;return(e=g_(t))===null||e===void 0?void 0:e.spanContext()}var OS,bS=z(()=>{Rl();E_();Il();OS=Un("OpenTelemetry Context Key SPAN")});function sP(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(A_[t.charCodeAt(r)]|0)+(A_[t.charCodeAt(r+1)]|0)+(A_[t.charCodeAt(r+2)]|0)+(A_[t.charCodeAt(r+3)]|0);return n===e}function CS(t){return sP(t,32)&&t!==bi}function PS(t){return sP(t,16)&&t!==Nl}function Oo(t){return CS(t.traceId)&&PS(t.spanId)}function iP(t){return new Vr(t)}var A_,R_=z(()=>{T_();E_();A_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function iQ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var MS,Qa,xS=z(()=>{Il();bS();E_();R_();MS=Fr.getInstance(),Qa=class{startSpan(e,n,r=MS.active()){if(!!n?.root)return new Vr;let s=r&&S_(r);return iQ(s)&&Oo(s)?new Vr(s):new Vr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??MS.active(),l=this.startSpan(e,s,c),p=Ol(c,l);return MS.with(p,a,void 0,l)}}});var aQ,Xa,vS=z(()=>{xS();aQ=new Qa,Xa=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):aQ}}});var y_,aP=z(()=>{xS();y_=class{getTracer(e,n,r){return new Qa}}});var cQ,Ci,LS=z(()=>{vS();aP();cQ=new y_,Ci=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Xa(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:cQ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var I_,cP=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(I_||(I_={}))});var Oe,uP=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Oe||(Oe={}))});var Be,lP=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function pP(t){return pQ.test(t)}function dP(t){return dQ.test(t)&&!_Q.test(t)}var DS,uQ,lQ,pQ,dQ,_Q,_P=z(()=>{DS="[_0-9a-z-*/]",uQ=`[a-z]${DS}{0,255}`,lQ=`[a-z0-9]${DS}{0,240}@[a-z]${DS}{0,13}`,pQ=new RegExp(`^(?:${uQ}|${lQ})$`),dQ=/^[ -~]{0,255}[!-~]$/,_Q=/,|=/});var fP,fQ,mP,hP,N_,TP=z(()=>{_P();fP=32,fQ=512,mP=",",hP="=",N_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+hP+this.get(n)),e),[]).join(mP)}_parse(e){e.length>fQ||(this._internalState=e.split(mP).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(hP);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);pP(i)&&dP(a)&&n.set(i,a)}return n},new Map),this._internalState.size>fP&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,fP))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function EP(t){return new N_(t)}var gP=z(()=>{TP()});var P,SP=z(()=>{Il();P=Fr.getInstance()});var wn,AP=z(()=>{Oi();wn=Et.instance()});var US,RP,yP=z(()=>{RS();US=class{getMeter(e,n,r){return AS}},RP=new US});var wS,O_,IP=z(()=>{yP();Ni();Oi();wS="metrics",O_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return jr(wS,e,Et.instance())}getMeterProvider(){return Dn(wS)||RP}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Hr(wS,Et.instance())}}});var kS,NP=z(()=>{IP();kS=O_.getInstance()});var b_,OP=z(()=>{b_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function BS(t){return t.getValue(GS)||void 0}function bP(){return BS(Fr.getInstance().active())}function CP(t,e){return t.setValue(GS,e)}function PP(t){return t.deleteValue(GS)}var GS,MP=z(()=>{Il();Rl();GS=Un("OpenTelemetry Baggage Key")});var jS,mQ,C_,xP=z(()=>{Ni();OP();yS();MP();uS();Oi();jS="propagation",mQ=new b_,C_=class t{constructor(){this.createBaggage=QC,this.getBaggage=BS,this.getActiveBaggage=bP,this.setBaggage=CP,this.deleteBaggage=PP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return jr(jS,e,Et.instance())}inject(e,n,r=f_){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=__){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Hr(jS,Et.instance())}_getGlobalPropagator(){return Dn(jS)||mQ}}});var Ar,vP=z(()=>{xP();Ar=C_.getInstance()});var HS,P_,LP=z(()=>{Ni();LS();R_();bS();Oi();HS="trace",P_=class t{constructor(){this._proxyTracerProvider=new Ci,this.wrapSpanContext=iP,this.isSpanContextValid=Oo,this.deleteSpan=rP,this.getSpan=g_,this.getActiveSpan=nP,this.getSpanContext=S_,this.setSpan=Ol,this.setSpanContext=oP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=jr(HS,this._proxyTracerProvider,Et.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return Dn(HS)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Hr(HS,Et.instance()),this._proxyTracerProvider=new Ci}}});var X,DP=z(()=>{LP();X=P_.getInstance()});var v={};aS(v,{DiagConsoleLogger:()=>p_,DiagLogLevel:()=>pt,INVALID_SPANID:()=>Nl,INVALID_SPAN_CONTEXT:()=>h_,INVALID_TRACEID:()=>bi,ProxyTracer:()=>Xa,ProxyTracerProvider:()=>Ci,ROOT_CONTEXT:()=>za,SamplingDecision:()=>I_,SpanKind:()=>Oe,SpanStatusCode:()=>Be,TraceFlags:()=>Ft,ValueType:()=>d_,baggageEntryMetadataFromString:()=>XC,context:()=>P,createContextKey:()=>Un,createNoopMeter:()=>ZC,createTraceState:()=>EP,default:()=>hQ,defaultTextMapGetter:()=>__,defaultTextMapSetter:()=>f_,diag:()=>wn,isSpanContextValid:()=>Oo,isValidSpanId:()=>PS,isValidTraceId:()=>CS,metrics:()=>kS,propagation:()=>Ar,trace:()=>X});var hQ,b=z(()=>{uS();Rl();JC();u_();RS();eP();yS();vS();LS();cP();uP();lP();NS();gP();R_();T_();SP();AP();NP();vP();DP();hQ={context:P,diag:wn,metrics:kS,propagation:Ar,trace:X}});var bl=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isTracingSuppressed=is.unsuppressTracing=is.suppressTracing=void 0;var TQ=(b(),N(v)),FS=(0,TQ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function EQ(t){return t.setValue(FS,!0)}is.suppressTracing=EQ;function gQ(t){return t.deleteValue(FS)}is.unsuppressTracing=gQ;function SQ(t){return t.getValue(FS)===!0}is.isTracingSuppressed=SQ});var VS=E(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.BAGGAGE_MAX_TOTAL_LENGTH=Vt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=Vt.BAGGAGE_MAX_NAME_VALUE_PAIRS=Vt.BAGGAGE_HEADER=Vt.BAGGAGE_ITEMS_SEPARATOR=Vt.BAGGAGE_PROPERTIES_SEPARATOR=Vt.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;Vt.BAGGAGE_KEY_PAIR_SEPARATOR="=";Vt.BAGGAGE_PROPERTIES_SEPARATOR=";";Vt.BAGGAGE_ITEMS_SEPARATOR=",";Vt.BAGGAGE_HEADER="baggage";Vt.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;Vt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;Vt.BAGGAGE_MAX_TOTAL_LENGTH=8192});var qS=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.parseKeyPairsIntoRecord=qr.parsePairKeyValue=qr.getKeyPairs=qr.serializeKeyPairs=void 0;var AQ=(b(),N(v)),Ja=VS();function RQ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Ja.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Ja.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}qr.serializeKeyPairs=RQ;function yQ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Ja.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}qr.getKeyPairs=yQ;function UP(t){if(!t)return;let e=t.indexOf(Ja.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Ja.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,AQ.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}qr.parsePairKeyValue=UP;function IQ(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Ja.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=UP(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}qr.parseKeyPairsIntoRecord=IQ});var wP=E(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_.W3CBaggagePropagator=void 0;var $S=(b(),N(v)),NQ=bl(),Pi=VS(),YS=qS(),WS=class{inject(e,n,r){let o=$S.propagation.getBaggage(e);if(!o||(0,NQ.isTracingSuppressed)(e))return;let s=(0,YS.getKeyPairs)(o).filter(a=>a.length<=Pi.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Pi.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,YS.serializeKeyPairs)(s);i.length>0&&r.set(n,Pi.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Pi.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Pi.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Pi.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,YS.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:$S.propagation.setBaggage(e,$S.propagation.createBaggage(i))}fields(){return[Pi.BAGGAGE_HEADER]}};M_.W3CBaggagePropagator=WS});var kP=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.AnchoredClock=void 0;var zS=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};x_.AnchoredClock=zS});var FP=E(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isAttributeValue=as.isAttributeKey=as.sanitizeAttributes=void 0;var GP=(b(),N(v));function OQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!BP(n)){GP.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!jP(r)){GP.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}as.sanitizeAttributes=OQ;function BP(t){return typeof t=="string"&&t!==""}as.isAttributeKey=BP;function jP(t){return t==null?!0:Array.isArray(t)?bQ(t):HP(typeof t)}as.isAttributeValue=jP;function bQ(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(HP(r)){e=r;continue}return!1}return!1}}return!0}function HP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var KS=E(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});v_.loggingErrorHandler=void 0;var CQ=(b(),N(v));function PQ(){return t=>{CQ.diag.error(MQ(t))}}v_.loggingErrorHandler=PQ;function MQ(t){return typeof t=="string"?t:JSON.stringify(xQ(t))}function xQ(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var qP=E(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.globalErrorHandler=Za.setGlobalErrorHandler=void 0;var vQ=KS(),VP=(0,vQ.loggingErrorHandler)();function LQ(t){VP=t}Za.setGlobalErrorHandler=LQ;function DQ(t){try{VP(t)}catch{}}Za.globalErrorHandler=DQ});var zP=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getStringListFromEnv=$r.getBooleanFromEnv=$r.getStringFromEnv=$r.getNumberFromEnv=void 0;var $P=(b(),N(v)),YP=U("util");function UQ(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){$P.diag.warn(`Unknown value ${(0,YP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}$r.getNumberFromEnv=UQ;function WP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$r.getStringFromEnv=WP;function wQ(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||$P.diag.warn(`Unknown value ${(0,YP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$r.getBooleanFromEnv=wQ;function kQ(t){return WP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$r.getStringListFromEnv=kQ});var KP=E(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});L_._globalThis=void 0;L_._globalThis=globalThis});var QP=E(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});D_.VERSION=void 0;D_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var QS=z(()=>{});var XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,gM,SM,AM,RM,yM,IM,NM,OM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,gx,Sx,Ax,Rx,yx,Ix,Nx,Ox,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,fv,mv,hv,GQ,XS,BQ,jQ,HQ,FQ,JS,VQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,JQ,ZQ,eX,tX,nX,rX,oX,sX,iX,ZS,aX,cX,uX,lX,pX,dX,_X,fX,mX,hX,TX,EX,eA,gX,SX,tA,nA,AX,RX,yX,IX,NX,OX,bX,CX,PX,MX,xX,vX,LX,DX,UX,wX,kX,Cl,ec,rA,GX,BX,Mi,jX,HX,FX,VX,oA,sA,qX,iA,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,uJ,lJ,pJ,dJ,_J,aA,fJ,mJ,hJ,TJ,EJ,gJ,SJ,AJ,RJ,yJ,IJ,NJ,OJ,bJ,CJ,PJ,MJ,xJ,vJ,cA,LJ,uA,DJ,UJ,wJ,kJ,GJ,BJ,jJ,HJ,FJ,Tv,Ev,gv,Sv,Av,Rv,yv,Iv,Nv,Ov,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,aL,cL,uL,VJ,qJ,$J,YJ,WJ,zJ,KJ,QJ,XJ,JJ,ZJ,e5,t5,n5,r5,o5,s5,i5,a5,c5,u5,l5,p5,d5,_5,f5,m5,h5,T5,E5,g5,S5,A5,R5,y5,I5,N5,O5,b5,C5,P5,M5,x5,v5,L5,D5,U5,w5,lL,pL,dL,_L,fL,mL,hL,TL,EL,gL,SL,k5,G5,B5,j5,H5,F5,V5,q5,$5,Y5,W5,z5,AL,RL,yL,IL,NL,K5,Q5,X5,J5,Z5,eZ,OL,bL,CL,tZ,nZ,rZ,oZ,PL,ML,xL,vL,sZ,iZ,aZ,cZ,uZ,LL,DL,UL,wL,kL,GL,BL,lZ,pZ,dZ,_Z,fZ,mZ,hZ,TZ,jL,HL,FL,VL,qL,EZ,gZ,SZ,AZ,RZ,yZ,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,u0,l0,p0,IZ,NZ,OZ,bZ,CZ,PZ,MZ,xZ,vZ,LZ,DZ,UZ,wZ,kZ,GZ,BZ,jZ,HZ,FZ,VZ,qZ,$Z,d0,_0,f0,m0,h0,YZ,WZ,zZ,KZ,QZ,XZ,T0,E0,JZ,ZZ,e6,g0,S0,t6,n6,r6,A0,R0,y0,I0,N0,O0,b0,C0,P0,M0,x0,v0,L0,D0,U0,w0,k0,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,h6,T6,E6,g6,S6,A6,G0,B0,R6,y6,I6,j0=z(()=>{QS();XP="aws.lambda.invoked_arn",JP="db.system",ZP="db.connection_string",eM="db.user",tM="db.jdbc.driver_classname",nM="db.name",rM="db.statement",oM="db.operation",sM="db.mssql.instance_name",iM="db.cassandra.keyspace",aM="db.cassandra.page_size",cM="db.cassandra.consistency_level",uM="db.cassandra.table",lM="db.cassandra.idempotence",pM="db.cassandra.speculative_execution_count",dM="db.cassandra.coordinator.id",_M="db.cassandra.coordinator.dc",fM="db.hbase.namespace",mM="db.redis.database_index",hM="db.mongodb.collection",TM="db.sql.table",EM="exception.type",gM="exception.message",SM="exception.stacktrace",AM="exception.escaped",RM="faas.trigger",yM="faas.execution",IM="faas.document.collection",NM="faas.document.operation",OM="faas.document.time",bM="faas.document.name",CM="faas.time",PM="faas.cron",MM="faas.coldstart",xM="faas.invoked_name",vM="faas.invoked_provider",LM="faas.invoked_region",DM="net.transport",UM="net.peer.ip",wM="net.peer.port",kM="net.peer.name",GM="net.host.ip",BM="net.host.port",jM="net.host.name",HM="net.host.connection.type",FM="net.host.connection.subtype",VM="net.host.carrier.name",qM="net.host.carrier.mcc",$M="net.host.carrier.mnc",YM="net.host.carrier.icc",WM="peer.service",zM="enduser.id",KM="enduser.role",QM="enduser.scope",XM="thread.id",JM="thread.name",ZM="code.function",ex="code.namespace",tx="code.filepath",nx="code.lineno",rx="http.method",ox="http.url",sx="http.target",ix="http.host",ax="http.scheme",cx="http.status_code",ux="http.flavor",lx="http.user_agent",px="http.request_content_length",dx="http.request_content_length_uncompressed",_x="http.response_content_length",fx="http.response_content_length_uncompressed",mx="http.server_name",hx="http.route",Tx="http.client_ip",Ex="aws.dynamodb.table_names",gx="aws.dynamodb.consumed_capacity",Sx="aws.dynamodb.item_collection_metrics",Ax="aws.dynamodb.provisioned_read_capacity",Rx="aws.dynamodb.provisioned_write_capacity",yx="aws.dynamodb.consistent_read",Ix="aws.dynamodb.projection",Nx="aws.dynamodb.limit",Ox="aws.dynamodb.attributes_to_get",bx="aws.dynamodb.index_name",Cx="aws.dynamodb.select",Px="aws.dynamodb.global_secondary_indexes",Mx="aws.dynamodb.local_secondary_indexes",xx="aws.dynamodb.exclusive_start_table",vx="aws.dynamodb.table_count",Lx="aws.dynamodb.scan_forward",Dx="aws.dynamodb.segment",Ux="aws.dynamodb.total_segments",wx="aws.dynamodb.count",kx="aws.dynamodb.scanned_count",Gx="aws.dynamodb.attribute_definitions",Bx="aws.dynamodb.global_secondary_index_updates",jx="messaging.system",Hx="messaging.destination",Fx="messaging.destination_kind",Vx="messaging.temp_destination",qx="messaging.protocol",$x="messaging.protocol_version",Yx="messaging.url",Wx="messaging.message_id",zx="messaging.conversation_id",Kx="messaging.message_payload_size_bytes",Qx="messaging.message_payload_compressed_size_bytes",Xx="messaging.operation",Jx="messaging.consumer_id",Zx="messaging.rabbitmq.routing_key",ev="messaging.kafka.message_key",tv="messaging.kafka.consumer_group",nv="messaging.kafka.client_id",rv="messaging.kafka.partition",ov="messaging.kafka.tombstone",sv="rpc.system",iv="rpc.service",av="rpc.method",cv="rpc.grpc.status_code",uv="rpc.jsonrpc.version",lv="rpc.jsonrpc.request_id",pv="rpc.jsonrpc.error_code",dv="rpc.jsonrpc.error_message",_v="message.type",fv="message.id",mv="message.compressed_size",hv="message.uncompressed_size",GQ=XP,XS=JP,BQ=ZP,jQ=eM,HQ=tM,FQ=nM,JS=rM,VQ=oM,qQ=sM,$Q=iM,YQ=aM,WQ=cM,zQ=uM,KQ=lM,QQ=pM,XQ=dM,JQ=_M,ZQ=fM,eX=mM,tX=hM,nX=TM,rX=EM,oX=gM,sX=SM,iX=AM,ZS=RM,aX=yM,cX=IM,uX=NM,lX=OM,pX=bM,dX=CM,_X=PM,fX=MM,mX=xM,hX=vM,TX=LM,EX=DM,eA=UM,gX=wM,SX=kM,tA=GM,nA=BM,AX=jM,RX=HM,yX=FM,IX=VM,NX=qM,OX=$M,bX=YM,CX=WM,PX=zM,MX=KM,xX=QM,vX=XM,LX=JM,DX=ZM,UX=ex,wX=tx,kX=nx,Cl=rx,ec=ox,rA=sx,GX=ix,BX=ax,Mi=cx,jX=ux,HX=lx,FX=px,VX=dx,oA=_x,sA=fx,qX=mx,iA=hx,$X=Tx,YX=Ex,WX=gx,zX=Sx,KX=Ax,QX=Rx,XX=yx,JX=Ix,ZX=Nx,eJ=Ox,tJ=bx,nJ=Cx,rJ=Px,oJ=Mx,sJ=xx,iJ=vx,aJ=Lx,cJ=Dx,uJ=Ux,lJ=wx,pJ=kx,dJ=Gx,_J=Bx,aA=jx,fJ=Hx,mJ=Fx,hJ=Vx,TJ=qx,EJ=$x,gJ=Yx,SJ=Wx,AJ=zx,RJ=Kx,yJ=Qx,IJ=Xx,NJ=Jx,OJ=Zx,bJ=ev,CJ=tv,PJ=nv,MJ=rv,xJ=ov,vJ=sv,cA=iv,LJ=av,uA=cv,DJ=uv,UJ=lv,wJ=pv,kJ=dv,GJ=_v,BJ=fv,jJ=mv,HJ=hv,FJ=We([XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,gM,SM,AM,RM,yM,IM,NM,OM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,gx,Sx,Ax,Rx,yx,Ix,Nx,Ox,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,fv,mv,hv]),Tv="other_sql",Ev="mssql",gv="mysql",Sv="oracle",Av="db2",Rv="postgresql",yv="redshift",Iv="hive",Nv="cloudscape",Ov="hsqldb",bv="progress",Cv="maxdb",Pv="hanadb",Mv="ingres",xv="firstsql",vv="edb",Lv="cache",Dv="adabas",Uv="firebird",wv="derby",kv="filemaker",Gv="informix",Bv="instantdb",jv="interbase",Hv="mariadb",Fv="netezza",Vv="pervasive",qv="pointbase",$v="sqlite",Yv="sybase",Wv="teradata",zv="vertica",Kv="h2",Qv="coldfusion",Xv="cassandra",Jv="hbase",Zv="mongodb",eL="redis",tL="couchbase",nL="couchdb",rL="cosmosdb",oL="dynamodb",sL="neo4j",iL="geode",aL="elasticsearch",cL="memcached",uL="cockroachdb",VJ=Tv,qJ=Ev,$J=gv,YJ=Sv,WJ=Av,zJ=Rv,KJ=yv,QJ=Iv,XJ=Nv,JJ=Ov,ZJ=bv,e5=Cv,t5=Pv,n5=Mv,r5=xv,o5=vv,s5=Lv,i5=Dv,a5=Uv,c5=wv,u5=kv,l5=Gv,p5=Bv,d5=jv,_5=Hv,f5=Fv,m5=Vv,h5=qv,T5=$v,E5=Yv,g5=Wv,S5=zv,A5=Kv,R5=Qv,y5=Xv,I5=Jv,N5=Zv,O5=eL,b5=tL,C5=nL,P5=rL,M5=oL,x5=sL,v5=iL,L5=aL,D5=cL,U5=uL,w5=We([Tv,Ev,gv,Sv,Av,Rv,yv,Iv,Nv,Ov,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,aL,cL,uL]),lL="all",pL="each_quorum",dL="quorum",_L="local_quorum",fL="one",mL="two",hL="three",TL="local_one",EL="any",gL="serial",SL="local_serial",k5=lL,G5=pL,B5=dL,j5=_L,H5=fL,F5=mL,V5=hL,q5=TL,$5=EL,Y5=gL,W5=SL,z5=We([lL,pL,dL,_L,fL,mL,hL,TL,EL,gL,SL]),AL="datasource",RL="http",yL="pubsub",IL="timer",NL="other",K5=AL,Q5=RL,X5=yL,J5=IL,Z5=NL,eZ=We([AL,RL,yL,IL,NL]),OL="insert",bL="edit",CL="delete",tZ=OL,nZ=bL,rZ=CL,oZ=We([OL,bL,CL]),PL="alibaba_cloud",ML="aws",xL="azure",vL="gcp",sZ=PL,iZ=ML,aZ=xL,cZ=vL,uZ=We([PL,ML,xL,vL]),LL="ip_tcp",DL="ip_udp",UL="ip",wL="unix",kL="pipe",GL="inproc",BL="other",lZ=LL,pZ=DL,dZ=UL,_Z=wL,fZ=kL,mZ=GL,hZ=BL,TZ=We([LL,DL,UL,wL,kL,GL,BL]),jL="wifi",HL="wired",FL="cell",VL="unavailable",qL="unknown",EZ=jL,gZ=HL,SZ=FL,AZ=VL,RZ=qL,yZ=We([jL,HL,FL,VL,qL]),$L="gprs",YL="edge",WL="umts",zL="cdma",KL="evdo_0",QL="evdo_a",XL="cdma2000_1xrtt",JL="hsdpa",ZL="hsupa",e0="hspa",t0="iden",n0="evdo_b",r0="lte",o0="ehrpd",s0="hspap",i0="gsm",a0="td_scdma",c0="iwlan",u0="nr",l0="nrnsa",p0="lte_ca",IZ=$L,NZ=YL,OZ=WL,bZ=zL,CZ=KL,PZ=QL,MZ=XL,xZ=JL,vZ=ZL,LZ=e0,DZ=t0,UZ=n0,wZ=r0,kZ=o0,GZ=s0,BZ=i0,jZ=a0,HZ=c0,FZ=u0,VZ=l0,qZ=p0,$Z=We([$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,u0,l0,p0]),d0="1.0",_0="1.1",f0="2.0",m0="SPDY",h0="QUIC",YZ=d0,WZ=_0,zZ=f0,KZ=m0,QZ=h0,XZ={HTTP_1_0:d0,HTTP_1_1:_0,HTTP_2_0:f0,SPDY:m0,QUIC:h0},T0="queue",E0="topic",JZ=T0,ZZ=E0,e6=We([T0,E0]),g0="receive",S0="process",t6=g0,n6=S0,r6=We([g0,S0]),A0=0,R0=1,y0=2,I0=3,N0=4,O0=5,b0=6,C0=7,P0=8,M0=9,x0=10,v0=11,L0=12,D0=13,U0=14,w0=15,k0=16,o6=A0,s6=R0,i6=y0,a6=I0,c6=N0,u6=O0,l6=b0,p6=C0,d6=P0,_6=M0,f6=x0,m6=v0,h6=L0,T6=D0,E6=U0,g6=w0,S6=k0,A6={OK:A0,CANCELLED:R0,UNKNOWN:y0,INVALID_ARGUMENT:I0,DEADLINE_EXCEEDED:N0,NOT_FOUND:O0,ALREADY_EXISTS:b0,PERMISSION_DENIED:C0,RESOURCE_EXHAUSTED:P0,FAILED_PRECONDITION:M0,ABORTED:x0,OUT_OF_RANGE:v0,UNIMPLEMENTED:L0,INTERNAL:D0,UNAVAILABLE:U0,DATA_LOSS:w0,UNAUTHENTICATED:k0},G0="SENT",B0="RECEIVED",R6=G0,y6=B0,I6=We([G0,B0])});var H0=z(()=>{j0()});var F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,gD,SD,AD,RD,yD,ID,ND,OD,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,dU,_U,fU,N6,O6,b6,C6,P6,M6,x6,v6,L6,D6,U6,w6,k6,G6,B6,j6,H6,F6,V6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,s8,i8,a8,c8,u8,l8,p8,d8,_8,f8,m8,h8,T8,E8,g8,S8,A8,R8,y8,I8,N8,O8,b8,C8,P8,M8,x8,v8,L8,D8,U8,w8,k8,G8,B8,j8,H8,lA,F8,V8,q8,$8,Y8,W8,z8,K8,Q8,X8,mU,hU,TU,EU,J8,Z8,e7,t7,n7,gU,SU,AU,RU,yU,IU,NU,OU,bU,CU,PU,MU,xU,vU,LU,DU,UU,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,f7,m7,h7,T7,E7,g7,S7,wU,kU,A7,R7,y7,GU,BU,jU,HU,FU,VU,qU,I7,N7,O7,b7,C7,P7,M7,x7,$U,YU,WU,zU,KU,QU,XU,JU,ZU,ew,tw,v7,L7,D7,U7,w7,k7,G7,B7,j7,H7,F7,V7,nw,rw,ow,sw,iw,aw,cw,uw,lw,pw,q7,$7,Y7,W7,z7,K7,Q7,X7,J7,Z7,eee,dw=z(()=>{QS();F0="cloud.provider",V0="cloud.account.id",q0="cloud.region",$0="cloud.availability_zone",Y0="cloud.platform",W0="aws.ecs.container.arn",z0="aws.ecs.cluster.arn",K0="aws.ecs.launchtype",Q0="aws.ecs.task.arn",X0="aws.ecs.task.family",J0="aws.ecs.task.revision",Z0="aws.eks.cluster.arn",eD="aws.log.group.names",tD="aws.log.group.arns",nD="aws.log.stream.names",rD="aws.log.stream.arns",oD="container.name",sD="container.id",iD="container.runtime",aD="container.image.name",cD="container.image.tag",uD="deployment.environment",lD="device.id",pD="device.model.identifier",dD="device.model.name",_D="faas.name",fD="faas.id",mD="faas.version",hD="faas.instance",TD="faas.max_memory",ED="host.id",gD="host.name",SD="host.type",AD="host.arch",RD="host.image.name",yD="host.image.id",ID="host.image.version",ND="k8s.cluster.name",OD="k8s.node.name",bD="k8s.node.uid",CD="k8s.namespace.name",PD="k8s.pod.uid",MD="k8s.pod.name",xD="k8s.container.name",vD="k8s.replicaset.uid",LD="k8s.replicaset.name",DD="k8s.deployment.uid",UD="k8s.deployment.name",wD="k8s.statefulset.uid",kD="k8s.statefulset.name",GD="k8s.daemonset.uid",BD="k8s.daemonset.name",jD="k8s.job.uid",HD="k8s.job.name",FD="k8s.cronjob.uid",VD="k8s.cronjob.name",qD="os.type",$D="os.description",YD="os.name",WD="os.version",zD="process.pid",KD="process.executable.name",QD="process.executable.path",XD="process.command",JD="process.command_line",ZD="process.command_args",eU="process.owner",tU="process.runtime.name",nU="process.runtime.version",rU="process.runtime.description",oU="service.name",sU="service.namespace",iU="service.instance.id",aU="service.version",cU="telemetry.sdk.name",uU="telemetry.sdk.language",lU="telemetry.sdk.version",pU="telemetry.auto.version",dU="webengine.name",_U="webengine.version",fU="webengine.description",N6=F0,O6=V0,b6=q0,C6=$0,P6=Y0,M6=W0,x6=z0,v6=K0,L6=Q0,D6=X0,U6=J0,w6=Z0,k6=eD,G6=tD,B6=nD,j6=rD,H6=oD,F6=sD,V6=iD,q6=aD,$6=cD,Y6=uD,W6=lD,z6=pD,K6=dD,Q6=_D,X6=fD,J6=mD,Z6=hD,e8=TD,t8=ED,n8=gD,r8=SD,o8=AD,s8=RD,i8=yD,a8=ID,c8=ND,u8=OD,l8=bD,p8=CD,d8=PD,_8=MD,f8=xD,m8=vD,h8=LD,T8=DD,E8=UD,g8=wD,S8=kD,A8=GD,R8=BD,y8=jD,I8=HD,N8=FD,O8=VD,b8=qD,C8=$D,P8=YD,M8=WD,x8=zD,v8=KD,L8=QD,D8=XD,U8=JD,w8=ZD,k8=eU,G8=tU,B8=nU,j8=rU,H8=oU,lA=sU,F8=iU,V8=aU,q8=cU,$8=uU,Y8=lU,W8=pU,z8=dU,K8=_U,Q8=fU,X8=We([F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,gD,SD,AD,RD,yD,ID,ND,OD,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,dU,_U,fU]),mU="alibaba_cloud",hU="aws",TU="azure",EU="gcp",J8=mU,Z8=hU,e7=TU,t7=EU,n7=We([mU,hU,TU,EU]),gU="alibaba_cloud_ecs",SU="alibaba_cloud_fc",AU="aws_ec2",RU="aws_ecs",yU="aws_eks",IU="aws_lambda",NU="aws_elastic_beanstalk",OU="azure_vm",bU="azure_container_instances",CU="azure_aks",PU="azure_functions",MU="azure_app_service",xU="gcp_compute_engine",vU="gcp_cloud_run",LU="gcp_kubernetes_engine",DU="gcp_cloud_functions",UU="gcp_app_engine",r7=gU,o7=SU,s7=AU,i7=RU,a7=yU,c7=IU,u7=NU,l7=OU,p7=bU,d7=CU,_7=PU,f7=MU,m7=xU,h7=vU,T7=LU,E7=DU,g7=UU,S7=We([gU,SU,AU,RU,yU,IU,NU,OU,bU,CU,PU,MU,xU,vU,LU,DU,UU]),wU="ec2",kU="fargate",A7=wU,R7=kU,y7=We([wU,kU]),GU="amd64",BU="arm32",jU="arm64",HU="ia64",FU="ppc32",VU="ppc64",qU="x86",I7=GU,N7=BU,O7=jU,b7=HU,C7=FU,P7=VU,M7=qU,x7=We([GU,BU,jU,HU,FU,VU,qU]),$U="windows",YU="linux",WU="darwin",zU="freebsd",KU="netbsd",QU="openbsd",XU="dragonflybsd",JU="hpux",ZU="aix",ew="solaris",tw="z_os",v7=$U,L7=YU,D7=WU,U7=zU,w7=KU,k7=QU,G7=XU,B7=JU,j7=ZU,H7=ew,F7=tw,V7=We([$U,YU,WU,zU,KU,QU,XU,JU,ZU,ew,tw]),nw="cpp",rw="dotnet",ow="erlang",sw="go",iw="java",aw="nodejs",cw="php",uw="python",lw="ruby",pw="webjs",q7=nw,$7=rw,Y7=ow,W7=sw,z7=iw,K7=aw,Q7=cw,X7=uw,J7=lw,Z7=pw,eee=We([nw,rw,ow,sw,iw,aw,cw,uw,lw,pw])});var _w=z(()=>{dw()});var tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,hee,Tee,Eee,gee,See,Aee,Ree,yee,Iee,Nee,pA,dA,Oee,tc,bee,_A,fA,Cee,xi,Pee,Mee,xee,vee,Lee,Dee,Uee,wee,kee,Gee,mA,Bee,jee,Hee,Fee,Vee,qee,vi,$ee,Yee,Wee,zee,Kee,Qee,Xee,Jee,Zee,ete,tte,nte,rte,bo,Co,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,mte,hte,Tte,Ete,gte,hA,TA,Ste,EA,gA,Ate,Rte,yte,Ite,Nte,Ote,bte,Cte,Pte,Mte,xte,vte,Lte,Dte,SA,AA,Ute,RA,wte,yA,kte,Gte,Bte,jte,Hte,Fte,Vte,qte,$te,Yte,Wte,zte,Kte,Qte,Xte,Jte,Zte,ene,tne,nne,rne,one,sne,ine,cs,ane,cne,une,IA,fw=z(()=>{tee="aspnetcore.diagnostics.exception.result",nee="aborted",ree="handled",oee="skipped",see="unhandled",iee="aspnetcore.diagnostics.handler.type",aee="aspnetcore.rate_limiting.policy",cee="aspnetcore.rate_limiting.result",uee="acquired",lee="endpoint_limiter",pee="global_limiter",dee="request_canceled",_ee="aspnetcore.request.is_unhandled",fee="aspnetcore.routing.is_fallback",mee="aspnetcore.routing.match_status",hee="failure",Tee="success",Eee="aspnetcore.user.is_authenticated",gee="client.address",See="client.port",Aee="code.column.number",Ree="code.file.path",yee="code.function.name",Iee="code.line.number",Nee="code.stacktrace",pA="db.collection.name",dA="db.namespace",Oee="db.operation.batch.size",tc="db.operation.name",bee="db.query.summary",_A="db.query.text",fA="db.response.status_code",Cee="db.stored_procedure.name",xi="db.system.name",Pee="mariadb",Mee="microsoft.sql_server",xee="mysql",vee="postgresql",Lee="dotnet.gc.heap.generation",Dee="gen0",Uee="gen1",wee="gen2",kee="loh",Gee="poh",mA="error.type",Bee="_OTHER",jee="exception.escaped",Hee="exception.message",Fee="exception.stacktrace",Vee="exception.type",qee=t=>`http.request.header.${t}`,vi="http.request.method",$ee="_OTHER",Yee="CONNECT",Wee="DELETE",zee="GET",Kee="HEAD",Qee="OPTIONS",Xee="PATCH",Jee="POST",Zee="PUT",ete="TRACE",tte="http.request.method_original",nte="http.request.resend_count",rte=t=>`http.response.header.${t}`,bo="http.response.status_code",Co="http.route",ote="jvm.gc.action",ste="jvm.gc.name",ite="jvm.memory.pool.name",ate="jvm.memory.type",cte="heap",ute="non_heap",lte="jvm.thread.daemon",pte="jvm.thread.state",dte="blocked",_te="new",fte="runnable",mte="terminated",hte="timed_waiting",Tte="waiting",Ete="network.local.address",gte="network.local.port",hA="network.peer.address",TA="network.peer.port",Ste="network.protocol.name",EA="network.protocol.version",gA="network.transport",Ate="pipe",Rte="quic",yte="tcp",Ite="udp",Nte="unix",Ote="network.type",bte="ipv4",Cte="ipv6",Pte="otel.scope.name",Mte="otel.scope.version",xte="otel.status_code",vte="ERROR",Lte="OK",Dte="otel.status_description",SA="server.address",AA="server.port",Ute="service.instance.id",RA="service.name",wte="service.namespace",yA="service.version",kte="signalr.connection.status",Gte="app_shutdown",Bte="normal_closure",jte="timeout",Hte="signalr.transport",Fte="long_polling",Vte="server_sent_events",qte="web_sockets",$te="telemetry.sdk.language",Yte="cpp",Wte="dotnet",zte="erlang",Kte="go",Qte="java",Xte="nodejs",Jte="php",Zte="python",ene="ruby",tne="rust",nne="swift",rne="webjs",one="telemetry.sdk.name",sne="telemetry.sdk.version",ine="url.fragment",cs="url.full",ane="url.path",cne="url.query",une="url.scheme",IA="user_agent.original"});var lne,pne,dne,_ne,fne,mne,hne,Tne,Ene,gne,Sne,Ane,Rne,yne,Ine,Nne,One,bne,Cne,Pne,Mne,xne,vne,Lne,Dne,Une,wne,kne,Gne,Bne,jne,Hne,Fne,Vne,qne,$ne,Yne,Wne,zne,Kne,Qne,Xne,Jne,Zne,ere,tre,nre,rre,ore,sre,ire,mw=z(()=>{lne="aspnetcore.diagnostics.exceptions",pne="aspnetcore.rate_limiting.active_request_leases",dne="aspnetcore.rate_limiting.queued_requests",_ne="aspnetcore.rate_limiting.request.time_in_queue",fne="aspnetcore.rate_limiting.request_lease.duration",mne="aspnetcore.rate_limiting.requests",hne="aspnetcore.routing.match_attempts",Tne="db.client.operation.duration",Ene="dotnet.assembly.count",gne="dotnet.exceptions",Sne="dotnet.gc.collections",Ane="dotnet.gc.heap.total_allocated",Rne="dotnet.gc.last_collection.heap.fragmentation.size",yne="dotnet.gc.last_collection.heap.size",Ine="dotnet.gc.last_collection.memory.committed_size",Nne="dotnet.gc.pause.time",One="dotnet.jit.compilation.time",bne="dotnet.jit.compiled_il.size",Cne="dotnet.jit.compiled_methods",Pne="dotnet.monitor.lock_contentions",Mne="dotnet.process.cpu.count",xne="dotnet.process.cpu.time",vne="dotnet.process.memory.working_set",Lne="dotnet.thread_pool.queue.length",Dne="dotnet.thread_pool.thread.count",Une="dotnet.thread_pool.work_item.count",wne="dotnet.timer.count",kne="http.client.request.duration",Gne="http.server.request.duration",Bne="jvm.class.count",jne="jvm.class.loaded",Hne="jvm.class.unloaded",Fne="jvm.cpu.count",Vne="jvm.cpu.recent_utilization",qne="jvm.cpu.time",$ne="jvm.gc.duration",Yne="jvm.memory.committed",Wne="jvm.memory.limit",zne="jvm.memory.used",Kne="jvm.memory.used_after_last_gc",Qne="jvm.thread.count",Xne="kestrel.active_connections",Jne="kestrel.active_tls_handshakes",Zne="kestrel.connection.duration",ere="kestrel.queued_connections",tre="kestrel.queued_requests",nre="kestrel.rejected_connections",rre="kestrel.tls_handshake.duration",ore="kestrel.upgraded_connections",sre="signalr.server.active_connections",ire="signalr.server.connection.duration"});var are,hw=z(()=>{are="exception"});var Ae={};aS(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>nee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>ree,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>oee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>see,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>uee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>lee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>pee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>dee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>hee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>Tee,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>tee,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>iee,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>aee,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>cee,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>_ee,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>fee,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>mee,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>Eee,ATTR_CLIENT_ADDRESS:()=>gee,ATTR_CLIENT_PORT:()=>See,ATTR_CODE_COLUMN_NUMBER:()=>Aee,ATTR_CODE_FILE_PATH:()=>Ree,ATTR_CODE_FUNCTION_NAME:()=>yee,ATTR_CODE_LINE_NUMBER:()=>Iee,ATTR_CODE_STACKTRACE:()=>Nee,ATTR_DB_COLLECTION_NAME:()=>pA,ATTR_DB_NAMESPACE:()=>dA,ATTR_DB_OPERATION_BATCH_SIZE:()=>Oee,ATTR_DB_OPERATION_NAME:()=>tc,ATTR_DB_QUERY_SUMMARY:()=>bee,ATTR_DB_QUERY_TEXT:()=>_A,ATTR_DB_RESPONSE_STATUS_CODE:()=>fA,ATTR_DB_STORED_PROCEDURE_NAME:()=>Cee,ATTR_DB_SYSTEM_NAME:()=>xi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>Lee,ATTR_ERROR_TYPE:()=>mA,ATTR_EXCEPTION_ESCAPED:()=>jee,ATTR_EXCEPTION_MESSAGE:()=>Hee,ATTR_EXCEPTION_STACKTRACE:()=>Fee,ATTR_EXCEPTION_TYPE:()=>Vee,ATTR_HTTP_REQUEST_HEADER:()=>qee,ATTR_HTTP_REQUEST_METHOD:()=>vi,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>tte,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>nte,ATTR_HTTP_RESPONSE_HEADER:()=>rte,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>bo,ATTR_HTTP_ROUTE:()=>Co,ATTR_JVM_GC_ACTION:()=>ote,ATTR_JVM_GC_NAME:()=>ste,ATTR_JVM_MEMORY_POOL_NAME:()=>ite,ATTR_JVM_MEMORY_TYPE:()=>ate,ATTR_JVM_THREAD_DAEMON:()=>lte,ATTR_JVM_THREAD_STATE:()=>pte,ATTR_NETWORK_LOCAL_ADDRESS:()=>Ete,ATTR_NETWORK_LOCAL_PORT:()=>gte,ATTR_NETWORK_PEER_ADDRESS:()=>hA,ATTR_NETWORK_PEER_PORT:()=>TA,ATTR_NETWORK_PROTOCOL_NAME:()=>Ste,ATTR_NETWORK_PROTOCOL_VERSION:()=>EA,ATTR_NETWORK_TRANSPORT:()=>gA,ATTR_NETWORK_TYPE:()=>Ote,ATTR_OTEL_SCOPE_NAME:()=>Pte,ATTR_OTEL_SCOPE_VERSION:()=>Mte,ATTR_OTEL_STATUS_CODE:()=>xte,ATTR_OTEL_STATUS_DESCRIPTION:()=>Dte,ATTR_SERVER_ADDRESS:()=>SA,ATTR_SERVER_PORT:()=>AA,ATTR_SERVICE_INSTANCE_ID:()=>Ute,ATTR_SERVICE_NAME:()=>RA,ATTR_SERVICE_NAMESPACE:()=>wte,ATTR_SERVICE_VERSION:()=>yA,ATTR_SIGNALR_CONNECTION_STATUS:()=>kte,ATTR_SIGNALR_TRANSPORT:()=>Hte,ATTR_TELEMETRY_SDK_LANGUAGE:()=>$te,ATTR_TELEMETRY_SDK_NAME:()=>one,ATTR_TELEMETRY_SDK_VERSION:()=>sne,ATTR_URL_FRAGMENT:()=>ine,ATTR_URL_FULL:()=>cs,ATTR_URL_PATH:()=>ane,ATTR_URL_QUERY:()=>cne,ATTR_URL_SCHEME:()=>une,ATTR_USER_AGENT_ORIGINAL:()=>IA,AWSECSLAUNCHTYPEVALUES_EC2:()=>A7,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>R7,AwsEcsLaunchtypeValues:()=>y7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>r7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>o7,CLOUDPLATFORMVALUES_AWS_EC2:()=>s7,CLOUDPLATFORMVALUES_AWS_ECS:()=>i7,CLOUDPLATFORMVALUES_AWS_EKS:()=>a7,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>u7,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>c7,CLOUDPLATFORMVALUES_AZURE_AKS:()=>d7,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>f7,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>p7,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>_7,CLOUDPLATFORMVALUES_AZURE_VM:()=>l7,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>g7,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>E7,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>h7,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>m7,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>T7,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>J8,CLOUDPROVIDERVALUES_AWS:()=>Z8,CLOUDPROVIDERVALUES_AZURE:()=>e7,CLOUDPROVIDERVALUES_GCP:()=>t7,CloudPlatformValues:()=>S7,CloudProviderValues:()=>n7,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>k5,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>$5,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>G5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>q5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>j5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>W5,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>H5,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>B5,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>Y5,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>V5,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>F5,DBSYSTEMVALUES_ADABAS:()=>i5,DBSYSTEMVALUES_CACHE:()=>s5,DBSYSTEMVALUES_CASSANDRA:()=>y5,DBSYSTEMVALUES_CLOUDSCAPE:()=>XJ,DBSYSTEMVALUES_COCKROACHDB:()=>U5,DBSYSTEMVALUES_COLDFUSION:()=>R5,DBSYSTEMVALUES_COSMOSDB:()=>P5,DBSYSTEMVALUES_COUCHBASE:()=>b5,DBSYSTEMVALUES_COUCHDB:()=>C5,DBSYSTEMVALUES_DB2:()=>WJ,DBSYSTEMVALUES_DERBY:()=>c5,DBSYSTEMVALUES_DYNAMODB:()=>M5,DBSYSTEMVALUES_EDB:()=>o5,DBSYSTEMVALUES_ELASTICSEARCH:()=>L5,DBSYSTEMVALUES_FILEMAKER:()=>u5,DBSYSTEMVALUES_FIREBIRD:()=>a5,DBSYSTEMVALUES_FIRSTSQL:()=>r5,DBSYSTEMVALUES_GEODE:()=>v5,DBSYSTEMVALUES_H2:()=>A5,DBSYSTEMVALUES_HANADB:()=>t5,DBSYSTEMVALUES_HBASE:()=>I5,DBSYSTEMVALUES_HIVE:()=>QJ,DBSYSTEMVALUES_HSQLDB:()=>JJ,DBSYSTEMVALUES_INFORMIX:()=>l5,DBSYSTEMVALUES_INGRES:()=>n5,DBSYSTEMVALUES_INSTANTDB:()=>p5,DBSYSTEMVALUES_INTERBASE:()=>d5,DBSYSTEMVALUES_MARIADB:()=>_5,DBSYSTEMVALUES_MAXDB:()=>e5,DBSYSTEMVALUES_MEMCACHED:()=>D5,DBSYSTEMVALUES_MONGODB:()=>N5,DBSYSTEMVALUES_MSSQL:()=>qJ,DBSYSTEMVALUES_MYSQL:()=>$J,DBSYSTEMVALUES_NEO4J:()=>x5,DBSYSTEMVALUES_NETEZZA:()=>f5,DBSYSTEMVALUES_ORACLE:()=>YJ,DBSYSTEMVALUES_OTHER_SQL:()=>VJ,DBSYSTEMVALUES_PERVASIVE:()=>m5,DBSYSTEMVALUES_POINTBASE:()=>h5,DBSYSTEMVALUES_POSTGRESQL:()=>zJ,DBSYSTEMVALUES_PROGRESS:()=>ZJ,DBSYSTEMVALUES_REDIS:()=>O5,DBSYSTEMVALUES_REDSHIFT:()=>KJ,DBSYSTEMVALUES_SQLITE:()=>T5,DBSYSTEMVALUES_SYBASE:()=>E5,DBSYSTEMVALUES_TERADATA:()=>g5,DBSYSTEMVALUES_VERTICA:()=>S5,DB_SYSTEM_NAME_VALUE_MARIADB:()=>Pee,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>Mee,DB_SYSTEM_NAME_VALUE_MYSQL:()=>xee,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>vee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>Dee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>Uee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>wee,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>kee,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>Gee,DbCassandraConsistencyLevelValues:()=>z5,DbSystemValues:()=>w5,ERROR_TYPE_VALUE_OTHER:()=>Bee,EVENT_EXCEPTION:()=>are,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>rZ,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>nZ,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>tZ,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>sZ,FAASINVOKEDPROVIDERVALUES_AWS:()=>iZ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>aZ,FAASINVOKEDPROVIDERVALUES_GCP:()=>cZ,FAASTRIGGERVALUES_DATASOURCE:()=>K5,FAASTRIGGERVALUES_HTTP:()=>Q5,FAASTRIGGERVALUES_OTHER:()=>Z5,FAASTRIGGERVALUES_PUBSUB:()=>X5,FAASTRIGGERVALUES_TIMER:()=>J5,FaasDocumentOperationValues:()=>oZ,FaasInvokedProviderValues:()=>uZ,FaasTriggerValues:()=>eZ,HOSTARCHVALUES_AMD64:()=>I7,HOSTARCHVALUES_ARM32:()=>N7,HOSTARCHVALUES_ARM64:()=>O7,HOSTARCHVALUES_IA64:()=>b7,HOSTARCHVALUES_PPC32:()=>C7,HOSTARCHVALUES_PPC64:()=>P7,HOSTARCHVALUES_X86:()=>M7,HTTPFLAVORVALUES_HTTP_1_0:()=>YZ,HTTPFLAVORVALUES_HTTP_1_1:()=>WZ,HTTPFLAVORVALUES_HTTP_2_0:()=>zZ,HTTPFLAVORVALUES_QUIC:()=>QZ,HTTPFLAVORVALUES_SPDY:()=>KZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>Yee,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>Wee,HTTP_REQUEST_METHOD_VALUE_GET:()=>zee,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>Kee,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>Qee,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>$ee,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>Xee,HTTP_REQUEST_METHOD_VALUE_POST:()=>Jee,HTTP_REQUEST_METHOD_VALUE_PUT:()=>Zee,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>ete,HostArchValues:()=>x7,HttpFlavorValues:()=>XZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>cte,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>ute,JVM_THREAD_STATE_VALUE_BLOCKED:()=>dte,JVM_THREAD_STATE_VALUE_NEW:()=>_te,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>fte,JVM_THREAD_STATE_VALUE_TERMINATED:()=>mte,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>hte,JVM_THREAD_STATE_VALUE_WAITING:()=>Tte,MESSAGETYPEVALUES_RECEIVED:()=>y6,MESSAGETYPEVALUES_SENT:()=>R6,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>JZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>ZZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>n6,MESSAGINGOPERATIONVALUES_RECEIVE:()=>t6,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>lne,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>pne,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>dne,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>mne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>fne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>_ne,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>hne,METRIC_DB_CLIENT_OPERATION_DURATION:()=>Tne,METRIC_DOTNET_ASSEMBLY_COUNT:()=>Ene,METRIC_DOTNET_EXCEPTIONS:()=>gne,METRIC_DOTNET_GC_COLLECTIONS:()=>Sne,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>Ane,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>Rne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>yne,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>Ine,METRIC_DOTNET_GC_PAUSE_TIME:()=>Nne,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>One,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>bne,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>Cne,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>Pne,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>Mne,METRIC_DOTNET_PROCESS_CPU_TIME:()=>xne,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>vne,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>Lne,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>Dne,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>Une,METRIC_DOTNET_TIMER_COUNT:()=>wne,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>kne,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>Gne,METRIC_JVM_CLASS_COUNT:()=>Bne,METRIC_JVM_CLASS_LOADED:()=>jne,METRIC_JVM_CLASS_UNLOADED:()=>Hne,METRIC_JVM_CPU_COUNT:()=>Fne,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Vne,METRIC_JVM_CPU_TIME:()=>qne,METRIC_JVM_GC_DURATION:()=>$ne,METRIC_JVM_MEMORY_COMMITTED:()=>Yne,METRIC_JVM_MEMORY_LIMIT:()=>Wne,METRIC_JVM_MEMORY_USED:()=>zne,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>Kne,METRIC_JVM_THREAD_COUNT:()=>Qne,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Xne,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Jne,METRIC_KESTREL_CONNECTION_DURATION:()=>Zne,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>ere,METRIC_KESTREL_QUEUED_REQUESTS:()=>tre,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>nre,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>rre,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>ore,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>sre,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>ire,MessageTypeValues:()=>I6,MessagingDestinationKindValues:()=>e6,MessagingOperationValues:()=>r6,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>MZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>kZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>PZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>UZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>IZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>BZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>xZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>LZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>GZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>vZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>DZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>HZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>wZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>qZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>FZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>VZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>jZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>OZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>SZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>AZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>RZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>EZ,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>gZ,NETTRANSPORTVALUES_INPROC:()=>mZ,NETTRANSPORTVALUES_IP:()=>dZ,NETTRANSPORTVALUES_IP_TCP:()=>lZ,NETTRANSPORTVALUES_IP_UDP:()=>pZ,NETTRANSPORTVALUES_OTHER:()=>hZ,NETTRANSPORTVALUES_PIPE:()=>fZ,NETTRANSPORTVALUES_UNIX:()=>_Z,NETWORK_TRANSPORT_VALUE_PIPE:()=>Ate,NETWORK_TRANSPORT_VALUE_QUIC:()=>Rte,NETWORK_TRANSPORT_VALUE_TCP:()=>yte,NETWORK_TRANSPORT_VALUE_UDP:()=>Ite,NETWORK_TRANSPORT_VALUE_UNIX:()=>Nte,NETWORK_TYPE_VALUE_IPV4:()=>bte,NETWORK_TYPE_VALUE_IPV6:()=>Cte,NetHostConnectionSubtypeValues:()=>$Z,NetHostConnectionTypeValues:()=>yZ,NetTransportValues:()=>TZ,OSTYPEVALUES_AIX:()=>j7,OSTYPEVALUES_DARWIN:()=>D7,OSTYPEVALUES_DRAGONFLYBSD:()=>G7,OSTYPEVALUES_FREEBSD:()=>U7,OSTYPEVALUES_HPUX:()=>B7,OSTYPEVALUES_LINUX:()=>L7,OSTYPEVALUES_NETBSD:()=>w7,OSTYPEVALUES_OPENBSD:()=>k7,OSTYPEVALUES_SOLARIS:()=>H7,OSTYPEVALUES_WINDOWS:()=>v7,OSTYPEVALUES_Z_OS:()=>F7,OTEL_STATUS_CODE_VALUE_ERROR:()=>vte,OTEL_STATUS_CODE_VALUE_OK:()=>Lte,OsTypeValues:()=>V7,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>f6,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>l6,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>s6,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>g6,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>c6,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>_6,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>T6,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>a6,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>u6,RPCGRPCSTATUSCODEVALUES_OK:()=>o6,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>m6,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>p6,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>d6,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>S6,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>E6,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>h6,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>i6,RpcGrpcStatusCodeValues:()=>A6,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>eJ,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>dJ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>XX,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>WX,SEMATTRS_AWS_DYNAMODB_COUNT:()=>lJ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>sJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>rJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>_J,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>tJ,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>zX,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>ZX,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>oJ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>JX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>KX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>QX,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>pJ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>aJ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>cJ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>nJ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>iJ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>YX,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>uJ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>GQ,SEMATTRS_CODE_FILEPATH:()=>wX,SEMATTRS_CODE_FUNCTION:()=>DX,SEMATTRS_CODE_LINENO:()=>kX,SEMATTRS_CODE_NAMESPACE:()=>UX,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>WQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>JQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>XQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>KQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>$Q,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>YQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>QQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>zQ,SEMATTRS_DB_CONNECTION_STRING:()=>BQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>ZQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>HQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>tX,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>qQ,SEMATTRS_DB_NAME:()=>FQ,SEMATTRS_DB_OPERATION:()=>VQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>eX,SEMATTRS_DB_SQL_TABLE:()=>nX,SEMATTRS_DB_STATEMENT:()=>JS,SEMATTRS_DB_SYSTEM:()=>XS,SEMATTRS_DB_USER:()=>jQ,SEMATTRS_ENDUSER_ID:()=>PX,SEMATTRS_ENDUSER_ROLE:()=>MX,SEMATTRS_ENDUSER_SCOPE:()=>xX,SEMATTRS_EXCEPTION_ESCAPED:()=>iX,SEMATTRS_EXCEPTION_MESSAGE:()=>oX,SEMATTRS_EXCEPTION_STACKTRACE:()=>sX,SEMATTRS_EXCEPTION_TYPE:()=>rX,SEMATTRS_FAAS_COLDSTART:()=>fX,SEMATTRS_FAAS_CRON:()=>_X,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>cX,SEMATTRS_FAAS_DOCUMENT_NAME:()=>pX,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>uX,SEMATTRS_FAAS_DOCUMENT_TIME:()=>lX,SEMATTRS_FAAS_EXECUTION:()=>aX,SEMATTRS_FAAS_INVOKED_NAME:()=>mX,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>hX,SEMATTRS_FAAS_INVOKED_REGION:()=>TX,SEMATTRS_FAAS_TIME:()=>dX,SEMATTRS_FAAS_TRIGGER:()=>ZS,SEMATTRS_HTTP_CLIENT_IP:()=>$X,SEMATTRS_HTTP_FLAVOR:()=>jX,SEMATTRS_HTTP_HOST:()=>GX,SEMATTRS_HTTP_METHOD:()=>Cl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>FX,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>VX,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>oA,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>sA,SEMATTRS_HTTP_ROUTE:()=>iA,SEMATTRS_HTTP_SCHEME:()=>BX,SEMATTRS_HTTP_SERVER_NAME:()=>qX,SEMATTRS_HTTP_STATUS_CODE:()=>Mi,SEMATTRS_HTTP_TARGET:()=>rA,SEMATTRS_HTTP_URL:()=>ec,SEMATTRS_HTTP_USER_AGENT:()=>HX,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>jJ,SEMATTRS_MESSAGE_ID:()=>BJ,SEMATTRS_MESSAGE_TYPE:()=>GJ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>HJ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>NJ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>AJ,SEMATTRS_MESSAGING_DESTINATION:()=>fJ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>mJ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>PJ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>CJ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>bJ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>MJ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>xJ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>SJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>yJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>RJ,SEMATTRS_MESSAGING_OPERATION:()=>IJ,SEMATTRS_MESSAGING_PROTOCOL:()=>TJ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>EJ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>OJ,SEMATTRS_MESSAGING_SYSTEM:()=>aA,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>hJ,SEMATTRS_MESSAGING_URL:()=>gJ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>bX,SEMATTRS_NET_HOST_CARRIER_MCC:()=>NX,SEMATTRS_NET_HOST_CARRIER_MNC:()=>OX,SEMATTRS_NET_HOST_CARRIER_NAME:()=>IX,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>yX,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>RX,SEMATTRS_NET_HOST_IP:()=>tA,SEMATTRS_NET_HOST_NAME:()=>AX,SEMATTRS_NET_HOST_PORT:()=>nA,SEMATTRS_NET_PEER_IP:()=>eA,SEMATTRS_NET_PEER_NAME:()=>SX,SEMATTRS_NET_PEER_PORT:()=>gX,SEMATTRS_NET_TRANSPORT:()=>EX,SEMATTRS_PEER_SERVICE:()=>CX,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>uA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>wJ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>kJ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>UJ,SEMATTRS_RPC_JSONRPC_VERSION:()=>DJ,SEMATTRS_RPC_METHOD:()=>LJ,SEMATTRS_RPC_SERVICE:()=>cA,SEMATTRS_RPC_SYSTEM:()=>vJ,SEMATTRS_THREAD_ID:()=>vX,SEMATTRS_THREAD_NAME:()=>LX,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>x6,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>M6,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>v6,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>L6,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>D6,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>U6,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>w6,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>G6,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>k6,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>j6,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>B6,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>O6,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>C6,SEMRESATTRS_CLOUD_PLATFORM:()=>P6,SEMRESATTRS_CLOUD_PROVIDER:()=>N6,SEMRESATTRS_CLOUD_REGION:()=>b6,SEMRESATTRS_CONTAINER_ID:()=>F6,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>q6,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>$6,SEMRESATTRS_CONTAINER_NAME:()=>H6,SEMRESATTRS_CONTAINER_RUNTIME:()=>V6,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>Y6,SEMRESATTRS_DEVICE_ID:()=>W6,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>z6,SEMRESATTRS_DEVICE_MODEL_NAME:()=>K6,SEMRESATTRS_FAAS_ID:()=>X6,SEMRESATTRS_FAAS_INSTANCE:()=>Z6,SEMRESATTRS_FAAS_MAX_MEMORY:()=>e8,SEMRESATTRS_FAAS_NAME:()=>Q6,SEMRESATTRS_FAAS_VERSION:()=>J6,SEMRESATTRS_HOST_ARCH:()=>o8,SEMRESATTRS_HOST_ID:()=>t8,SEMRESATTRS_HOST_IMAGE_ID:()=>i8,SEMRESATTRS_HOST_IMAGE_NAME:()=>s8,SEMRESATTRS_HOST_IMAGE_VERSION:()=>a8,SEMRESATTRS_HOST_NAME:()=>n8,SEMRESATTRS_HOST_TYPE:()=>r8,SEMRESATTRS_K8S_CLUSTER_NAME:()=>c8,SEMRESATTRS_K8S_CONTAINER_NAME:()=>f8,SEMRESATTRS_K8S_CRONJOB_NAME:()=>O8,SEMRESATTRS_K8S_CRONJOB_UID:()=>N8,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>R8,SEMRESATTRS_K8S_DAEMONSET_UID:()=>A8,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>E8,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>T8,SEMRESATTRS_K8S_JOB_NAME:()=>I8,SEMRESATTRS_K8S_JOB_UID:()=>y8,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>p8,SEMRESATTRS_K8S_NODE_NAME:()=>u8,SEMRESATTRS_K8S_NODE_UID:()=>l8,SEMRESATTRS_K8S_POD_NAME:()=>_8,SEMRESATTRS_K8S_POD_UID:()=>d8,SEMRESATTRS_K8S_REPLICASET_NAME:()=>h8,SEMRESATTRS_K8S_REPLICASET_UID:()=>m8,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>S8,SEMRESATTRS_K8S_STATEFULSET_UID:()=>g8,SEMRESATTRS_OS_DESCRIPTION:()=>C8,SEMRESATTRS_OS_NAME:()=>P8,SEMRESATTRS_OS_TYPE:()=>b8,SEMRESATTRS_OS_VERSION:()=>M8,SEMRESATTRS_PROCESS_COMMAND:()=>D8,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>w8,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>U8,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>v8,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>L8,SEMRESATTRS_PROCESS_OWNER:()=>k8,SEMRESATTRS_PROCESS_PID:()=>x8,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>j8,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>G8,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>B8,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>F8,SEMRESATTRS_SERVICE_NAME:()=>H8,SEMRESATTRS_SERVICE_NAMESPACE:()=>lA,SEMRESATTRS_SERVICE_VERSION:()=>V8,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>W8,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>$8,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>q8,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>Y8,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>Q8,SEMRESATTRS_WEBENGINE_NAME:()=>z8,SEMRESATTRS_WEBENGINE_VERSION:()=>K8,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>Gte,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>Bte,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>jte,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>Fte,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>Vte,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>qte,SemanticAttributes:()=>FJ,SemanticResourceAttributes:()=>X8,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>q7,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>$7,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>Y7,TELEMETRYSDKLANGUAGEVALUES_GO:()=>W7,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>z7,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>K7,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>Q7,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>X7,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>J7,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>Z7,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>Yte,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>Wte,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>zte,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Kte,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>Qte,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Xte,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Jte,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Zte,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>ene,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>tne,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>nne,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>rne,TelemetrySdkLanguageValues:()=>eee});var le=z(()=>{H0();_w();fw();mw();hw()});var Tw=E(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});U_.ATTR_PROCESS_RUNTIME_NAME=void 0;U_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var Ew=E(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.SDK_INFO=void 0;var cre=QP(),w_=(le(),N(Ae)),ure=Tw();k_.SDK_INFO={[w_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[ure.ATTR_PROCESS_RUNTIME_NAME]:"node",[w_.ATTR_TELEMETRY_SDK_LANGUAGE]:w_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[w_.ATTR_TELEMETRY_SDK_VERSION]:cre.VERSION}});var gw=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.otperformance=qt.SDK_INFO=qt._globalThis=qt.getStringListFromEnv=qt.getNumberFromEnv=qt.getBooleanFromEnv=qt.getStringFromEnv=void 0;var G_=zP();Object.defineProperty(qt,"getStringFromEnv",{enumerable:!0,get:function(){return G_.getStringFromEnv}});Object.defineProperty(qt,"getBooleanFromEnv",{enumerable:!0,get:function(){return G_.getBooleanFromEnv}});Object.defineProperty(qt,"getNumberFromEnv",{enumerable:!0,get:function(){return G_.getNumberFromEnv}});Object.defineProperty(qt,"getStringListFromEnv",{enumerable:!0,get:function(){return G_.getStringListFromEnv}});var lre=KP();Object.defineProperty(qt,"_globalThis",{enumerable:!0,get:function(){return lre._globalThis}});var pre=Ew();Object.defineProperty(qt,"SDK_INFO",{enumerable:!0,get:function(){return pre.SDK_INFO}});qt.otperformance=performance});var NA=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getStringFromEnv=$t.getBooleanFromEnv=$t.otperformance=$t._globalThis=$t.SDK_INFO=void 0;var Li=gw();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return Li.SDK_INFO}});Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return Li._globalThis}});Object.defineProperty($t,"otperformance",{enumerable:!0,get:function(){return Li.otperformance}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return Li.getBooleanFromEnv}});Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return Li.getStringFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return Li.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return Li.getStringListFromEnv}})});var yw=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var B_=NA(),Sw=9,dre=6,_re=Math.pow(10,dre),j_=Math.pow(10,Sw);function Pl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*_re);return[n,r]}be.millisToHrTime=Pl;function fre(){return B_.otperformance.timeOrigin}be.getTimeOrigin=fre;function Aw(t){let e=Pl(B_.otperformance.timeOrigin),n=Pl(typeof t=="number"?t:B_.otperformance.now());return Rw(e,n)}be.hrTime=Aw;function mre(t){if(OA(t))return t;if(typeof t=="number")return t<B_.otperformance.timeOrigin?Aw(t):Pl(t);if(t instanceof Date)return Pl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=mre;function hre(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=j_),[n,r]}be.hrTimeDuration=hre;function Tre(t){let e=Sw,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=Tre;function Ere(t){return t[0]*j_+t[1]}be.hrTimeToNanoseconds=Ere;function gre(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=gre;function Sre(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=Sre;function OA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=OA;function Are(t){return OA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=Are;function Rw(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=j_&&(n[1]-=j_,n[0]+=1),n}be.addHrTimes=Rw});var Iw=E(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.unrefTimer=void 0;function Rre(t){typeof t!="number"&&t.unref()}H_.unrefTimer=Rre});var Nw=E(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.ExportResultCode=void 0;var yre;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(yre=Ml.ExportResultCode||(Ml.ExportResultCode={}))});var bw=E(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.CompositePropagator=void 0;var Ow=(b(),N(v)),bA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){Ow.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){Ow.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};F_.CompositePropagator=bA});var Cw=E(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.validateValue=nc.validateKey=void 0;var CA="[_0-9a-z-*/]",Ire=`[a-z]${CA}{0,255}`,Nre=`[a-z0-9]${CA}{0,240}@[a-z]${CA}{0,13}`,Ore=new RegExp(`^(?:${Ire}|${Nre})$`),bre=/^[ -~]{0,255}[!-~]$/,Cre=/,|=/;function Pre(t){return Ore.test(t)}nc.validateKey=Pre;function Mre(t){return bre.test(t)&&!Cre.test(t)}nc.validateValue=Mre});var MA=E(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});V_.TraceState=void 0;var Pw=Cw(),Mw=32,xre=512,xw=",",vw="=",PA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+vw+this.get(n)),e),[]).join(xw)}_parse(e){e.length>xre||(this._internalState=e.split(xw).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(vw);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Pw.validateKey)(i)&&(0,Pw.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>Mw&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Mw))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};V_.TraceState=PA});var Dw=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.W3CTraceContextPropagator=Yt.parseTraceParent=Yt.TRACE_STATE_HEADER=Yt.TRACE_PARENT_HEADER=void 0;var q_=(b(),N(v)),vre=bl(),Lre=MA();Yt.TRACE_PARENT_HEADER="traceparent";Yt.TRACE_STATE_HEADER="tracestate";var Dre="00",Ure="(?!ff)[\\da-f]{2}",wre="(?![0]{32})[\\da-f]{32}",kre="(?![0]{16})[\\da-f]{16}",Gre="[\\da-f]{2}",Bre=new RegExp(`^\\s?(${Ure})-(${wre})-(${kre})-(${Gre})(-.*)?\\s?$`);function Lw(t){let e=Bre.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Yt.parseTraceParent=Lw;var xA=class{inject(e,n,r){let o=q_.trace.getSpanContext(e);if(!o||(0,vre.isTracingSuppressed)(e)||!(0,q_.isSpanContextValid)(o))return;let s=`${Dre}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||q_.TraceFlags.NONE).toString(16)}`;r.set(n,Yt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Yt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Yt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Lw(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Yt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new Lre.TraceState(typeof c=="string"?c:void 0)}return q_.trace.setSpanContext(e,i)}fields(){return[Yt.TRACE_PARENT_HEADER,Yt.TRACE_STATE_HEADER]}};Yt.W3CTraceContextPropagator=xA});var Uw=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.getRPCMetadata=Rr.deleteRPCMetadata=Rr.setRPCMetadata=Rr.RPCType=void 0;var jre=(b(),N(v)),vA=(0,jre.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Hre;(function(t){t.HTTP="http"})(Hre=Rr.RPCType||(Rr.RPCType={}));function Fre(t,e){return t.setValue(vA,e)}Rr.setRPCMetadata=Fre;function Vre(t){return t.deleteValue(vA)}Rr.deleteRPCMetadata=Vre;function qre(t){return t.getValue(vA)}Rr.getRPCMetadata=qre});var jw=E($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});$_.isPlainObject=void 0;var $re="[object Object]",Yre="[object Null]",Wre="[object Undefined]",zre=Function.prototype,ww=zre.toString,Kre=ww.call(Object),Qre=Object.getPrototypeOf,kw=Object.prototype,Gw=kw.hasOwnProperty,Di=Symbol?Symbol.toStringTag:void 0,Bw=kw.toString;function Xre(t){if(!Jre(t)||Zre(t)!==$re)return!1;let e=Qre(t);if(e===null)return!0;let n=Gw.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&ww.call(n)===Kre}$_.isPlainObject=Xre;function Jre(t){return t!=null&&typeof t=="object"}function Zre(t){return t==null?t===void 0?Wre:Yre:Di&&Di in Object(t)?eoe(t):toe(t)}function eoe(t){let e=Gw.call(t,Di),n=t[Di],r=!1;try{t[Di]=void 0,r=!0}catch{}let o=Bw.call(t);return r&&(e?t[Di]=n:delete t[Di]),o}function toe(t){return Bw.call(t)}});var $w=E(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.merge=void 0;var Hw=jw(),noe=20;function roe(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=Vw(e,t.shift(),0,n);return e}z_.merge=roe;function LA(t){return W_(t)?t.slice():t}function Vw(t,e,n=0,r){let o;if(!(n>noe)){if(n++,Y_(t)||Y_(e)||qw(e))o=LA(e);else if(W_(t)){if(o=t.slice(),W_(e))for(let s=0,i=e.length;s<i;s++)o.push(LA(e[s]));else if(xl(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=LA(e[c])}}}else if(xl(t))if(xl(e)){if(!ooe(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(Y_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(Fw(t,c,r)||Fw(e,c,r))delete o[c];else{if(xl(p)&&xl(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=Vw(o[c],l,n,r)}}}}else o=e;return o}}function Fw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function W_(t){return Array.isArray(t)}function qw(t){return typeof t=="function"}function xl(t){return!Y_(t)&&!W_(t)&&!qw(t)&&typeof t=="object"}function Y_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function ooe(t,e){return!(!(0,Hw.isPlainObject)(t)||!(0,Hw.isPlainObject)(e))}});var Yw=E(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.callWithTimeout=rc.TimeoutError=void 0;var K_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};rc.TimeoutError=K_;function soe(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new K_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}rc.callWithTimeout=soe});var zw=E(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.isUrlIgnored=oc.urlMatches=void 0;function Ww(t,e){return typeof e=="string"?t===e:!!t.match(e)}oc.urlMatches=Ww;function ioe(t,e){if(!e)return!1;for(let n of e)if(Ww(t,n))return!0;return!1}oc.isUrlIgnored=ioe});var Kw=E(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_.Deferred=void 0;var DA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};Q_.Deferred=DA});var Qw=E(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_.BindOnceFuture=void 0;var aoe=Kw(),UA=class{_isCalled=!1;_deferred=new aoe.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};X_.BindOnceFuture=UA});var Jw=E(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});J_.diagLogLevelFromString=void 0;var Po=(b(),N(v)),Xw={ALL:Po.DiagLogLevel.ALL,VERBOSE:Po.DiagLogLevel.VERBOSE,DEBUG:Po.DiagLogLevel.DEBUG,INFO:Po.DiagLogLevel.INFO,WARN:Po.DiagLogLevel.WARN,ERROR:Po.DiagLogLevel.ERROR,NONE:Po.DiagLogLevel.NONE};function coe(t){if(t==null)return;let e=Xw[t.toUpperCase()];return e??(Po.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(Xw)}, using default`),Po.DiagLogLevel.INFO)}J_.diagLogLevelFromString=coe});var ek=E(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_._export=void 0;var Zw=(b(),N(v)),uoe=bl();function loe(t,e){return new Promise(n=>{Zw.context.with((0,uoe.suppressTracing)(Zw.context.active()),()=>{t.export(e,n)})})}Z_._export=loe});var Te=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var poe=wP();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return poe.W3CBaggagePropagator}});var doe=kP();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return doe.AnchoredClock}});var tk=FP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return tk.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return tk.sanitizeAttributes}});var nk=qP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return nk.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return nk.setGlobalErrorHandler}});var _oe=KS();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return _oe.loggingErrorHandler}});var Qn=yw();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return Qn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return Qn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return Qn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return Qn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Qn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Qn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return Qn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return Qn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return Qn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return Qn.timeInputToHrTime}});var foe=Iw();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return foe.unrefTimer}});var moe=Nw();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return moe.ExportResultCode}});var hoe=qS();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return hoe.parseKeyPairsIntoRecord}});var Ui=NA();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return Ui.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return Ui._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return Ui.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return Ui.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return Ui.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return Ui.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return Ui.otperformance}});var Toe=bw();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return Toe.CompositePropagator}});var ef=Dw();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return ef.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return ef.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return ef.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return ef.parseTraceParent}});var tf=Uw();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return tf.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return tf.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return tf.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return tf.setRPCMetadata}});var wA=bl();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return wA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return wA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return wA.unsuppressTracing}});var Eoe=MA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return Eoe.TraceState}});var goe=$w();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return goe.merge}});var rk=Yw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return rk.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return rk.callWithTimeout}});var ok=zw();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return ok.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return ok.urlMatches}});var Soe=Qw();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return Soe.BindOnceFuture}});var Aoe=Jw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return Aoe.diagLogLevelFromString}});var Roe=ek();y.internal={_export:Roe._export}});var sk=E(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.VERSION=void 0;nf.VERSION="0.214.0"});var ik=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.SeverityNumber=void 0;var yoe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(yoe=vl.SeverityNumber||(vl.SeverityNumber={}))});var of=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.NOOP_LOGGER=sc.NoopLogger=void 0;var rf=class{emit(e){}};sc.NoopLogger=rf;sc.NOOP_LOGGER=new rf});var ak=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.API_BACKWARDS_COMPATIBILITY_VERSION=Yr.makeGetter=Yr._global=Yr.GLOBAL_LOGS_API_KEY=void 0;Yr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Yr._global=globalThis;function Ioe(t,e,n){return r=>r===t?e:n}Yr.makeGetter=Ioe;Yr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var kA=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.NOOP_LOGGER_PROVIDER=ic.NoopLoggerProvider=void 0;var Noe=of(),sf=class{getLogger(e,n,r){return new Noe.NoopLogger}};ic.NoopLoggerProvider=sf;ic.NOOP_LOGGER_PROVIDER=new sf});var ck=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.ProxyLogger=void 0;var Ooe=of(),GA=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ooe.NOOP_LOGGER}};af.ProxyLogger=GA});var uk=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.ProxyLoggerProvider=void 0;var boe=kA(),Coe=ck(),BA=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Coe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:boe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};cf.ProxyLoggerProvider=BA});var pk=E(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.LogsAPI=void 0;var Xn=ak(),Poe=kA(),lk=uk(),jA=class t{constructor(){this._proxyLoggerProvider=new lk.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Xn._global[Xn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Xn._global[Xn.GLOBAL_LOGS_API_KEY]=(0,Xn.makeGetter)(Xn.API_BACKWARDS_COMPATIBILITY_VERSION,e,Poe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Xn._global[Xn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Xn._global,Xn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Xn._global[Xn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new lk.ProxyLoggerProvider}};uf.LogsAPI=jA});var HA=E(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.logs=Wr.NoopLogger=Wr.NOOP_LOGGER=Wr.SeverityNumber=void 0;var Moe=ik();Object.defineProperty(Wr,"SeverityNumber",{enumerable:!0,get:function(){return Moe.SeverityNumber}});var dk=of();Object.defineProperty(Wr,"NOOP_LOGGER",{enumerable:!0,get:function(){return dk.NOOP_LOGGER}});Object.defineProperty(Wr,"NoopLogger",{enumerable:!0,get:function(){return dk.NoopLogger}});var xoe=pk();Wr.logs=xoe.LogsAPI.getInstance()});var _k=E(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.disableInstrumentations=ac.enableInstrumentations=void 0;function voe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}ac.enableInstrumentations=voe;function Loe(t){t.forEach(e=>e.disable())}ac.disableInstrumentations=Loe});var hk=E(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.registerInstrumentations=void 0;var fk=(b(),N(v)),Doe=HA(),mk=_k();function Uoe(t){let e=t.tracerProvider||fk.trace.getTracerProvider(),n=t.meterProvider||fk.metrics.getMeterProvider(),r=t.loggerProvider||Doe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,mk.enableInstrumentations)(o,e,n,r),()=>{(0,mk.disableInstrumentations)(o)}}lf.registerInstrumentations=Uoe});var Nk=E(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.satisfies=void 0;var $A=(b(),N(v)),Ak=/^(?: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-]+)*))?$/,woe=/^(?<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-]+)*))?$/,koe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Goe(t,e,n){if(!Boe(t))return $A.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Voe(t);if(!r)return!1;let o=[],s=Rk(r,e,o,n);return s&&!n?.includePrerelease?Hoe(r,o):s}pf.satisfies=Goe;function Boe(t){return typeof t=="string"&&Ak.test(t)}function Rk(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(FA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=lse(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!FA(t,s,n,r))return!1;return!0}return FA(t,e,n,r)}function FA(t,e,n,r){if(e=Foe(e,r),e.includes(" "))return Rk(t,e,n,r);{let o=qoe(e);return n.push(o),joe(t,o)}}function joe(t,e){if(e.invalid)return!1;if(!e.version||qA(e.version))return!0;let n=Ek(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=Ek(r,o)}return koe[e.op]?.includes(n)}function Hoe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Foe(t,e){return t=t.trim(),t=cse(t,e),t=ase(t),t=use(t,e),t=t.trim(),t}function sn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Voe(t){let e=t.match(Ak);if(!e){$A.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function qoe(t){if(!t)return{};let e=t.match(woe);if(!e)return $A.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function qA(t){return t==="*"||t==="x"||t==="X"}function Tk(t){let e=parseInt(t,10);return isNaN(e)?t:e}function $oe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Yoe(t,e){if(qA(t)||qA(e))return 0;let[n,r]=$oe(Tk(t),Tk(e));return n>r?1:n<r?-1:0}function Ek(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Yoe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var yk="[a-zA-Z0-9-]",Ik="0|[1-9]\\d*",Woe=`\\d*[a-zA-Z-]${yk}*`,zoe="((?:<|>)?=?)",gk=`(?:${Ik}|${Woe})`,Koe=`(?:-(${gk}(?:\\.${gk})*))`,Sk=`${yk}+`,Qoe=`(?:\\+(${Sk}(?:\\.${Sk})*))`,VA=`${Ik}|x|X|\\*`,Ll=`[v=\\s]*(${VA})(?:\\.(${VA})(?:\\.(${VA})(?:${Koe})?${Qoe}?)?)?`,Xoe=`^${zoe}\\s*${Ll}$`,Joe=new RegExp(Xoe),Zoe=`^\\s*(${Ll})\\s+-\\s+(${Ll})\\s*$`,ese=new RegExp(Zoe),tse="(?:~>?)",nse=`^${tse}${Ll}$`,rse=new RegExp(nse),ose="(?:\\^)",sse=`^${ose}${Ll}$`,ise=new RegExp(sse);function ase(t){let e=rse;return t.replace(e,(n,r,o,s,i)=>{let a;return sn(r)?a="":sn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:sn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function cse(t,e){let n=ise,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return sn(s)?l="":sn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:sn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function use(t,e){let n=Joe;return t.replace(n,(r,o,s,i,a,c)=>{let l=sn(s),p=l||sn(i),d=p||sn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function lse(t,e){let n=ese;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(sn(s)?o="":sn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:sn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,sn(d)?p="":sn(_)?p=`<${+d+1}.0.0-0`:sn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var YA=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.massUnwrap=xt.unwrap=xt.massWrap=xt.wrap=void 0;var an=console.error.bind(console);function Dl(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var pse=(t,e,n)=>{if(!t||!t[e]){an("no original function "+String(e)+" to wrap");return}if(!n){an("no wrapper function"),an(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){an("original object and wrapper must be functions");return}let o=n(r,e);return Dl(o,"__original",r),Dl(o,"__unwrap",()=>{t[e]===o&&Dl(t,e,r)}),Dl(o,"__wrapped",!0),Dl(t,e,o),o};xt.wrap=pse;var dse=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,xt.wrap)(r,o,n)})})};xt.massWrap=dse;var _se=(t,e)=>{if(!t||!t[e]){an("no function to unwrap."),an(new Error().stack);return}let n=t[e];if(!n.__unwrap)an("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};xt.unwrap=_se;var fse=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,xt.unwrap)(n,r)})})};xt.massUnwrap=fse;function Ul(t){t&&t.logger&&(typeof t.logger!="function"?an("new logger isn't a function, not replacing"):an=t.logger)}xt.default=Ul;Ul.wrap=xt.wrap;Ul.massWrap=xt.massWrap;Ul.unwrap=xt.unwrap;Ul.massUnwrap=xt.massUnwrap});var Ok=E(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.InstrumentationAbstract=void 0;var WA=(b(),N(v)),mse=HA(),df=YA(),zA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=WA.diag.createComponentLogger({namespace:e}),this._tracer=WA.trace.getTracer(e,n),this._meter=WA.metrics.getMeter(e,n),this._logger=mse.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=df.wrap;_unwrap=df.unwrap;_massWrap=df.massWrap;_massUnwrap=df.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};_f.InstrumentationAbstract=zA});var Ck=E((Z0e,bk)=>{var cc=1e3,uc=cc*60,lc=uc*60,wi=lc*24,hse=wi*7,Tse=wi*365.25;bk.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return Ese(t);if(n==="number"&&isFinite(t))return e.long?Sse(t):gse(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Ese(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Tse;case"weeks":case"week":case"w":return n*hse;case"days":case"day":case"d":return n*wi;case"hours":case"hour":case"hrs":case"hr":case"h":return n*lc;case"minutes":case"minute":case"mins":case"min":case"m":return n*uc;case"seconds":case"second":case"secs":case"sec":case"s":return n*cc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function gse(t){var e=Math.abs(t);return e>=wi?Math.round(t/wi)+"d":e>=lc?Math.round(t/lc)+"h":e>=uc?Math.round(t/uc)+"m":e>=cc?Math.round(t/cc)+"s":t+"ms"}function Sse(t){var e=Math.abs(t);return e>=wi?ff(t,e,wi,"day"):e>=lc?ff(t,e,lc,"hour"):e>=uc?ff(t,e,uc,"minute"):e>=cc?ff(t,e,cc,"second"):t+" ms"}function ff(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var KA=E((eDe,Pk)=>{function Ase(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ck(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function h(...T){if(!h.enabled)return;let g=h,R=Number(new Date),I=R-(d||R);g.diff=I,g.prev=d,g.curr=R,d=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let x=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let on=T[x];B=ve.call(g,on),T.splice(x,1),x--}return B}),n.formatArgs.call(g,T),(g.log||n.log).apply(g,T)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:T=>{_=T}}),typeof n.init=="function"&&n.init(h),h}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,h=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,h=_,f++):(_++,f++);else if(m!==-1)f=m+1,h++,_=h;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Pk.exports=Ase});var Mk=E((Sn,mf)=>{Sn.formatArgs=yse;Sn.save=Ise;Sn.load=Nse;Sn.useColors=Rse;Sn.storage=Ose();Sn.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Sn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Rse(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function yse(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+mf.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}Sn.log=console.debug||console.log||(()=>{});function Ise(t){try{t?Sn.storage.setItem("debug",t):Sn.storage.removeItem("debug")}catch{}}function Nse(){let t;try{t=Sn.storage.getItem("debug")||Sn.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Ose(){try{return localStorage}catch{}}mf.exports=KA()(Sn);var{formatters:bse}=mf.exports;bse.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var vk=E((tDe,xk)=>{"use strict";xk.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var Uk=E((nDe,Dk)=>{"use strict";var Cse=U("os"),Lk=U("tty"),Jn=vk(),{env:gt}=process,us;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?us=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(us=1);"FORCE_COLOR"in gt&&(gt.FORCE_COLOR==="true"?us=1:gt.FORCE_COLOR==="false"?us=0:us=gt.FORCE_COLOR.length===0?1:Math.min(parseInt(gt.FORCE_COLOR,10),3));function QA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function XA(t,e){if(us===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(t&&!e&&us===void 0)return 0;let n=us||0;if(gt.TERM==="dumb")return n;if(process.platform==="win32"){let r=Cse.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in gt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in gt)||gt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in gt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gt.TEAMCITY_VERSION)?1:0;if(gt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in gt){let r=parseInt((gt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gt.TERM)||"COLORTERM"in gt?1:n}function Pse(t){let e=XA(t,t&&t.isTTY);return QA(e)}Dk.exports={supportsColor:Pse,stdout:QA(XA(!0,Lk.isatty(1))),stderr:QA(XA(!0,Lk.isatty(2)))}});var kk=E((St,Tf)=>{var Mse=U("tty"),hf=U("util");St.init=kse;St.log=Dse;St.formatArgs=vse;St.save=Use;St.load=wse;St.useColors=xse;St.destroy=hf.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");St.colors=[6,2,3,4,5,1];try{let t=Uk();t&&(t.stderr||t).level>=2&&(St.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}St.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function xse(){return"colors"in St.inspectOpts?!!St.inspectOpts.colors:Mse.isatty(process.stderr.fd)}function vse(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
4
4
|
`).join(`
|
|
5
|
-
`+s),t.push(o+"m+"+
|
|
6
|
-
`)}function
|
|
7
|
-
`).map(e=>e.trim()).join(" ")};Lk.O=function(t){return this.inspectOpts.colors=this.useColors,ff.inspect(t,this.inspectOpts)}});var Uk=E((K0e,QA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?QA.exports=bk():QA.exports=Dk()});var hf=E((Q0e,wk)=>{"use strict";var XA=U("path").sep;wk.exports=function(t){var e=t.split(XA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+XA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+XA;return{name:o,basedir:i,path:l}}}});var ki=E((X0e,eR)=>{"use strict";var pc=U("path"),yr=U("module"),ze=Uk()("require-in-the-middle"),wse=hf();eR.exports=wl;eR.exports.Hook=wl;var JA,Tf;if(yr.isBuiltin)Tf=yr.isBuiltin;else if(yr.builtinModules)Tf=t=>t.startsWith("node:")?!0:(JA===void 0&&(JA=new Set(yr.builtinModules)),JA.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var kse=/([/\\]index)?(\.js)?$/,ZA=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function wl(t,e,n){if(!(this instanceof wl))return new wl(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof yr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof yr._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues",process.version);return}this._cache=new ZA,this._unhooked=!1,this._origRequire=yr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=yr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=Tf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);Tf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=yr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let h=o.has(_);h===!1&&o.add(_);let T=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(h===!0)return ze("module is in the process of being patched already - ignoring: %s",_),T;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),T;f=_}else if(i===!0&&t.includes(_)){let R=pc.parse(_);f=R.name,m=R.dir}else{let R=wse(_);if(R===void 0)return ze("could not parse filename: %s",_),T;f=R.name,m=R.basedir;let I=Gse(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return T;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let F;try{F=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,T,d),T}if(F!==_)if(s===!0)f=f+pc.sep+pc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",F),r._cache.set(_,T,d),T}}r._cache.set(_,T,d),ze("calling require hook: %s",f);let S=n(T,f,m);return r._cache.set(_,S,d),ze("returning module: %s",f),S}}wl.prototype.unhook=function(){this._unhooked=!0,this._require===yr.prototype.require?(yr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function Gse(t){let e=pc.sep!=="/"?t.path.split(pc.sep).join("/"):t.path;return pc.posix.join(t.name,e).replace(kse,"")}});var kk=E(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ModuleNameTrie=ls.ModuleNameSeparator=void 0;ls.ModuleNameSeparator="/";var Ef=class{hooks=[];children=new Map},tR=class{_trie=new Ef;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ls.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Ef,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ls.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ls.ModuleNameTrie=tR});var Bk=E(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.RequireInTheMiddleSingleton=void 0;var Bse=ki(),Gk=U("path"),nR=kk(),jse=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),rR=class t{_moduleNameTrie=new nR.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Bse.Hook(null,{internals:!0},(e,n,r)=>{let o=Hse(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return jse?new t:this._instance=this._instance??new t}};Sf.RequireInTheMiddleSingleton=rR;function Hse(t){return Gk.sep!==nR.ModuleNameSeparator?t.split(Gk.sep).join(nR.ModuleNameSeparator):t}});var qk=E(kl=>{var jk=[],oR=new WeakMap,Hk=new WeakMap,Fk=new Map,Vk=[],Fse={set(t,e,n){let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Hk.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function Vse(t,e,n,r,o){Fk.set(t,o),oR.set(e,n),Hk.set(e,r);let s=new Proxy(e,Fse);jk.forEach(i=>i(t,s,o)),Vk.push([t,s,o])}kl.register=Vse;kl.importHooks=jk;kl.specifiers=Fk;kl.toHook=Vk});var cR=E((nDe,_c)=>{var $k=U("path"),qse=hf(),{fileURLToPath:$se}=U("url"),{MessageChannel:Yse}=U("worker_threads"),{isBuiltin:sR}=U("module");sR||(sR=()=>!0);var{importHooks:iR,specifiers:Wse,toHook:zse}=qk();function Yk(t){iR.push(t),zse.forEach(([e,n,r])=>t(e,n,r))}function Wk(t){let e=iR.indexOf(t);e>-1&&iR.splice(e,1)}function dc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var aR;function Kse(){let{port1:t,port2:e}=new Yse,n=0,r;aR=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Gl(t,e,n){if(!(this instanceof Gl))return new Gl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;aR&&Array.isArray(t)&&aR(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);sR(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=$se(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=qse(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)dc(n,s,l,void 0);else if(d===o){if(!p)dc(n,s,o,p);else if(p.endsWith(Wse.get(a)))dc(n,s,o,p);else if(r){let _=o+$k.sep+$k.relative(p,l);dc(n,s,_,p)}}else d===i&&dc(n,s,i,p);else dc(n,s,o,p)},Yk(this._iitmHook)}Gl.prototype.unhook=function(){Wk(this._iitmHook)};_c.exports=Gl;_c.exports.Hook=Gl;_c.exports.addHook=Yk;_c.exports.removeHook=Wk;_c.exports.createAddHookMessageChannel=Kse});var uR=E(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.isWrapped=ps.safeExecuteInTheMiddleAsync=ps.safeExecuteInTheMiddle=void 0;function Qse(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddle=Qse;async function Xse(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddleAsync=Xse;function Jse(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ps.isWrapped=Jse});var Qk=E(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.InstrumentationBase=void 0;var Bl=U("path"),zk=U("util"),Zse=Rk(),lR=qA(),eie=yk(),tie=Bk(),nie=cR(),jl=(b(),O(v)),rie=ki(),oie=U("fs"),sie=uR(),pR=class extends eie.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=tie.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,sie.isWrapped)(e[n])&&this._unwrap(e,n),zk.types.isProxy(e)){let o=(0,lR.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,lR.wrap)(e,n,r)};_unwrap=(e,n)=>zk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,lR.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,oie.readFileSync)(Bl.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{jl.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return Kk(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Bl.normalize(r);return i.filter(l=>l.name===a&&Kk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Bl.isAbsolute(a)){let l=Bl.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Bl.isAbsolute(e.name)?new rie.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new nie.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};gf.InstrumentationBase=pR;function Kk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,Zse.satisfies)(e,r,{includePrerelease:n}))}});var Xk=E(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.normalize=void 0;var iie=U("path");Object.defineProperty(Af,"normalize",{enumerable:!0,get:function(){return iie.normalize}})});var Jk=E(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.normalize=fc.InstrumentationBase=void 0;var aie=Qk();Object.defineProperty(fc,"InstrumentationBase",{enumerable:!0,get:function(){return aie.InstrumentationBase}});var cie=Xk();Object.defineProperty(fc,"normalize",{enumerable:!0,get:function(){return cie.normalize}})});var dR=E(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.normalize=mc.InstrumentationBase=void 0;var Zk=Jk();Object.defineProperty(mc,"InstrumentationBase",{enumerable:!0,get:function(){return Zk.InstrumentationBase}});Object.defineProperty(mc,"normalize",{enumerable:!0,get:function(){return Zk.normalize}})});var eG=E(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InstrumentationNodeModuleDefinition=void 0;var _R=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};Rf.InstrumentationNodeModuleDefinition=_R});var tG=E(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.InstrumentationNodeModuleFile=void 0;var uie=dR(),fR=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,uie.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};yf.InstrumentationNodeModuleFile=fR});var nG=E(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.semconvStabilityFromStr=Gi.SemconvStability=void 0;var If;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(If=Gi.SemconvStability||(Gi.SemconvStability={}));function lie(t,e){let n=If.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=If.DUPLICATE;break}else o.toLowerCase()===t&&(n=If.STABLE);return n}Gi.semconvStabilityFromStr=lie});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var pie=_k();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return pie.registerInstrumentations}});var die=dR();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return die.InstrumentationBase}});var _ie=eG();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return _ie.InstrumentationNodeModuleDefinition}});var fie=tG();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return fie.InstrumentationNodeModuleFile}});var mR=uR();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return mR.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddleAsync}});var rG=nG();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return rG.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return rG.semconvStabilityFromStr}})});var oG=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var sG=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.AttributeNames=void 0;var mie;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(mie=Hl.AttributeNames||(Hl.AttributeNames={}))});var hR=E(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.DEFAULT_QUERY_STRINGS_TO_REDACT=zr.STR_REDACTED=zr.SYNTHETIC_BOT_NAMES=zr.SYNTHETIC_TEST_NAMES=void 0;zr.SYNTHETIC_TEST_NAMES=["alwayson"];zr.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];zr.STR_REDACTED="REDACTED";zr.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var aG=E((mDe,iG)=>{"use strict";var hie=U("util");function TR(t,e){Error.captureStackTrace(this,TR),this.name=this.constructor.name,this.message=t,this.input=e}hie.inherits(TR,Error);iG.exports=TR});var uG=E((hDe,cG)=>{"use strict";function Tie(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function Eie(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function Sie(t){return t>=32&&t<=126}function gie(t){return t>=128&&t<=255}cG.exports={isDelimiter:Tie,isTokenChar:Eie,isExtended:gie,isPrint:Sie}});var fG=E((TDe,_G)=>{"use strict";var Aie=U("util"),hc=aG(),Of=uG(),Rie=Of.isDelimiter,lG=Of.isTokenChar,pG=Of.isExtended,yie=Of.isPrint;function dG(t){return t.replace(/\\(.)/g,"$1")}function Fl(t,e){return Aie.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function Iie(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(lG(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new hc(Fl(t,p),t)}else if(n&&(l===9||yie(l)||pG(l)))n=!1;else if(lG(l)){if(a!==-1)throw new hc(Fl(t,p),t);i===-1&&(i=p)}else if(Rie(l)||pG(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new hc(Fl(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new hc(Fl(t,p),t)}else throw new hc(Fl(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new hc("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}_G.exports=Iie});var yG=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Vl=(b(),O(v)),ae=(le(),O(Ae)),V=oG(),mG=Te(),kn=ne(),Oie=U("url"),bf=sG(),hG=hR(),Nf=hR(),Nie=fG(),bie=(t,e,n="http:",r=Array.from(Nf.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,Nf.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${Nf.STR_REDACTED}:${Nf.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=bie;var Cie=(t,e)=>{let n=t===Vl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Vl.SpanStatusCode.UNSET:Vl.SpanStatusCode.ERROR};$.parseResponseStatus=Cie;var Pie=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=Pie;var Mie=(t,e,n)=>{let r=e.message;n&kn.SemconvStability.OLD&&(t.setAttribute(bf.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(bf.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&kn.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Vl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=Mie;var xie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=xie;var vie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=vie;function EG(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var Lie=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=Lie;function Die(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var Uie=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=Die(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof Oie.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=Uie;var wie=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=wie;var kie=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=kie;var Gie=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=AG(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[V.ATTR_HTTP_URL]:p,[V.ATTR_HTTP_METHOD]:i,[V.ATTR_HTTP_TARGET]:t.path||"/",[V.ATTR_NET_PEER_NAME]:o,[V.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(l)),l!==void 0&&(d[V.ATTR_HTTP_USER_AGENT]=l),n){case kn.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case kn.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=Gie;var Bie=t=>{let e={};return e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_PEER_NAME]=t[V.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=Bie;var jie=(t,e)=>{t&&(e[V.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_TCP:e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=jie;var SG=t=>{let e=String(t).toLowerCase();for(let n of hG.SYNTHETIC_TEST_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of hG.SYNTHETIC_BOT_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},Hie=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[V.ATTR_NET_PEER_IP]=c,i[V.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[V.ATTR_HTTP_STATUS_CODE]=n,i[bf.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case kn.SemconvStability.STABLE:return a;case kn.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=Hie;var Fie=t=>{let e={};return e[V.ATTR_NET_PEER_PORT]=t[V.ATTR_NET_PEER_PORT],e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=Fie;var Vie=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=Vie;function ds(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function qie(t,e){let n=t.headers.forwarded;if(n){for(let s of RG(n))if(s.host)return ds(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?ds(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r,t.headers["x-forwarded-proto"][0]):ds(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?ds(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r[0],t.headers["x-forwarded-proto"][0]):ds(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?ds(o,e):null}function gG(t){let e=t.headers.forwarded;if(e){for(let o of RG(e))if(o.for)return TG(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),TG(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=gG;function TG(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function $ie(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var Yie=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=$ie(r,t,n),h,T;if(i!==kn.SemconvStability.OLD){let S=AG(p),R=qie(t,r),I=gG(t);h={[ae.ATTR_HTTP_REQUEST_METHOD]:S,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(h[ae.ATTR_URL_PATH]=m.pathname),m.search&&(h[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(h[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(h[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==S&&(h[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(h[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(_))}if(i!==kn.SemconvStability.STABLE){let S=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";T={[V.ATTR_HTTP_URL]:m.toString(),[V.ATTR_HTTP_HOST]:d,[V.ATTR_NET_HOST_NAME]:S,[V.ATTR_HTTP_METHOD]:p,[V.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(T[V.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(T[V.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(T[V.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(T[V.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,T),(0,$.setAttributesFromHttpKind)(l,T)}switch(i){case kn.SemconvStability.STABLE:return Object.assign(h,s);case kn.SemconvStability.OLD:return Object.assign(T,s);default:return Object.assign(T,h,s)}};$.getIncomingRequestAttributes=Yie;var Wie=t=>{let e={};return e[V.ATTR_HTTP_SCHEME]=t[V.ATTR_HTTP_SCHEME],e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_HOST_NAME]=t[V.ATTR_NET_HOST_NAME],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=Wie;var zie=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,mG.getRPCMetadata)(Vl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[V.ATTR_NET_HOST_IP]=l,c[V.ATTR_NET_HOST_PORT]=p,c[V.ATTR_NET_PEER_IP]=d,c[V.ATTR_NET_PEER_PORT]=_}switch(c[V.ATTR_HTTP_STATUS_CODE]=o,c[bf.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===mG.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case kn.SemconvStability.STABLE:return i;case kn.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=zie;var Kie=t=>{let e={};return e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_NET_HOST_PORT]=t[V.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=Kie;var Qie=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=Qie;function Xie(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&kn.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=Xie;var Jie=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function AG(t){if(t==null)return"GET";let e=t.toUpperCase();return Jie.has(e)?e:"_OTHER"}function RG(t){try{return Nie(t)}catch{return[]}}});var IG=E(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.HttpInstrumentation=void 0;var oe=(b(),O(v)),_s=Te(),Zie=U("url"),eae=nk(),Rt=ne(),ER=U("events"),Le=(le(),O(Ae)),Ke=yG(),SR=class extends Rt.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=Rt.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",eae.VERSION,e),this._semconvStability=(0,Rt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(ER.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(ER.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,_s.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,_s.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),h={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let T=oe.propagation.extract(oe.ROOT_CONTEXT,p),S=r._startHttpSpan(l,_,T),R={type:_s.RPCType.HTTP,span:S};return oe.context.with((0,_s.setRPCMetadata)(oe.trace.setSpan(T,S),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(S,a),r.getConfig().responseHook&&r._callResponseHook(S,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,S,m,h,f)}),c.on(ER.errorMonitor,x=>{I=!0,r._onServerResponseError(S,m,h,f,x)}),(0,Rt.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(S,m,h,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof Zie.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),F=>{F!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",F)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,_s.hrTime)(),h=(0,Ke.getOutgoingRequestMetricAttributes)(f),T={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let S={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,S),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let F=i[i.length-1];typeof F=="function"&&(i[i.length-1]=oe.context.bind(I,F));let B=(0,Rt.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,h,T,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,h,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,_s.hrTimeToMilliseconds)((0,_s.hrTimeDuration)(r,(0,_s.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,Rt.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};Cf.HttpInstrumentation=SR});var OG=E(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.HttpInstrumentation=void 0;var tae=IG();Object.defineProperty(Pf,"HttpInstrumentation",{enumerable:!0,get:function(){return tae.HttpInstrumentation}})});var EI=E(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.AbstractAsyncHooksContextManager=void 0;var wpe=U("events"),kpe=["addListener","on","once","prependListener","prependOnceListener"],TI=class{bind(e,n){return n instanceof wpe.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),kpe.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners))),n}_patchRemoveListener(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};Hm.AbstractAsyncHooksContextManager=TI});var PH=E(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.AsyncHooksContextManager=void 0;var Gpe=(b(),O(v)),Bpe=U("async_hooks"),jpe=EI(),SI=class extends jpe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=Bpe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??Gpe.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Fm.AsyncHooksContextManager=SI});var MH=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.AsyncLocalStorageContextManager=void 0;var Hpe=(b(),O(v)),Fpe=U("async_hooks"),Vpe=EI(),gI=class extends Vpe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new Fpe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??Hpe.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Vm.AsyncLocalStorageContextManager=gI});var xH=E(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.AsyncLocalStorageContextManager=Qc.AsyncHooksContextManager=void 0;var qpe=PH();Object.defineProperty(Qc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return qpe.AsyncHooksContextManager}});var $pe=MH();Object.defineProperty(Qc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return $pe.AsyncLocalStorageContextManager}})});var AI=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc._clearDefaultServiceNameCache=Xc.defaultServiceName=void 0;var xp;function Ype(){if(xp===void 0)try{let t=globalThis.process.argv0;xp=t?`unknown_service:${t}`:"unknown_service"}catch{xp="unknown_service"}return xp}Xc.defaultServiceName=Ype;function Wpe(){xp=void 0}Xc._clearDefaultServiceNameCache=Wpe});var vH=E(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.isPromiseLike=void 0;var zpe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";qm.isPromiseLike=zpe});var II=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.defaultResource=to.emptyResource=to.resourceFromDetectedResource=to.resourceFromAttributes=void 0;var Lp=(b(),O(v)),RI=Te(),ia=(le(),O(Ae)),Kpe=AI(),vp=vH(),$m=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=LH(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,vp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,vp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=LH(this._rawAttributes),this._schemaUrl=Zpe(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,vp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Lp.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,vp.isPromiseLike)(r)){Lp.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=ede(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function yI(t,e){return $m.FromAttributeList(Object.entries(t),e)}to.resourceFromAttributes=yI;function Qpe(t,e){return new $m(t,e)}to.resourceFromDetectedResource=Qpe;function Xpe(){return yI({})}to.emptyResource=Xpe;function Jpe(){return yI({[ia.ATTR_SERVICE_NAME]:(0,Kpe.defaultServiceName)(),[ia.ATTR_TELEMETRY_SDK_LANGUAGE]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_LANGUAGE],[ia.ATTR_TELEMETRY_SDK_NAME]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_NAME],[ia.ATTR_TELEMETRY_SDK_VERSION]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_VERSION]})}to.defaultResource=Jpe;function LH(t){return t.map(([e,n])=>(0,vp.isPromiseLike)(n)?[e,n.catch(r=>{Lp.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function Zpe(t){if(typeof t=="string"||t===void 0)return t;Lp.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function ede(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;Lp.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var UH=E(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});Ym.detectResources=void 0;var DH=(b(),O(v)),OI=II(),tde=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,OI.resourceFromDetectedResource)(n.detect(t));return DH.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return DH.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,OI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,OI.emptyResource)());Ym.detectResources=tde});var kH=E(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});Wm.envDetector=void 0;var nde=(b(),O(v)),rde=(le(),O(Ae)),wH=Te(),NI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,wH.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,wH.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){nde.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[rde.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};Wm.envDetector=new NI});var Dp=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var Km=E(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.execAsync=void 0;var ode=U("child_process"),sde=U("util");zm.execAsync=sde.promisify(ode.exec)});var GH=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.getMachineId=void 0;var ide=Km(),ade=(b(),O(v));async function cde(){try{let e=(await(0,ide.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
8
|
-
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ade.diag.debug(`error reading machine id: ${t}`)}}Qm.getMachineId=cde});var BH=E(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getMachineId=void 0;var ude=U("fs"),lde=(b(),O(v));async function pde(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await ude.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){lde.diag.debug(`error reading machine id: ${n}`)}}Xm.getMachineId=pde});var HH=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.getMachineId=void 0;var dde=U("fs"),_de=Km(),jH=(b(),O(v));async function fde(){try{return(await dde.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,_de.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}}Jm.getMachineId=fde});var VH=E(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getMachineId=void 0;var FH=U("process"),mde=Km(),hde=(b(),O(v));async function Tde(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";FH.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in FH.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,mde.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){hde.diag.debug(`error reading machine id: ${n}`)}}Zm.getMachineId=Tde});var qH=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.getMachineId=void 0;var Ede=(b(),O(v));async function Sde(){Ede.diag.debug("could not read machine-id: unsupported platform")}eh.getMachineId=Sde});var $H=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.getMachineId=void 0;var gde=U("process"),aa;async function Ade(){if(!aa)switch(gde.platform){case"darwin":aa=(await Promise.resolve().then(()=>K(GH()))).getMachineId;break;case"linux":aa=(await Promise.resolve().then(()=>K(BH()))).getMachineId;break;case"freebsd":aa=(await Promise.resolve().then(()=>K(HH()))).getMachineId;break;case"win32":aa=(await Promise.resolve().then(()=>K(VH()))).getMachineId;break;default:aa=(await Promise.resolve().then(()=>K(qH()))).getMachineId;break}return aa()}th.getMachineId=Ade});var bI=E(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.normalizeType=Jc.normalizeArch=void 0;var Rde=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Jc.normalizeArch=Rde;var yde=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Jc.normalizeType=yde});var WH=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.hostDetector=void 0;var CI=Dp(),YH=U("os"),Ide=$H(),Ode=bI(),PI=class{detect(e){return{attributes:{[CI.ATTR_HOST_NAME]:(0,YH.hostname)(),[CI.ATTR_HOST_ARCH]:(0,Ode.normalizeArch)((0,YH.arch)()),[CI.ATTR_HOST_ID]:(0,Ide.getMachineId)()}}}};nh.hostDetector=new PI});var QH=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.osDetector=void 0;var zH=Dp(),KH=U("os"),Nde=bI(),MI=class{detect(e){return{attributes:{[zH.ATTR_OS_TYPE]:(0,Nde.normalizeType)((0,KH.platform)()),[zH.ATTR_OS_VERSION]:(0,KH.release)()}}}};rh.osDetector=new MI});var XH=E(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.processDetector=void 0;var bde=(b(),O(v)),Ho=Dp(),Cde=U("os"),xI=class{detect(e){let n={[Ho.ATTR_PROCESS_PID]:process.pid,[Ho.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Ho.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Ho.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Ho.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Ho.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Ho.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Ho.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=Cde.userInfo();n[Ho.ATTR_PROCESS_OWNER]=r.username}catch(r){bde.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};oh.processDetector=new xI});var JH=E(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.serviceInstanceIdDetector=void 0;var Pde=Dp(),Mde=U("crypto"),vI=class{detect(e){return{attributes:{[Pde.ATTR_SERVICE_INSTANCE_ID]:(0,Mde.randomUUID)()}}}};sh.serviceInstanceIdDetector=new vI});var ZH=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.serviceInstanceIdDetector=no.processDetector=no.osDetector=no.hostDetector=void 0;var xde=WH();Object.defineProperty(no,"hostDetector",{enumerable:!0,get:function(){return xde.hostDetector}});var vde=QH();Object.defineProperty(no,"osDetector",{enumerable:!0,get:function(){return vde.osDetector}});var Lde=XH();Object.defineProperty(no,"processDetector",{enumerable:!0,get:function(){return Lde.processDetector}});var Dde=JH();Object.defineProperty(no,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dde.serviceInstanceIdDetector}})});var eF=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.serviceInstanceIdDetector=ro.processDetector=ro.osDetector=ro.hostDetector=void 0;var ih=ZH();Object.defineProperty(ro,"hostDetector",{enumerable:!0,get:function(){return ih.hostDetector}});Object.defineProperty(ro,"osDetector",{enumerable:!0,get:function(){return ih.osDetector}});Object.defineProperty(ro,"processDetector",{enumerable:!0,get:function(){return ih.processDetector}});Object.defineProperty(ro,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ih.serviceInstanceIdDetector}})});var tF=E(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.noopDetector=Zc.NoopDetector=void 0;var ah=class{detect(){return{attributes:{}}}};Zc.NoopDetector=ah;Zc.noopDetector=new ah});var nF=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.noopDetector=On.serviceInstanceIdDetector=On.processDetector=On.osDetector=On.hostDetector=On.envDetector=void 0;var Ude=kH();Object.defineProperty(On,"envDetector",{enumerable:!0,get:function(){return Ude.envDetector}});var ch=eF();Object.defineProperty(On,"hostDetector",{enumerable:!0,get:function(){return ch.hostDetector}});Object.defineProperty(On,"osDetector",{enumerable:!0,get:function(){return ch.osDetector}});Object.defineProperty(On,"processDetector",{enumerable:!0,get:function(){return ch.processDetector}});Object.defineProperty(On,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ch.serviceInstanceIdDetector}});var wde=tF();Object.defineProperty(On,"noopDetector",{enumerable:!0,get:function(){return wde.noopDetector}})});var DI=E(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.defaultServiceName=Fe.emptyResource=Fe.defaultResource=Fe.resourceFromAttributes=Fe.serviceInstanceIdDetector=Fe.processDetector=Fe.osDetector=Fe.hostDetector=Fe.envDetector=Fe.detectResources=void 0;var kde=UH();Object.defineProperty(Fe,"detectResources",{enumerable:!0,get:function(){return kde.detectResources}});var Up=nF();Object.defineProperty(Fe,"envDetector",{enumerable:!0,get:function(){return Up.envDetector}});Object.defineProperty(Fe,"hostDetector",{enumerable:!0,get:function(){return Up.hostDetector}});Object.defineProperty(Fe,"osDetector",{enumerable:!0,get:function(){return Up.osDetector}});Object.defineProperty(Fe,"processDetector",{enumerable:!0,get:function(){return Up.processDetector}});Object.defineProperty(Fe,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Up.serviceInstanceIdDetector}});var LI=II();Object.defineProperty(Fe,"resourceFromAttributes",{enumerable:!0,get:function(){return LI.resourceFromAttributes}});Object.defineProperty(Fe,"defaultResource",{enumerable:!0,get:function(){return LI.defaultResource}});Object.defineProperty(Fe,"emptyResource",{enumerable:!0,get:function(){return LI.emptyResource}});var Gde=AI();Object.defineProperty(Fe,"defaultServiceName",{enumerable:!0,get:function(){return Gde.defaultServiceName}})});var rF=E(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.ExceptionEventName=void 0;uh.ExceptionEventName="exception"});var oF=E(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.SpanImpl=void 0;var kt=(b(),O(v)),Gt=Te(),ca=(le(),O(Ae)),Bde=rF(),UI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:kt.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Gt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+Gt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return kt.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,Gt.isAttributeValue)(n))return kt.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return kt.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&kt.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,Gt.isTimeInput)(n)&&((0,Gt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,Gt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&kt.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,Gt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===kt.SpanStatusCode.UNSET)return this;if(this.status.code===kt.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===kt.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&kt.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){kt.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,Gt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(kt.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&&kt.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&kt.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(e){if(typeof e=="number"&&e<=Gt.otperformance.now())return(0,Gt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,Gt.millisToHrTime)(e);if(e instanceof Date)return(0,Gt.millisToHrTime)(e.getTime());if((0,Gt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,Gt.millisToHrTime)(Date.now());let n=Gt.otperformance.now()-this._performanceStartTime;return(0,Gt.addHrTimes)(this.startTime,(0,Gt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[ca.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[ca.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[ca.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[ca.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[ca.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[ca.ATTR_EXCEPTION_TYPE]||r[ca.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Bde.ExceptionEventName,r,n):kt.diag.warn(`Failed to record an exception ${e}`)}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 e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);kt.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(kt.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};lh.SpanImpl=UI});var eu=E(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.SamplingDecision=void 0;var jde;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(jde=wp.SamplingDecision||(wp.SamplingDecision={}))});var dh=E(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.AlwaysOffSampler=void 0;var Hde=eu(),wI=class{shouldSample(){return{decision:Hde.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};ph.AlwaysOffSampler=wI});var fh=E(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.AlwaysOnSampler=void 0;var Fde=eu(),kI=class{shouldSample(){return{decision:Fde.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};_h.AlwaysOnSampler=kI});var jI=E(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.ParentBasedSampler=void 0;var mh=(b(),O(v)),Vde=Te(),sF=dh(),GI=fh(),BI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,Vde.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new GI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new GI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new sF.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new GI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new sF.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=mh.trace.getSpanContext(e);return!a||!(0,mh.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&mh.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&mh.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};hh.ParentBasedSampler=BI});var FI=E(Th=>{"use strict";Object.defineProperty(Th,"__esModule",{value:!0});Th.TraceIdRatioBasedSampler=void 0;var qde=(b(),O(v)),iF=eu(),HI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,qde.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?iF.SamplingDecision.RECORD_AND_SAMPLED:iF.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};Th.TraceIdRatioBasedSampler=HI});var $I=E(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.buildSamplerFromEnv=tu.loadDefaultConfig=void 0;var qI=(b(),O(v)),oo=Te(),aF=dh(),VI=fh(),Eh=jI(),cF=FI(),so;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(so||(so={}));var Sh=1;function $de(){return{sampler:lF(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}tu.loadDefaultConfig=$de;function lF(){let t=(0,oo.getStringFromEnv)("OTEL_TRACES_SAMPLER")??so.ParentBasedAlwaysOn;switch(t){case so.AlwaysOn:return new VI.AlwaysOnSampler;case so.AlwaysOff:return new aF.AlwaysOffSampler;case so.ParentBasedAlwaysOn:return new Eh.ParentBasedSampler({root:new VI.AlwaysOnSampler});case so.ParentBasedAlwaysOff:return new Eh.ParentBasedSampler({root:new aF.AlwaysOffSampler});case so.TraceIdRatio:return new cF.TraceIdRatioBasedSampler(uF());case so.ParentBasedTraceIdRatio:return new Eh.ParentBasedSampler({root:new cF.TraceIdRatioBasedSampler(uF())});default:return qI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${so.ParentBasedAlwaysOn}".`),new Eh.ParentBasedSampler({root:new VI.AlwaysOnSampler})}}tu.buildSamplerFromEnv=lF;function uF(){let t=(0,oo.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Sh}.`),Sh):t<0||t>1?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${Sh}.`),Sh):t}});var YI=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.reconfigureLimits=ir.mergeConfig=ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var pF=$I(),gh=Te();ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function Yde(t){let e={sampler:(0,pF.buildSamplerFromEnv)()},n=(0,pF.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}ir.mergeConfig=Yde;function Wde(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,gh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,gh.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,gh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,gh.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}ir.reconfigureLimits=Wde});var dF=E(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.BatchSpanProcessorBase=void 0;var nu=(b(),O(v)),Fo=Te(),WI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Fo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(nu.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(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&nu.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&nu.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(nu.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);nu.context.with((0,Fo.suppressTracing)(nu.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Fo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Fo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Fo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};Ah.BatchSpanProcessorBase=WI});var _F=E(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.BatchSpanProcessor=void 0;var zde=dF(),zI=class extends zde.BatchSpanProcessorBase{onShutdown(){}};Rh.BatchSpanProcessor=zI});var hF=E(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.RandomIdGenerator=void 0;var Kde=8,mF=16,KI=class{generateTraceId=fF(mF);generateSpanId=fF(Kde)};Ih.RandomIdGenerator=KI;var yh=Buffer.allocUnsafe(mF);function fF(t){return function(){for(let n=0;n<t/4;n++)yh.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(yh[n]>0);n++)n===t-1&&(yh[t-1]=1);return yh.toString("hex",0,t)}}});var TF=E(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.RandomIdGenerator=ru.BatchSpanProcessor=void 0;var Qde=_F();Object.defineProperty(ru,"BatchSpanProcessor",{enumerable:!0,get:function(){return Qde.BatchSpanProcessor}});var Xde=hF();Object.defineProperty(ru,"RandomIdGenerator",{enumerable:!0,get:function(){return Xde.RandomIdGenerator}})});var QI=E(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.RandomIdGenerator=ou.BatchSpanProcessor=void 0;var EF=TF();Object.defineProperty(ou,"BatchSpanProcessor",{enumerable:!0,get:function(){return EF.BatchSpanProcessor}});Object.defineProperty(ou,"RandomIdGenerator",{enumerable:!0,get:function(){return EF.RandomIdGenerator}})});var SF=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.METRIC_OTEL_SDK_SPAN_STARTED=io.METRIC_OTEL_SDK_SPAN_LIVE=io.ATTR_OTEL_SPAN_SAMPLING_RESULT=io.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;io.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";io.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";io.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";io.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var gF=E(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TracerMetrics=void 0;var Oh=eu(),kp=SF(),XI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(kp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(kp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=Zde(n);if(this.startedSpans.add(1,{[kp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:Jde(e),[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===Oh.SamplingDecision.NOT_RECORD)return()=>{};let o={[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};Nh.TracerMetrics=XI;function Jde(t){return t?t.isRemote?"remote":"local":"none"}function Zde(t){switch(t){case Oh.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Oh.SamplingDecision.RECORD:return"RECORD_ONLY";case Oh.SamplingDecision.NOT_RECORD:return"DROP"}}});var AF=E(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.VERSION=void 0;bh.VERSION="2.6.1"});var RF=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.Tracer=void 0;var Nt=(b(),O(v)),Ch=Te(),e_e=oF(),t_e=YI(),n_e=QI(),r_e=gF(),o_e=AF(),JI=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,t_e.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new n_e.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",o_e.VERSION):Nt.createNoopMeter();this._tracerMetrics=new r_e.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,Ch.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,Ch.sanitizeAttributes)(I.attributes)})),_=(0,Ch.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let h=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,T={traceId:c,spanId:i,traceFlags:h,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(T);let S=(0,Ch.sanitizeAttributes)(Object.assign(_,f.attributes));return new e_e.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:T,name:e,kind:p,links:d,parentSpanContext:a,attributes:S,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};Ph.Tracer=JI});var yF=E(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.MultiSpanProcessor=void 0;var s_e=Te(),ZI=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,s_e.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};Mh.MultiSpanProcessor=ZI});var IF=E(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.BasicTracerProvider=ua.ForceFlushState=void 0;var i_e=Te(),a_e=DI(),c_e=RF(),u_e=$I(),l_e=yF(),p_e=YI(),su;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(su=ua.ForceFlushState||(ua.ForceFlushState={}));var eO=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,i_e.merge)({},(0,u_e.loadDefaultConfig)(),(0,p_e.reconfigureLimits)(e));this._resource=n.resource??(0,a_e.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new l_e.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new c_e.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=su.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==su.timeout&&(s=su.resolved,o(s))}).catch(a=>{clearTimeout(i),s=su.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==su.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ua.BasicTracerProvider=eO});var OF=E(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.ConsoleSpanExporter=void 0;var tO=Te(),nO=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,tO.hrTimeToMicroseconds)(e.startTime),duration:(0,tO.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:tO.ExportResultCode.SUCCESS})}};xh.ConsoleSpanExporter=nO});var bF=E(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.InMemorySpanExporter=void 0;var NF=Te(),rO=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:NF.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:NF.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};vh.InMemorySpanExporter=rO});var CF=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SimpleSpanProcessor=void 0;var d_e=(b(),O(v)),Lh=Te(),oO=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Lh.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(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&d_e.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,Lh.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await Lh.internal._export(this._exporter,[e]);if(n.code!==Lh.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};Dh.SimpleSpanProcessor=oO});var PF=E(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.NoopSpanProcessor=void 0;var sO=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};Uh.NoopSpanProcessor=sO});var iO=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var __e=IF();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return __e.BasicTracerProvider}});var MF=QI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return MF.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return MF.RandomIdGenerator}});var f_e=OF();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return f_e.ConsoleSpanExporter}});var m_e=bF();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return m_e.InMemorySpanExporter}});var h_e=CF();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return h_e.SimpleSpanProcessor}});var T_e=PF();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return T_e.NoopSpanProcessor}});var E_e=dh();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return E_e.AlwaysOffSampler}});var S_e=fh();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return S_e.AlwaysOnSampler}});var g_e=jI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return g_e.ParentBasedSampler}});var A_e=FI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return A_e.TraceIdRatioBasedSampler}});var R_e=eu();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return R_e.SamplingDecision}})});var rq=E(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.PACKAGE_NAME=lu.PACKAGE_VERSION=void 0;lu.PACKAGE_VERSION="0.24.0";lu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var sq=E(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.UndiciInstrumentation=void 0;var DO=U("diagnostics_channel"),$me=U("url"),Yp=ne(),qn=(b(),O(v)),Kh=Te(),ot=(le(),O(Ae)),oq=rq(),UO=class extends Yp.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(oq.PACKAGE_NAME,oq.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.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(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:qn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)DO.subscribe?.(e,n),i=()=>DO.unsubscribe?.(e,n);else{let a=DO.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
|
|
9
|
-
`);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,Yp.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),B=>B&&this._diag.error("caught ignoreRequestHook error: ",B),!0))return;let s=(0,
|
|
10
|
-
`:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,Yp.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?qn.SpanStatusCode.ERROR:qn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:qn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,Kh.hrTimeToMilliseconds)((0,Kh.hrTimeDuration)(n,(0,Kh.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};Qh.UndiciInstrumentation=UO});var iq=E(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.UndiciInstrumentation=void 0;var Yme=sq();Object.defineProperty(Xh,"UndiciInstrumentation",{enumerable:!0,get:function(){return Yme.UndiciInstrumentation}})});var Jh=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.ExpressLayerType=void 0;var Jme;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Jme=Wp.ExpressLayerType||(Wp.ExpressLayerType={}))});var Zh=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.AttributeNames=void 0;var Zme;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Zme=zp.AttributeNames||(zp.AttributeNames={}))});var wO=E(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu._LAYERS_STORE_PROPERTY=pu.kLayerPatched=void 0;pu.kLayerPatched=Symbol("express-layer-patched");pu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var _q=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var kO=Jh(),du=Zh(),la=wO(),ehe=(t,e)=>(Array.isArray(t[la._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,la._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[la._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=ehe;var the=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=the;var nhe=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[du.AttributeNames.EXPRESS_NAME]:o,[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[du.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[du.AttributeNames.EXPRESS_NAME]:e.name,[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=nhe;var rhe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},ohe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(rhe(t,r))return!0}catch{}return!1};st.isLayerIgnored=ohe;var she=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=she;var ihe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>pq(n)||"").join(","):pq(e)};st.getLayerPath=ihe;var pq=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function dq(t){let n=(Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=dq;function ahe(t){let e=Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=dq(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||che(r))?r:void 0}st.getActualMatchedRoute=ahe;function che(t){return t.includes(":")||t.includes("*")}});var fq=E(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.PACKAGE_NAME=_u.PACKAGE_VERSION=void 0;_u.PACKAGE_VERSION="0.62.0";_u.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var Sq=E(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});tT.ExpressInstrumentation=void 0;var mq=Te(),Nn=(b(),O(v)),hq=Jh(),Tq=Zh(),uo=_q(),Eq=fq(),fu=ne(),uhe=(le(),O(Ae)),eT=wO(),GO=class extends fu.InstrumentationBase{constructor(e={}){super(Eq.PACKAGE_NAME,Eq.PACKAGE_VERSION,e)}init(){return[new fu.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,fu.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,fu.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,fu.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,uo.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[eT.kLayerPatched]!==!0&&(e[eT.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,uo.storeLayerPath)(i,n),l=(0,uo.getConstructedRoute)(i),p=(0,uo.getActualMatchedRoute)(i),d={[uhe.ATTR_HTTP_ROUTE]:p},_=(0,uo.getLayerMetadata)(l,e,n),f=_.attributes[Tq.AttributeNames.EXPRESS_TYPE],m=(0,mq.getRPCMetadata)(Nn.context.active());if(m?.type===mq.RPCType.HTTP&&(m.route=p),(0,uo.isLayerIgnored)(_.name,f,r.getConfig()))return f===hq.ExpressLayerType.MIDDLEWARE&&i[eT._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Nn.trace.getSpan(Nn.context.active())===void 0)return o.apply(this,arguments);let h=r._getSpanName({request:i,layerType:f,route:l},_.name),T=r.tracer.startSpan(h,{attributes:Object.assign(d,_.attributes)}),S=Nn.context.active(),R=Nn.trace.setSpan(S,T),{requestHook:I}=r.getConfig();I&&(0,fu.safeExecuteInTheMiddle)(()=>I(T,{request:i,layerType:f,route:l}),ve=>{ve&&Nn.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[Tq.AttributeNames.EXPRESS_TYPE]===hq.ExpressLayerType.ROUTER&&(T.end(),x=!0,R=S);let F=()=>{x===!1&&(x=!0,T.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],on=![void 0,null,"route","router"].includes(ve);if(!x&&on){let[Ya,Wa]=(0,uo.asErrorAndMessage)(ve);T.recordException(Ya),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Wa})}x===!1&&(x=!0,i.res?.removeListener("finish",F),T.end()),!(i.route&&on)&&c&&i[eT._LAYERS_STORE_PROPERTY].pop();let Io=B[se],ss=Nn.context.active(),Ii=Nn.trace.getSpan(S),Et=Ii?Nn.trace.setSpan(ss,Ii):ss;return Nn.context.bind(Et,Io).apply(this,arguments)});try{return Nn.context.bind(R,o).apply(this,arguments)}catch(ve){let[on,Io]=(0,uo.asErrorAndMessage)(ve);throw T.recordException(on),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Io}),ve}finally{x||a.once("finish",F)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return Nn.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};tT.ExpressInstrumentation=GO});var gq=E(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.AttributeNames=Hs.ExpressLayerType=Hs.ExpressInstrumentation=void 0;var lhe=Sq();Object.defineProperty(Hs,"ExpressInstrumentation",{enumerable:!0,get:function(){return lhe.ExpressInstrumentation}});var phe=Jh();Object.defineProperty(Hs,"ExpressLayerType",{enumerable:!0,get:function(){return phe.ExpressLayerType}});var dhe=Zh();Object.defineProperty(Hs,"AttributeNames",{enumerable:!0,get:function(){return dhe.AttributeNames}})});var Oq=E(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.SeverityNumber=void 0;var hhe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(hhe=Kp.SeverityNumber||(Kp.SeverityNumber={}))});var oT=E(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.NOOP_LOGGER=mu.NoopLogger=void 0;var rT=class{emit(e){}};mu.NoopLogger=rT;mu.NOOP_LOGGER=new rT});var Nq=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.API_BACKWARDS_COMPATIBILITY_VERSION=lo.makeGetter=lo._global=lo.GLOBAL_LOGS_API_KEY=void 0;lo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");lo._global=globalThis;function The(t,e,n){return r=>r===t?e:n}lo.makeGetter=The;lo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var BO=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.NOOP_LOGGER_PROVIDER=hu.NoopLoggerProvider=void 0;var Ehe=oT(),sT=class{getLogger(e,n,r){return new Ehe.NoopLogger}};hu.NoopLoggerProvider=sT;hu.NOOP_LOGGER_PROVIDER=new sT});var bq=E(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});iT.ProxyLogger=void 0;var She=oT(),jO=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):She.NOOP_LOGGER}};iT.ProxyLogger=jO});var Cq=E(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.ProxyLoggerProvider=void 0;var ghe=BO(),Ahe=bq(),HO=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Ahe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ghe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};aT.ProxyLoggerProvider=HO});var Mq=E(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.LogsAPI=void 0;var ar=Nq(),Rhe=BO(),Pq=Cq(),FO=class t{constructor(){this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ar._global[ar.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ar._global[ar.GLOBAL_LOGS_API_KEY]=(0,ar.makeGetter)(ar.API_BACKWARDS_COMPATIBILITY_VERSION,e,Rhe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=ar._global[ar.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ar._global,ar.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete ar._global[ar.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}};cT.LogsAPI=FO});var VO=E(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.logs=po.NoopLogger=po.NOOP_LOGGER=po.SeverityNumber=void 0;var yhe=Oq();Object.defineProperty(po,"SeverityNumber",{enumerable:!0,get:function(){return yhe.SeverityNumber}});var xq=oT();Object.defineProperty(po,"NOOP_LOGGER",{enumerable:!0,get:function(){return xq.NOOP_LOGGER}});Object.defineProperty(po,"NoopLogger",{enumerable:!0,get:function(){return xq.NoopLogger}});var Ihe=Mq();po.logs=Ihe.LogsAPI.getInstance()});var vq=E(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.disableInstrumentations=Tu.enableInstrumentations=void 0;function Ohe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}Tu.enableInstrumentations=Ohe;function Nhe(t){t.forEach(e=>e.disable())}Tu.disableInstrumentations=Nhe});var Uq=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.registerInstrumentations=void 0;var Lq=(b(),O(v)),bhe=VO(),Dq=vq();function Che(t){let e=t.tracerProvider||Lq.trace.getTracerProvider(),n=t.meterProvider||Lq.metrics.getMeterProvider(),r=t.loggerProvider||bhe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Dq.enableInstrumentations)(o,e,n,r),()=>{(0,Dq.disableInstrumentations)(o)}}uT.registerInstrumentations=Che});var qq=E(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});lT.satisfies=void 0;var WO=(b(),O(v)),jq=/^(?: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-]+)*))?$/,Phe=/^(?<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-]+)*))?$/,Mhe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function xhe(t,e,n){if(!vhe(t))return WO.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=whe(t);if(!r)return!1;let o=[],s=Hq(r,e,o,n);return s&&!n?.includePrerelease?Dhe(r,o):s}lT.satisfies=xhe;function vhe(t){return typeof t=="string"&&jq.test(t)}function Hq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(qO(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=rTe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!qO(t,s,n,r))return!1;return!0}return qO(t,e,n,r)}function qO(t,e,n,r){if(e=Uhe(e,r),e.includes(" "))return Hq(t,e,n,r);{let o=khe(e);return n.push(o),Lhe(t,o)}}function Lhe(t,e){if(e.invalid)return!1;if(!e.version||YO(e.version))return!0;let n=kq(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=kq(r,o)}return Mhe[e.op]?.includes(n)}function Dhe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Uhe(t,e){return t=t.trim(),t=tTe(t,e),t=eTe(t),t=nTe(t,e),t=t.trim(),t}function _n(t){return!t||t.toLowerCase()==="x"||t==="*"}function whe(t){let e=t.match(jq);if(!e){WO.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function khe(t){if(!t)return{};let e=t.match(Phe);if(!e)return WO.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function YO(t){return t==="*"||t==="x"||t==="X"}function wq(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Ghe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Bhe(t,e){if(YO(t)||YO(e))return 0;let[n,r]=Ghe(wq(t),wq(e));return n>r?1:n<r?-1:0}function kq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Bhe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Fq="[a-zA-Z0-9-]",Vq="0|[1-9]\\d*",jhe=`\\d*[a-zA-Z-]${Fq}*`,Hhe="((?:<|>)?=?)",Gq=`(?:${Vq}|${jhe})`,Fhe=`(?:-(${Gq}(?:\\.${Gq})*))`,Bq=`${Fq}+`,Vhe=`(?:\\+(${Bq}(?:\\.${Bq})*))`,$O=`${Vq}|x|X|\\*`,Qp=`[v=\\s]*(${$O})(?:\\.(${$O})(?:\\.(${$O})(?:${Fhe})?${Vhe}?)?)?`,qhe=`^${Hhe}\\s*${Qp}$`,$he=new RegExp(qhe),Yhe=`^\\s*(${Qp})\\s+-\\s+(${Qp})\\s*$`,Whe=new RegExp(Yhe),zhe="(?:~>?)",Khe=`^${zhe}${Qp}$`,Qhe=new RegExp(Khe),Xhe="(?:\\^)",Jhe=`^${Xhe}${Qp}$`,Zhe=new RegExp(Jhe);function eTe(t){let e=Qhe;return t.replace(e,(n,r,o,s,i)=>{let a;return _n(r)?a="":_n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:_n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function tTe(t,e){let n=Zhe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return _n(s)?l="":_n(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:_n(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function nTe(t,e){let n=$he;return t.replace(n,(r,o,s,i,a,c)=>{let l=_n(s),p=l||_n(i),d=p||_n(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function rTe(t,e){let n=Whe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(_n(s)?o="":_n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:_n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,_n(d)?p="":_n(_)?p=`<${+d+1}.0.0-0`:_n(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var zO=E(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.massUnwrap=Bt.unwrap=Bt.massWrap=Bt.wrap=void 0;var fn=console.error.bind(console);function Xp(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var oTe=(t,e,n)=>{if(!t||!t[e]){fn("no original function "+String(e)+" to wrap");return}if(!n){fn("no wrapper function"),fn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){fn("original object and wrapper must be functions");return}let o=n(r,e);return Xp(o,"__original",r),Xp(o,"__unwrap",()=>{t[e]===o&&Xp(t,e,r)}),Xp(o,"__wrapped",!0),Xp(t,e,o),o};Bt.wrap=oTe;var sTe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Bt.wrap)(r,o,n)})})};Bt.massWrap=sTe;var iTe=(t,e)=>{if(!t||!t[e]){fn("no function to unwrap."),fn(new Error().stack);return}let n=t[e];if(!n.__unwrap)fn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Bt.unwrap=iTe;var aTe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Bt.unwrap)(n,r)})})};Bt.massUnwrap=aTe;function Jp(t){t&&t.logger&&(typeof t.logger!="function"?fn("new logger isn't a function, not replacing"):fn=t.logger)}Bt.default=Jp;Jp.wrap=Bt.wrap;Jp.massWrap=Bt.massWrap;Jp.unwrap=Bt.unwrap;Jp.massUnwrap=Bt.massUnwrap});var $q=E(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});dT.InstrumentationAbstract=void 0;var KO=(b(),O(v)),cTe=VO(),pT=zO(),QO=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=KO.diag.createComponentLogger({namespace:e}),this._tracer=KO.trace.getTracer(e,n),this._meter=KO.metrics.getMeter(e,n),this._logger=cTe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=pT.wrap;_unwrap=pT.unwrap;_massWrap=pT.massWrap;_massUnwrap=pT.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};dT.InstrumentationAbstract=QO});var Yq=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ModuleNameTrie=Fs.ModuleNameSeparator=void 0;Fs.ModuleNameSeparator="/";var _T=class{hooks=[];children=new Map},XO=class{_trie=new _T;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Fs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new _T,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(Fs.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};Fs.ModuleNameTrie=XO});var zq=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.RequireInTheMiddleSingleton=void 0;var uTe=ki(),Wq=U("path"),JO=Yq(),lTe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),ZO=class t{_moduleNameTrie=new JO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new uTe.Hook(null,{internals:!0},(e,n,r)=>{let o=pTe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return lTe?new t:this._instance=this._instance??new t}};fT.RequireInTheMiddleSingleton=ZO;function pTe(t){return Wq.sep!==JO.ModuleNameSeparator?t.split(Wq.sep).join(JO.ModuleNameSeparator):t}});var Zq=E(Zp=>{var Kq=[],eN=new WeakMap,Qq=new WeakMap,Xq=new Map,Jq=[],dTe={set(t,e,n){let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Qq.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function _Te(t,e,n,r,o){Xq.set(t,o),eN.set(e,n),Qq.set(e,r);let s=new Proxy(e,dTe);Kq.forEach(i=>i(t,s,o)),Jq.push([t,s,o])}Zp.register=_Te;Zp.importHooks=Kq;Zp.specifiers=Xq;Zp.toHook=Jq});var oN=E((AKe,Su)=>{var e$=U("path"),fTe=hf(),{fileURLToPath:mTe}=U("url"),{MessageChannel:hTe}=U("worker_threads"),{isBuiltin:tN}=U("module");tN||(tN=()=>!0);var{importHooks:nN,specifiers:TTe,toHook:ETe}=Zq();function t$(t){nN.push(t),ETe.forEach(([e,n,r])=>t(e,n,r))}function n$(t){let e=nN.indexOf(t);e>-1&&nN.splice(e,1)}function Eu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var rN;function STe(){let{port1:t,port2:e}=new hTe,n=0,r;rN=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function ed(t,e,n){if(!(this instanceof ed))return new ed(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;rN&&Array.isArray(t)&&rN(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);tN(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=mTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=fTe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)Eu(n,s,l,void 0);else if(d===o){if(!p)Eu(n,s,o,p);else if(p.endsWith(TTe.get(a)))Eu(n,s,o,p);else if(r){let _=o+e$.sep+e$.relative(p,l);Eu(n,s,_,p)}}else d===i&&Eu(n,s,i,p);else Eu(n,s,o,p)},t$(this._iitmHook)}ed.prototype.unhook=function(){n$(this._iitmHook)};Su.exports=ed;Su.exports.Hook=ed;Su.exports.addHook=t$;Su.exports.removeHook=n$;Su.exports.createAddHookMessageChannel=STe});var sN=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isWrapped=Vs.safeExecuteInTheMiddleAsync=Vs.safeExecuteInTheMiddle=void 0;function gTe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddle=gTe;async function ATe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddleAsync=ATe;function RTe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Vs.isWrapped=RTe});var s$=E(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.InstrumentationBase=void 0;var td=U("path"),r$=U("util"),yTe=qq(),iN=zO(),ITe=$q(),OTe=zq(),NTe=oN(),nd=(b(),O(v)),bTe=ki(),CTe=U("fs"),PTe=sN(),aN=class extends ITe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=OTe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,PTe.isWrapped)(e[n])&&this._unwrap(e,n),r$.types.isProxy(e)){let o=(0,iN.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,iN.wrap)(e,n,r)};_unwrap=(e,n)=>r$.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,iN.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,CTe.readFileSync)(td.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{nd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return o$(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=td.normalize(r);return i.filter(l=>l.name===a&&o$(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&td.isAbsolute(a)){let l=td.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=td.isAbsolute(e.name)?new bTe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new NTe.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};mT.InstrumentationBase=aN;function o$(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,yTe.satisfies)(e,r,{includePrerelease:n}))}});var i$=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.normalize=void 0;var MTe=U("path");Object.defineProperty(hT,"normalize",{enumerable:!0,get:function(){return MTe.normalize}})});var a$=E(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.normalize=gu.InstrumentationBase=void 0;var xTe=s$();Object.defineProperty(gu,"InstrumentationBase",{enumerable:!0,get:function(){return xTe.InstrumentationBase}});var vTe=i$();Object.defineProperty(gu,"normalize",{enumerable:!0,get:function(){return vTe.normalize}})});var cN=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.normalize=Au.InstrumentationBase=void 0;var c$=a$();Object.defineProperty(Au,"InstrumentationBase",{enumerable:!0,get:function(){return c$.InstrumentationBase}});Object.defineProperty(Au,"normalize",{enumerable:!0,get:function(){return c$.normalize}})});var u$=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.InstrumentationNodeModuleDefinition=void 0;var uN=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};TT.InstrumentationNodeModuleDefinition=uN});var l$=E(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});ET.InstrumentationNodeModuleFile=void 0;var LTe=cN(),lN=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,LTe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};ET.InstrumentationNodeModuleFile=lN});var p$=E(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.semconvStabilityFromStr=pa.SemconvStability=void 0;var ST;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(ST=pa.SemconvStability||(pa.SemconvStability={}));function DTe(t,e){let n=ST.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=ST.DUPLICATE;break}else o.toLowerCase()===t&&(n=ST.STABLE);return n}pa.semconvStabilityFromStr=DTe});var _$=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var UTe=Uq();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return UTe.registerInstrumentations}});var wTe=cN();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return wTe.InstrumentationBase}});var kTe=u$();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return kTe.InstrumentationNodeModuleDefinition}});var GTe=l$();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return GTe.InstrumentationNodeModuleFile}});var pN=sN();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return pN.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddleAsync}});var d$=p$();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return d$.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return d$.semconvStabilityFromStr}})});var f$=E((vKe,BTe)=>{BTe.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"}}});var h$=E(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.range=da.balanced=void 0;var jTe=(t,e,n)=>{let r=t instanceof RegExp?m$(t,n):t,o=e instanceof RegExp?m$(e,n):e,s=r!==null&&o!=null&&(0,da.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};da.balanced=jTe;var m$=(t,e)=>{let n=e.match(t);return n?n[0]:null},HTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};da.range=HTe});var y$=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.EXPANSION_MAX=void 0;Ru.expand=eEe;var T$=h$(),E$="\0SLASH"+Math.random()+"\0",S$="\0OPEN"+Math.random()+"\0",_N="\0CLOSE"+Math.random()+"\0",g$="\0COMMA"+Math.random()+"\0",A$="\0PERIOD"+Math.random()+"\0",FTe=new RegExp(E$,"g"),VTe=new RegExp(S$,"g"),qTe=new RegExp(_N,"g"),$Te=new RegExp(g$,"g"),YTe=new RegExp(A$,"g"),WTe=/\\\\/g,zTe=/\\{/g,KTe=/\\}/g,QTe=/\\,/g,XTe=/\\\./g;Ru.EXPANSION_MAX=1e5;function dN(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function JTe(t){return t.replace(WTe,E$).replace(zTe,S$).replace(KTe,_N).replace(QTe,g$).replace(XTe,A$)}function ZTe(t){return t.replace(FTe,"\\").replace(VTe,"{").replace(qTe,"}").replace($Te,",").replace(YTe,".")}function R$(t){if(!t)return[""];let e=[],n=(0,T$.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=R$(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function eEe(t,e={}){if(!t)return[];let{max:n=Ru.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),rd(JTe(t),n,!0).map(ZTe)}function tEe(t){return"{"+t+"}"}function nEe(t){return/^-?0\d/.test(t)}function rEe(t,e){return t<=e}function oEe(t,e){return t>=e}function rd(t,e,n){let r=[],o=(0,T$.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?rd(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+_N+o.post,rd(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=R$(o.body),d.length===1&&d[0]!==void 0&&(d=rd(d[0],e,!1).map(tEe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=dN(d[0]),m=dN(d[1]),h=Math.max(d[0].length,d[1].length),T=d.length===3&&d[2]!==void 0?Math.abs(dN(d[2])):1,S=rEe;m<f&&(T*=-1,S=oEe);let I=d.some(nEe);_=[];for(let x=f;S(x,m);x+=T){let F;if(c)F=String.fromCharCode(x),F==="\\"&&(F="");else if(F=String(x),I){let B=h-F.length;if(B>0){let se=new Array(B+1).join("0");x<0?F="-"+se+F.slice(1):F=se+F}}_.push(F)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,rd(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let h=s+_[f]+i[m];(!n||l||h)&&r.push(h)}}return r}});var I$=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.assertValidPattern=void 0;var sEe=1024*64,iEe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>sEe)throw new TypeError("pattern is too long")};gT.assertValidPattern=iEe});var N$=E(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.parseClass=void 0;var aEe={"[: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]},od=t=>t.replace(/[[\]\\-]/g,"\\$&"),cEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),O$=t=>t.join(""),uEe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+1){l=!0,s++;continue}if(h==="]"&&i&&!c){p=s+1;break}if(i=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[S,R,I]]of Object.entries(aEe))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-n,!0];s+=T.length,I?o.push(S):r.push(S),a=a||R;continue e}}if(c=!1,d){h>d?r.push(od(d)+"-"+od(h)):h===d&&r.push(od(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(od(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(od(h)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[cEe(h),!1,p-n,!1]}let _="["+(l?"^":"")+O$(r)+"]",f="["+(l?"":"^")+O$(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};AT.parseClass=uEe});var yT=E(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.unescape=void 0;var lEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");RT.unescape=lEe});var hN=E(bT=>{"use strict";var bn;Object.defineProperty(bT,"__esModule",{value:!0});bT.AST=void 0;var pEe=N$(),IT=yT(),dEe=new Set(["!","?","+","*","@"]),fN=t=>dEe.has(t),b$=t=>fN(t.type),_Ee=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),fEe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),mEe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),C$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hEe="(?!(?:^|/)\\.\\.?(?:$|/))",OT="(?!\\.)",TEe=new Set(["[","."]),EEe=new Set(["..","."]),SEe=new Set("().*{}+?[]^$\\!"),gEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mN="[^/]",P$=mN+"*?",M$=mN+"+?",AEe=0,NT=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++AEe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#T(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof bn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof bn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new bn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let h=r,T="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,T+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(p=!0):S==="]"&&!(h===l+2&&p)&&(c=!1),T+=S;continue}else if(S==="["){c=!0,l=h,p=!1,T+=S;continue}if(!o.noext&&fN(S)&&e.charAt(h)==="("&&s<=i){n.push(T),T="";let I=new bn(S,n);h=bn.#p(e,I,h,o,s+1),n.push(I);continue}T+=S}return n.push(T),h}let d=r+1,_=new bn(null,n),f=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(p=!0):h==="]"&&!(d===l+2&&p)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,p=!1,m+=h;continue}if(!o.noext&&fN(h)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(h))){let S=n&&n.#d(h)?0:1;_.push(m),m="";let R=new bn(h,_);_.push(R),d=bn.#p(e,R,d,o,s+S);continue}if(h==="|"){_.push(m),m="",f.push(_),_=new bn(null,n);continue}if(h===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=h}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,fEe)}#f(e,n=_Ee){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=mEe){return!!n.get(this.type)?.includes(e)}#S(e,n){let r=e.#e[0],o=new bn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#g(e){return!!C$.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type)}#R(e){let n=C$.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new bn(null,void 0,n);return bn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#T()),!b$(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,h,T,S]=typeof f=="string"?bn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||S,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&EEe.has(this.#e[0]))){let m=TEe,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!n&&!e&&m.has(l.charAt(0));p=h?hEe:T?OT:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,IT.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,IT.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!OT?"":this.#h(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?OT:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?OT:"")+P$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,IT.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(b$(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#S(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#h(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(SEe.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?M$:P$,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,pEe.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=mN,n=!0;continue}s+=gEe(l)}return[s,(0,IT.unescape)(e),!!n,i]}};bT.AST=NT;bn=NT});var TN=E(CT=>{"use strict";Object.defineProperty(CT,"__esModule",{value:!0});CT.escape=void 0;var REe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");CT.escape=REe});var k$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var yEe=y$(),PT=I$(),L$=hN(),IEe=TN(),OEe=yT(),NEe=(t,e,n={})=>((0,PT.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new _a(e,n).match(t));k.minimatch=NEe;var bEe=/^\*+([^+@!?\*\[\(]*)$/,CEe=t=>e=>!e.startsWith(".")&&e.endsWith(t),PEe=t=>e=>e.endsWith(t),MEe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),xEe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),vEe=/^\*+\.\*+$/,LEe=t=>!t.startsWith(".")&&t.includes("."),DEe=t=>t!=="."&&t!==".."&&t.includes("."),UEe=/^\.\*+$/,wEe=t=>t!=="."&&t!==".."&&t.startsWith("."),kEe=/^\*+$/,GEe=t=>t.length!==0&&!t.startsWith("."),BEe=t=>t.length!==0&&t!=="."&&t!=="..",jEe=/^\?+([^+@!?\*\[\(]*)?$/,HEe=([t,e=""])=>{let n=D$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},FEe=([t,e=""])=>{let n=U$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},VEe=([t,e=""])=>{let n=U$([t]);return e?r=>n(r)&&r.endsWith(e):n},qEe=([t,e=""])=>{let n=D$([t]);return e?r=>n(r)&&r.endsWith(e):n},D$=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},U$=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},w$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x$={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=w$==="win32"?x$.win32.sep:x$.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var $Ee="[^/]",YEe=$Ee+"*?",WEe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zEe="(?:(?!(?:\\/|^)\\.).)*?",KEe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=KEe;k.minimatch.filter=k.filter;var cr=(t,e={})=>Object.assign({},t,e),QEe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,cr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,cr(t,s))}static defaults(o){return e.defaults(cr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,cr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,cr(t,s))}},unescape:(r,o={})=>e.unescape(r,cr(t,o)),escape:(r,o={})=>e.escape(r,cr(t,o)),filter:(r,o={})=>e.filter(r,cr(t,o)),defaults:r=>e.defaults(cr(t,r)),makeRe:(r,o={})=>e.makeRe(r,cr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,cr(t,o)),match:(r,o,s={})=>e.match(r,o,cr(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=QEe;k.minimatch.defaults=k.defaults;var XEe=(t,e={})=>((0,PT.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,yEe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=XEe;k.minimatch.braceExpand=k.braceExpand;var JEe=(t,e={})=>new _a(t,e).makeRe();k.makeRe=JEe;k.minimatch.makeRe=k.makeRe;var ZEe=(t,e,n={})=>{let r=new _a(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=ZEe;k.minimatch.match=k.match;var v$=/[?*]|[+@!]\(.*?\)|\[|\]/,eSe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_a=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,PT.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||w$,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!v$.test(s[2]))&&!v$.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,h=[0];for(let R of l)R===k.GLOBSTAR?(h.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let T=_.length-1,S=e.length-d;for(let R of _)R[1]=S-(h[T--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,PT.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(kEe))?o=n.dot?BEe:GEe:(r=e.match(bEe))?o=(n.nocase?n.dot?xEe:MEe:n.dot?PEe:CEe)(r[1]):(r=e.match(jEe))?o=(n.nocase?n.dot?FEe:HEe:n.dot?VEe:qEe)(r):(r=e.match(vEe))?o=n.dot?DEe:LEe:(r=e.match(UEe))&&(o=wEe);let s=L$.AST.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?YEe:n.dot?WEe:zEe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?eSe(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=_a;var tSe=hN();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return tSe.AST}});var nSe=TN();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return nSe.escape}});var rSe=yT();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return rSe.unescape}});k.minimatch.AST=L$.AST;k.minimatch.Minimatch=_a;k.minimatch.escape=IEe.escape;k.minimatch.unescape=OEe.unescape});var q$=E((VKe,gN)=>{"use strict";var G$=U("node:diagnostics_channel"),{context:MT,trace:EN,SpanStatusCode:xT,propagation:SN,diag:oSe}=(b(),O(v)),{getRPCMetadata:sSe,RPCType:iSe}=Te(),{ATTR_HTTP_ROUTE:vT,ATTR_HTTP_RESPONSE_STATUS_CODE:B$,ATTR_HTTP_REQUEST_METHOD:aSe,ATTR_URL_PATH:cSe}=(le(),O(Ae)),{InstrumentationBase:uSe}=_$(),{version:lSe,name:j$}=f$(),pSe=">=4.0.0 <6",H$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},qs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},qo="anonymous",$s=Symbol("fastify otel instance"),Ys=Symbol("fastify otel request spans"),sd=Symbol("fastify otel request context"),F$=Symbol("fastify otel addhook original"),V$=Symbol("fastify otel setnotfound original"),id=Symbol("fastify otel ignore path"),ad=Symbol("fastify otel record exceptions"),LT=class extends uSe{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(j$,lSe,e),this.logger=oSe.createComponentLogger({namespace:j$}),this[id]=null,this[ad]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[ad]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=null;this[id]=o=>typeof n=="function"?n(o):(r==null&&(r=k$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},G$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(G$.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:pSe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate($s,e),r.decorate(F$,r.addHook),r.decorate(V$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[sd],m=this[Ys];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(h,T)=>SN.inject(f,h,T),extract:(h,T)=>SN.extract(f,h,T)}}),r.decorateRequest(Ys,null),r.decorateRequest(sd,null),r.addHook("onRoute",function(f){if(e[id]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of H$)if(f[m]!=null){let h=f[m];if(typeof h=="function")f[m]=d(h,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:qo});else if(Array.isArray(h)){let T=[];for(let S of h)T.push(d(S,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:qo}));f[m]=T}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:qs.HANDLER,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:qo})}),r.addHook("onRequest",function(f,m,h){if(this[$s].isEnabled()===!1||f.routeOptions.config?.otel===!1)return h();if(this[$s][id]?.({url:f.url,method:f.method})===!0)return this[$s].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),h();let T=MT.active();EN.getSpan(T)==null&&(T=SN.extract(T,f.headers));let S=sSe(T);f.routeOptions.url!=null&&S?.type===iSe.HTTP&&(S.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[aSe]:f.method,[cSe]:f.url};f.routeOptions.url!=null&&(R[vT]=f.routeOptions.url);let I=this[$s].tracer.startSpan("request",{attributes:R},T);try{this[$s]._requestHook?.(I,f)}catch(x){this[$s].logger.error({err:x},"requestHook threw")}f[sd]=EN.setSpan(T,I),f[Ys]=I,MT.with(f[sd],()=>{h()})}),r.addHook("onResponse",function(f,m,h){let T=f[Ys];T!=null&&(T.setAttributes({[B$]:m.statusCode}),T.end()),f[Ys]=null,h()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,h){let T=_[Ys];T!=null&&(f.statusCode>=500&&T.setStatus({code:xT.ERROR}),T.setAttributes({[B$]:f.statusCode}),T.end()),_[Ys]=null,h(null,m)}function a(_,f,m,h){let T=_[Ys];T!=null&&(T.setStatus({code:xT.ERROR,message:m.message}),e[ad]!==!1&&T.recordException(m)),h()}function c(_,f){let m=this[F$];return H$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo})):m.call(this,_,f)}function l(_,f){let m=this[V$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:qo}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:qo})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:qo})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...T){let S=this[$s],R=p(T);if(R===null)return S.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...T);if(S.isEnabled()===!1||R.routeOptions.config?.otel===!1)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...T);if(S[id]?.({url:R.url,method:R.method})===!0)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...T);let I=R[sd]??MT.active(),x=_.name?.length>0?_.name:this.pluginName??qo,F=S.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(S._lifecycleHook!=null)try{S._lifecycleHook(F,{hookName:f,request:R,handler:x})}catch(B){S.logger.error({err:B},"Execution of lifecycleHook failed")}return MT.with(EN.setSpan(I,F),function(){try{let B=_.call(this,...T);return typeof B?.then=="function"?B.then(se=>(F.end(),se),se=>(F.setStatus({code:xT.ERROR,message:se.message}),S[ad]!==!1&&F.recordException(se),F.end(),Promise.reject(se))):(F.end(),B)}catch(B){throw F.setStatus({code:xT.ERROR,message:B.message}),S[ad]!==!1&&F.recordException(B),F.end(),B}},this)}}}}};gN.exports=LT;gN.exports.FastifyOtelInstrumentation=LT});var yN=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SpanNames=Dr.TokenKind=Dr.AllowedOperationTypes=void 0;var gSe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(gSe=Dr.AllowedOperationTypes||(Dr.AllowedOperationTypes={}));var ASe;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(ASe=Dr.TokenKind||(Dr.TokenKind={}));var RSe;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(RSe=Dr.SpanNames||(Dr.SpanNames={}))});var IN=E(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.AttributeNames=void 0;var ySe;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(ySe=pd.AttributeNames||(pd.AttributeNames={}))});var GT=E(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.OTEL_GRAPHQL_DATA_SYMBOL=yu.OTEL_PATCHED_SYMBOL=void 0;yu.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");yu.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var nY=E(BT=>{"use strict";Object.defineProperty(BT,"__esModule",{value:!0});BT.OPERATION_NOT_SUPPORTED=void 0;var u2e=GT();BT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var hY=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.wrapFieldResolver=ht.wrapFields=ht.getSourceFromLocation=ht.getOperation=ht.endSpan=ht.addSpanSource=ht.addInputVariableAttributes=ht.isPromise=void 0;var Iu=(b(),O(v)),Ws=yN(),ma=IN(),Yo=GT(),rY=Object.values(Ws.AllowedOperationTypes),ISe=t=>typeof t?.then=="function";ht.isPromise=ISe;var OSe=t=>typeof t=="object"&&t!==null;function ON(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{ON(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{ON(t,`${e}.${r}`,o)}):t.setAttribute(`${ma.AttributeNames.VARIABLES}${String(e)}`,n)}function NSe(t,e){Object.entries(e).forEach(([n,r])=>{ON(t,n,r)})}ht.addInputVariableAttributes=NSe;function aY(t,e,n,r,o){let s=dY(e,n,r,o);t.setAttribute(ma.AttributeNames.SOURCE,s)}ht.addSpanSource=aY;function bSe(t,e,n,r,o){let s=cY(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?lY(n):uY(n,o);return s={span:CSe(t,e,n,r,o,a)},xSe(n,o,s),{field:s,spanAdded:!0}}function CSe(t,e,n,r,o,s){let i={[ma.AttributeNames.FIELD_NAME]:r.fieldName,[ma.AttributeNames.FIELD_PATH]:o.join("."),[ma.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[ma.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Ws.SpanNames.RESOLVE} ${i[ma.AttributeNames.FIELD_PATH]}`,{attributes:i},s?Iu.trace.setSpan(Iu.context.active(),s):void 0),c=n[Yo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&aY(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function PSe(t,e){e&&t.recordException(e),t.end()}ht.endSpan=PSe;function MSe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>rY.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>rY.indexOf(n?.operation)!==-1)}ht.getOperation=MSe;function xSe(t,e,n){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function cY(t,e){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function uY(t,e){for(let n=e.length-1;n>0;n--){let r=cY(t,e.slice(0,n));if(r)return r.span}return lY(t)}function lY(t){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].span}function vSe(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function LSe(t){return pY(`
|
|
11
|
-
`,t)}function oY(t){return pY(" ",t)}function pY(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var DSe=[Ws.TokenKind.FLOAT,Ws.TokenKind.STRING,Ws.TokenKind.INT,Ws.TokenKind.BLOCK_STRING];function dY(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let l=a.value||a.kind,p="";!e&&DSe.indexOf(a.kind)>=0&&(l="*"),a.kind===Ws.TokenKind.STRING&&(l=`"${l}"`),a.kind===Ws.TokenKind.EOF&&(l=""),a.line>c?(o+=LSe(a.line-c),c=a.line,p=oY(a.column-1)):a.line===a.prev?.line&&(p=oY(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}ht.getSourceFromLocation=dY;function _Y(t,e,n){if(!t||t[Yo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Yo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=mY(e,n,s.resolve)),s.type)){let i=fY(s.type);for(let a of i)_Y(a,e,n)}})}ht.wrapFields=_Y;function fY(t){return"ofType"in t?fY(t.ofType):USe(t)?t.getTypes():wSe(t)?[t]:[]}function USe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function wSe(t){return"getFields"in t&&typeof t.getFields=="function"}var sY=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Iu.SpanStatusCode.ERROR,message:e.message}),t.end())},iY=(t,e)=>{e&&t.end()};function mY(t,e,n,r=!1){if(o[Yo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(OSe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Yo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=vSe(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=uY(a,p);else{let{field:m,spanAdded:h}=bSe(t,e,a,c,p);_=m.span,f=h}return Iu.context.with(Iu.trace.setSpan(Iu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,ht.isPromise)(m)?m.then(h=>(iY(_,f),h),h=>{throw sY(_,h,f),h}):(iY(_,f),m)}catch(m){throw sY(_,m,f),m}})}return o[Yo.OTEL_PATCHED_SYMBOL]=!0,o}ht.wrapFieldResolver=mY});var TY=E(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.PACKAGE_NAME=Ou.PACKAGE_VERSION=void 0;Ou.PACKAGE_VERSION="0.62.0";Ou.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var gY=E(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});FT.GraphQLInstrumentation=void 0;var Wo=(b(),O(v)),ur=ne(),dd=yN(),jT=IN(),NN=GT(),kSe=nY(),Qt=hY(),EY=TY(),SY={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},HT=[">=14.0.0 <17"],bN=class extends ur.InstrumentationBase{constructor(e={}){super(EY.PACKAGE_NAME,EY.PACKAGE_VERSION,{...SY,...e})}setConfig(e={}){super.setConfig({...SY,...e})}init(){let e=new ur.InstrumentationNodeModuleDefinition("graphql",HT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ur.InstrumentationNodeModuleFile("graphql/execution/execute.js",HT,e=>((0,ur.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new ur.InstrumentationNodeModuleFile("graphql/language/parser.js",HT,e=>((0,ur.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ur.InstrumentationNodeModuleFile("graphql/validation/validate.js",HT,e=>((0,ur.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Qt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[NN.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[NN.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Qt.endSpan)(e,n);return}if((0,Qt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Qt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ur.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Qt.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(dd.SpanNames.PARSE);return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),i),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Qt.getOperation)(c)?c.loc&&(0,Qt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(dd.SpanNames.SCHEMA_PARSE)),(0,Qt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(dd.SpanNames.VALIDATE,{});return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(dd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:jT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Qt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(dd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(jT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(jT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=kSe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(jT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Qt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Qt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[NN.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let p=a==null,d=a??l;return a=(0,Qt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Qt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Qt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};FT.GraphQLInstrumentation=bN});var AY=E(VT=>{"use strict";Object.defineProperty(VT,"__esModule",{value:!0});VT.GraphQLInstrumentation=void 0;var GSe=gY();Object.defineProperty(VT,"GraphQLInstrumentation",{enumerable:!0,get:function(){return GSe.GraphQLInstrumentation}})});var bY=E(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0});qT.EVENT_LISTENERS_SET=void 0;qT.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var CY=E($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});$T.bufferTextMapGetter=void 0;$T.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var PY=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var MY=E(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.PACKAGE_NAME=Nu.PACKAGE_VERSION=void 0;Nu.PACKAGE_VERSION="0.23.0";Nu.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var wY=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.KafkaJsInstrumentation=void 0;var ye=(b(),O(v)),lr=ne(),bu=(le(),O(Ae)),xY=bY(),vY=CY(),G=PY(),LY=MY();function YT(t,e,n){return r=>{t.add(e,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}function DY(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}var UY=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],CN=class extends lr.InstrumentationBase{constructor(e={}){super(LY.PACKAGE_NAME,LY.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:UY}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:UY}})}init(){let e=r=>{(0,lr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,lr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new lr.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[xY.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[xY.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[bu.ATTR_SERVER_ADDRESS]:n,[bu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,lr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,lr.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,lr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,lr.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,vY.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[DY(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),YT(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[YT(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,vY.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(DY(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push(YT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>YT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=bu.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(bu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,lr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,lr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};WT.KafkaJsInstrumentation=CN});var kY=E(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.KafkaJsInstrumentation=void 0;var HSe=wY();Object.defineProperty(zT,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return HSe.KafkaJsInstrumentation}})});var FY=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.58.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var YY=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.LruMemoizerInstrumentation=void 0;var VY=(b(),O(v)),qY=ne(),$Y=FY(),PN=class extends qY.InstrumentationBase{constructor(e={}){super($Y.PACKAGE_NAME,$Y.PACKAGE_VERSION,e)}init(){return[new qY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?VY.context.bind(VY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};KT.LruMemoizerInstrumentation=PN});var WY=E(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});QT.LruMemoizerInstrumentation=void 0;var VSe=YY();Object.defineProperty(QT,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return VSe.LruMemoizerInstrumentation}})});var JY=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var ZY=E(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.MongodbCommandType=void 0;var $Se;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})($Se=_d.MongodbCommandType||(_d.MongodbCommandType={}))});var eW=E(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.PACKAGE_NAME=Pu.PACKAGE_VERSION=void 0;Pu.PACKAGE_VERSION="0.67.0";Pu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var rW=E(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});XT.MongoDBInstrumentation=void 0;var we=(b(),O(v)),fe=ne(),zo=(le(),O(Ae)),$n=JY(),ha=ZY(),tW=eW(),nW={requireParentSpan:!0},MN=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(tW.PACKAGE_NAME,tW.PACKAGE_VERSION,{...nW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nW,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter($n.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,"insert"),this._unwrap(e,"remove"),this._unwrap(e,"update"),this._unwrap(e,"command"),this._unwrap(e,"query"),this._unwrap(e,"getMore"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,fe.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,fe.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=we.context.bind(we.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),h=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=n._patchEnd(h,_);return typeof c=="function"?r.call(this,s,i,a,T):r.call(this,s,i,a,c,T)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ha.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),h=e._spanNameFromAttrs(m),T=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m}),S=e._patchEnd(T,d);return typeof a=="function"?n.call(this,o,s,i,S):n.call(this,o,s,i,a,S)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),h=e._spanNameFromAttrs(m);_=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),h=e._spanNameFromAttrs(m);d=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}static _getCommandType(e){return e.createIndexes!==void 0?ha.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ha.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ha.MongodbCommandType.IS_MASTER:e.count!==void 0?ha.MongodbCommandType.COUNT:e.aggregate!==void 0?ha.MongodbCommandType.AGGREGATE:ha.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_SYSTEM]=$n.DB_SYSTEM_VALUE_MONGODB,a[$n.ATTR_DB_NAME]=e,a[$n.ATTR_DB_MONGODB_COLLECTION]=n,a[$n.ATTR_DB_OPERATION]=i,a[$n.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_SYSTEM_NAME]=$n.DB_SYSTEM_NAME_VALUE_MONGODB,a[zo.ATTR_DB_NAMESPACE]=e,a[zo.ATTR_DB_OPERATION_NAME]=i,a[zo.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[zo.ATTR_DB_OPERATION_NAME],e[zo.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||$n.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[$n.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};XT.MongoDBInstrumentation=MN});var oW=E(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});fd.MongodbCommandType=void 0;var YSe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(YSe=fd.MongodbCommandType||(fd.MongodbCommandType={}))});var sW=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.MongodbCommandType=Mu.MongoDBInstrumentation=void 0;var WSe=rW();Object.defineProperty(Mu,"MongoDBInstrumentation",{enumerable:!0,get:function(){return WSe.MongoDBInstrumentation}});var zSe=oW();Object.defineProperty(Mu,"MongodbCommandType",{enumerable:!0,get:function(){return zSe.MongodbCommandType}})});var vN=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var dW=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.handleCallbackResponse=zs.handlePromiseResponse=zs.getAttributesFromCollection=void 0;var lW=(b(),O(v)),hd=ne(),md=vN(),JT=(le(),O(Ae));function ege(t,e,n){let r={};return e&hd.SemconvStability.OLD&&(r[md.ATTR_DB_MONGODB_COLLECTION]=t.name,r[md.ATTR_DB_NAME]=t.conn.name,r[md.ATTR_DB_USER]=t.conn.user),e&hd.SemconvStability.STABLE&&(r[JT.ATTR_DB_COLLECTION_NAME]=t.name,r[JT.ATTR_DB_NAMESPACE]=t.conn.name),n&hd.SemconvStability.OLD&&(r[md.ATTR_NET_PEER_NAME]=t.conn.host,r[md.ATTR_NET_PEER_PORT]=t.conn.port),n&hd.SemconvStability.STABLE&&(r[JT.ATTR_SERVER_ADDRESS]=t.conn.host,r[JT.ATTR_SERVER_PORT]=t.conn.port),r}zs.getAttributesFromCollection=ege;function pW(t,e={}){t.recordException(e),t.setStatus({code:lW.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
12
|
-
Mongoose Error Code: ${e.code}`:""}`})}function LN(t,e,n,r=void 0){n&&(0,hd.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&lW.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function tge(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(LN(e,o,n,r),o)).catch(o=>{throw pW(e,o),o}).finally(()=>e.end()):(LN(e,t,n,r),e.end(),t)}zs.handlePromiseResponse=tge;function nge(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,l)=>(c?pW(r,c):LN(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}zs.handleCallbackResponse=nge});var _W=E(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.PACKAGE_NAME=xu.PACKAGE_VERSION=void 0;xu.PACKAGE_VERSION="0.60.0";xu.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var EW=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MongooseInstrumentation=Cn._ALREADY_INSTRUMENTED=Cn._STORED_PARENT_SPAN=void 0;var Tt=(b(),O(v)),rge=Te(),DN=dW(),jt=ne(),fW=_W(),Ks=vN(),Ta=(le(),O(Ae)),ZT=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],oge=["remove","count","findOneAndRemove",...ZT],sge=["count","findOneAndRemove",...ZT],ige=[...ZT];function mW(t){return t?t.startsWith("6.")||t.startsWith("5.")?oge:t.startsWith("7.")?sge:ige:ZT}function hW(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function TW(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Cn._STORED_PARENT_SPAN=Symbol("stored-parent-span");Cn._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var UN=class extends jt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(fW.PACKAGE_NAME,fW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,jt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,jt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new jt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),TW(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),mW(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=mW(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._unwrap(r.Model.prototype,"remove"),TW(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[Cn._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&jt.SemconvStability.OLD&&(l[Ks.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&jt.SemconvStability.STABLE&&(l[Ta.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let T=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&jt.SemconvStability.OLD&&(_[Ks.ATTR_DB_STATEMENT]=T),r._dbSemconvStability&jt.SemconvStability.STABLE&&(_[Ta.ATTR_DB_QUERY_TEXT]=T)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),h=r._handleResponse(m,o,this,arguments,l,n);return h&&typeof h=="object"&&(h[Cn._ALREADY_INSTRUMENTED]=!0),h}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&jt.SemconvStability.OLD&&(p[Ks.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&jt.SemconvStability.STABLE&&(p[Ta.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Tt.trace.getSpan(Tt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Cn._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Cn._STORED_PARENT_SPAN]=Tt.trace.getSpan(Tt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,DN.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&jt.SemconvStability.OLD&&(i[Ks.ATTR_DB_OPERATION]=r,i[Ks.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&jt.SemconvStability.STABLE&&(i[Ta.ATTR_DB_OPERATION_NAME]=r,i[Ta.ATTR_DB_SYSTEM_NAME]=Ks.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&jt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Tt.SpanKind.CLIENT,attributes:i},s?Tt.trace.setSpan(Tt.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,DN.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,DN.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Tt.context.with((0,rge.suppressTracing)(Tt.context.active()),e):e()}};Cn.MongooseInstrumentation=UN});var SW=E(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.MongooseInstrumentation=void 0;var age=EW();Object.defineProperty(eE,"MongooseInstrumentation",{enumerable:!0,get:function(){return age.MongooseInstrumentation}})});var IW=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var OW=E(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.AttributeNames=void 0;var uge;(function(t){t.MYSQL_VALUES="db.mysql.values"})(uge=Td.AttributeNames||(Td.AttributeNames={}))});var NW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getPoolNameOld=Xt.arrayStringifyHelper=Xt.getSpanName=Xt.getDbValues=Xt.getDbQueryText=Xt.getJDBCString=Xt.getConfig=void 0;function lge(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Xt.getConfig=lge;function pge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Xt.getJDBCString=pge;function dge(t){return typeof t=="string"?t:t.sql}Xt.getDbQueryText=dge;function _ge(t,e){return wN(typeof t=="string"?e:e||t.values)}Xt.getDbValues=_ge;function fge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Xt.getSpanName=fge;function wN(t){return t?`[${t.toString()}]`:""}Xt.arrayStringifyHelper=wN;function mge(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}Xt.getPoolNameOld=mge});var bW=E(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.PACKAGE_NAME=vu.PACKAGE_VERSION=void 0;vu.PACKAGE_VERSION="0.60.0";vu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var PW=E(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.MySQLInstrumentation=void 0;var Pn=(b(),O(v)),pr=ne(),Lu=(le(),O(Ae)),Ko=IW(),hge=OW(),Ea=NW(),CW=bW(),kN=class extends pr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(CW.PACKAGE_NAME,CW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,pr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,pr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ko.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new pr.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,pr.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,pr.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,pr.isWrapped)(e.createPoolCluster)&&this._unwrap(e,"createPoolCluster"),this._wrap(e,"createPoolCluster",this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,"createConnection"),this._unwrap(e,"createPool"),this._unwrap(e,"createPoolCluster"))})]}_patchCreateConnection(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,l=(0,Ea.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),l=a[c].pool;r._setPoolCallbacks(l,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=Pn.context.active();return function(o,s){s&&((0,pr.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Pn.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:l,database:p,user:d}=(0,Ea.getConfig)(e.config),_=parseInt(l,10),f=(0,Ea.getDbQueryText)(o);r._dbSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_DB_SYSTEM]=Ko.DB_SYSTEM_VALUE_MYSQL,a[Ko.ATTR_DB_CONNECTION_STRING]=(0,Ea.getJDBCString)(c,l,p),a[Ko.ATTR_DB_NAME]=p,a[Ko.ATTR_DB_USER]=d,a[Ko.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_DB_SYSTEM_NAME]=Lu.DB_SYSTEM_NAME_VALUE_MYSQL,a[Lu.ATTR_DB_NAMESPACE]=p,a[Lu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Ko.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[Lu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,Ea.getSpanName)(o),{kind:Pn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let S;Array.isArray(s)?S=s:arguments[2]&&(S=[s]),m.setAttribute(hge.AttributeNames.MYSQL_VALUES,(0,Ea.getDbValues)(o,S))}let h=Array.from(arguments).findIndex(S=>typeof S=="function"),T=Pn.context.active();if(h===-1){let S=Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments));return Pn.context.bind(T,S),S.on("error",R=>m.setStatus({code:Pn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,h,r._patchCallbackQuery(m,T)),Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Pn.SpanStatusCode.ERROR,message:o.message}),e.end(),Pn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Ea.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};tE.MySQLInstrumentation=kN});var MW=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.MySQLInstrumentation=void 0;var Tge=PW();Object.defineProperty(nE,"MySQLInstrumentation",{enumerable:!0,get:function(){return Tge.MySQLInstrumentation}})});var GN=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DB_SYSTEM_VALUE_MYSQL=Ct.ATTR_NET_PEER_PORT=Ct.ATTR_NET_PEER_NAME=Ct.ATTR_DB_USER=Ct.ATTR_DB_SYSTEM=Ct.ATTR_DB_STATEMENT=Ct.ATTR_DB_NAME=Ct.ATTR_DB_CONNECTION_STRING=void 0;Ct.ATTR_DB_CONNECTION_STRING="db.connection_string";Ct.ATTR_DB_NAME="db.name";Ct.ATTR_DB_STATEMENT="db.statement";Ct.ATTR_DB_SYSTEM="db.system";Ct.ATTR_DB_USER="db.user";Ct.ATTR_NET_PEER_NAME="net.peer.name";Ct.ATTR_NET_PEER_PORT="net.peer.port";Ct.DB_SYSTEM_VALUE_MYSQL="mysql"});var jN=E(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.addSqlCommenterComment=void 0;var BN=(b(),O(v)),Sge=Te();function gge(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function Age(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Rge(t,e){if(typeof e!="string"||e.length===0||gge(e))return e;let n=new Sge.W3CTraceContextPropagator,r={};n.inject(BN.trace.setSpan(BN.ROOT_CONTEXT,t),r,BN.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=Age(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}rE.addSqlCommenterComment=Rge});var UW=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getConnectionPrototypeToInstrument=dr.once=dr.getSpanName=dr.getQueryText=dr.getConnectionAttributes=void 0;var Ed=GN(),oE=ne(),HN=(le(),O(Ae));function yge(t,e,n){let{host:r,port:o,database:s,user:i}=Ige(t),a={};e&oE.SemconvStability.OLD&&(a[Ed.ATTR_DB_CONNECTION_STRING]=Oge(r,o,s),a[Ed.ATTR_DB_NAME]=s,a[Ed.ATTR_DB_USER]=i),e&oE.SemconvStability.STABLE&&(a[HN.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&oE.SemconvStability.OLD&&(a[Ed.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[Ed.ATTR_NET_PEER_PORT]=c)),n&oE.SemconvStability.STABLE&&(a[HN.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[HN.ATTR_SERVER_PORT]=c)),a}dr.getConnectionAttributes=yge;function Ige(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function Oge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function Nge(t,e,n,r=!1,o=bge){let[s,i]=typeof t=="string"?[t,n]:[t.sql,Cge(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}dr.getQueryText=Nge;function bge(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function Cge(t){return"values"in t}function Pge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}dr.getSpanName=Pge;var Mge=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};dr.once=Mge;function xge(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}dr.getConnectionPrototypeToInstrument=xge});var wW=E(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.PACKAGE_NAME=Du.PACKAGE_VERSION=void 0;Du.PACKAGE_VERSION="0.60.0";Du.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var jW=E(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.MySQL2Instrumentation=void 0;var kW=(b(),O(v)),Ur=ne(),FN=GN(),GW=jN(),Uu=UW(),BW=wW(),VN=(le(),O(Ae)),qN=[">=1.4.2 <4"],$N=class extends Ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(BW.PACKAGE_NAME,BW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,Ur.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Ur.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new Ur.InstrumentationNodeModuleDefinition("mysql2",qN,s=>(n(s),s),()=>{},[new Ur.InstrumentationNodeModuleFile("mysql2/promise.js",qN,s=>(n(s),s),()=>{}),new Ur.InstrumentationNodeModuleFile("mysql2/lib/connection.js",qN,s=>{let i=(0,Uu.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Uu.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Uu.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Uu.getQueryText)(s,e,c,l,p);o._dbSemconvStability&Ur.SemconvStability.OLD&&(_[FN.ATTR_DB_SYSTEM]=FN.DB_SYSTEM_VALUE_MYSQL,_[FN.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&Ur.SemconvStability.STABLE&&(_[VN.ATTR_DB_SYSTEM_NAME]=VN.DB_SYSTEM_NAME_VALUE_MYSQL,_[VN.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Uu.getSpanName)(s),{kind:kW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,GW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,GW.addSqlCommenterComment)(m,s.sql)}));let h=(0,Uu.once)((T,S)=>{T?m.setStatus({code:kW.SpanStatusCode.ERROR,message:T.message}):typeof d=="function"&&(0,Ur.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:S})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(h));let T=r.apply(this,arguments);return T.once("error",S=>{h(S)}).once("result",S=>{h(void 0,S)}),T}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(h)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(h)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};sE.MySQL2Instrumentation=$N});var HW=E(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.MySQL2Instrumentation=void 0;var vge=jW();Object.defineProperty(iE,"MySQL2Instrumentation",{enumerable:!0,get:function(){return vge.MySQL2Instrumentation}})});var YW=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var WW=E(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.endSpan=void 0;var Dge=(b(),O(v)),Uge=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:Dge.SpanStatusCode.ERROR,message:e.message})),t.end()};aE.endSpan=Uge});var uE=E(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.defaultDbStatementSerializer=void 0;var wge=[{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}],kge=(t,e)=>{if(Array.isArray(e)&&e.length){let n=wge.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};cE.defaultDbStatementSerializer=kge});var zW=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.PACKAGE_NAME=wu.PACKAGE_VERSION=void 0;wu.PACKAGE_VERSION="0.62.0";wu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var JW=E(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.IORedisInstrumentation=void 0;var Qs=(b(),O(v)),Mn=ne(),Xs=(le(),O(Ae)),xn=YW(),KW=ne(),Sd=WW(),Gge=uE(),QW=zW(),XW={requireParentSpan:!0},YN=class extends Mn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(QW.PACKAGE_NAME,QW.PACKAGE_VERSION,{...XW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Mn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...XW,...e})}init(){return[new Mn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Mn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Mn.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||Gge.defaultDbStatementSerializer,a=Qs.trace.getSpan(Qs.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,c[xn.ATTR_DB_STATEMENT]=d,c[xn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,c[Xs.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_NET_PEER_NAME]=l,c[xn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_SERVER_ADDRESS]=l,c[Xs.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:Qs.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,KW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&Qs.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),h=o.resolve;o.resolve=function(S){(0,KW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,S),R=>{R&&Qs.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,Sd.endSpan)(_,null),h(S)};let T=o.reject;return o.reject=function(S){(0,Sd.endSpan)(_,S),T(S)},m}catch(m){throw(0,Sd.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=Qs.trace.getSpan(Qs.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,o[xn.ATTR_DB_STATEMENT]="connect",o[xn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,o[Xs.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_NET_PEER_NAME]=s,o[xn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_SERVER_ADDRESS]=s,o[Xs.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Qs.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,Sd.endSpan)(a,null),c}catch(c){throw(0,Sd.endSpan)(a,c),c}}}};lE.IORedisInstrumentation=YN});var ZW=E(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.IORedisInstrumentation=void 0;var Bge=JW();Object.defineProperty(pE,"IORedisInstrumentation",{enumerable:!0,get:function(){return Bge.IORedisInstrumentation}})});var dE=E(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.PACKAGE_NAME=ku.PACKAGE_VERSION=void 0;ku.PACKAGE_VERSION="0.62.0";ku.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var ez=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTracedCreateStreamTrace=Js.getTracedCreateClient=Js.endSpan=void 0;var gd=(b(),O(v)),jge=(t,e)=>{e&&t.setStatus({code:gd.SpanStatusCode.ERROR,message:e.message}),t.end()};Js.endSpan=jge;var Hge=t=>function(){let n=t.apply(this,arguments);return gd.context.bind(gd.context.active(),n)};Js.getTracedCreateClient=Hge;var Fge=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){gd.context.bind(gd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Js.getTracedCreateStreamTrace=Fge});var _E=E(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DB_SYSTEM_VALUE_REDIS=Zt.DB_SYSTEM_NAME_VALUE_REDIS=Zt.ATTR_NET_PEER_PORT=Zt.ATTR_NET_PEER_NAME=Zt.ATTR_DB_SYSTEM=Zt.ATTR_DB_STATEMENT=Zt.ATTR_DB_CONNECTION_STRING=void 0;Zt.ATTR_DB_CONNECTION_STRING="db.connection_string";Zt.ATTR_DB_STATEMENT="db.statement";Zt.ATTR_DB_SYSTEM="db.system";Zt.ATTR_NET_PEER_NAME="net.peer.name";Zt.ATTR_NET_PEER_PORT="net.peer.port";Zt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Zt.DB_SYSTEM_VALUE_REDIS="redis"});var nz=E(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.RedisInstrumentationV2_V3=void 0;var Yn=ne(),fE=ez(),tz=dE(),Ad=(b(),O(v)),Rd=(le(),O(Ae)),Sa=_E(),Vge=uE(),WN=class t extends Yn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(tz.PACKAGE_NAME,tz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Yn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Yn.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,Yn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Yn.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=Ad.trace.getSpan(Ad.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||Vge.defaultDbStatementSerializer,l={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(l,{[Sa.ATTR_DB_SYSTEM]:Sa.DB_SYSTEM_VALUE_REDIS,[Sa.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(l,{[Rd.ATTR_DB_SYSTEM_NAME]:Sa.DB_SYSTEM_NAME_VALUE_REDIS,[Rd.ATTR_DB_OPERATION_NAME]:s.command,[Rd.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:Ad.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(_,{[Sa.ATTR_NET_PEER_NAME]:this.connection_options.host,[Sa.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(_,{[Rd.ATTR_SERVER_ADDRESS]:this.connection_options.host,[Rd.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&Yn.SemconvStability.OLD&&p.setAttribute(Sa.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=Ad.context.active();arguments[0].callback=function(m,h){if(i?.responseHook){let T=i.responseHook;(0,Yn.safeExecuteInTheMiddle)(()=>{T(p,s.command,s.args,h)},S=>{S&&e._diag.error("Error executing responseHook",S)},!0)}return(0,fE.endSpan)(p,m),Ad.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,fE.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,fE.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,fE.getTracedCreateStreamTrace)(n)}}};mE.RedisInstrumentationV2_V3=WN});var oz=E(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.getClientAttributes=void 0;var zN=(le(),O(Ae)),Gu=_E(),rz=ne();function qge(t,e,n){let r={};return n&rz.SemconvStability.OLD&&Object.assign(r,{[Gu.ATTR_DB_SYSTEM]:Gu.DB_SYSTEM_VALUE_REDIS,[Gu.ATTR_NET_PEER_NAME]:e?.socket?.host,[Gu.ATTR_NET_PEER_PORT]:e?.socket?.port,[Gu.ATTR_DB_CONNECTION_STRING]:$ge(t,e?.url)}),n&rz.SemconvStability.STABLE&&Object.assign(r,{[zN.ATTR_DB_SYSTEM_NAME]:Gu.DB_SYSTEM_NAME_VALUE_REDIS,[zN.ATTR_SERVER_ADDRESS]:e?.socket?.host,[zN.ATTR_SERVER_PORT]:e?.socket?.port}),r}hE.getClientAttributes=qge;function $ge(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var cz=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.RedisInstrumentationV4_V5=void 0;var _r=(b(),O(v)),xe=ne(),sz=oz(),Yge=uE(),iz=dE(),KN=(le(),O(Ae)),Wge=_E(),yd=Symbol("opentelemetry.instrumentation.redis.open_spans"),az=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),QN=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(iz.PACKAGE_NAME,iz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[yd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[yd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[az]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,sz.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:_r.SpanKind.CLIENT,attributes:i});return _r.context.with(_r.trace.setSpan(_r.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:_r.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(_r.trace.getSpan(_r.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[az],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||Yge.defaultDbStatementSerializer,p=(0,sz.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[Wge.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:_r.SpanKind.CLIENT,attributes:p}),_=_r.context.with(_r.trace.setSpan(_r.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[yd]=f[yd]||[],f[yd].push({span:d,commandName:a,commandArgs:c})}return _}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(KN.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:_r.SpanStatusCode.ERROR,message:s?.message})),e.end()}};TE.RedisInstrumentationV4_V5=QN});var pz=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE.RedisInstrumentation=void 0;var zge=ne(),uz=dE(),Kge=nz(),Qge=cz(),lz={requireParentSpan:!1},XN=class extends zge.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...lz,...e};super(uz.PACKAGE_NAME,uz.PACKAGE_VERSION,n),this.instrumentationV2_V3=new Kge.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Qge.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...lz,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}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())}};EE.RedisInstrumentation=XN});var dz=E(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.RedisInstrumentation=void 0;var Xge=pz();Object.defineProperty(SE,"RedisInstrumentation",{enumerable:!0,get:function(){return Xge.RedisInstrumentation}})});var Rz=E(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.EVENT_LISTENERS_SET=void 0;AE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var eb=E(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.AttributeNames=void 0;var oAe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(oAe=Nd.AttributeNames||(Nd.AttributeNames={}))});var tb=E(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Se.METRIC_DB_CLIENT_CONNECTION_COUNT=Se.DB_SYSTEM_VALUE_POSTGRESQL=Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Se.ATTR_NET_PEER_PORT=Se.ATTR_NET_PEER_NAME=Se.ATTR_DB_USER=Se.ATTR_DB_SYSTEM=Se.ATTR_DB_STATEMENT=Se.ATTR_DB_NAME=Se.ATTR_DB_CONNECTION_STRING=Se.ATTR_DB_CLIENT_CONNECTION_STATE=Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Se.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Se.ATTR_DB_CONNECTION_STRING="db.connection_string";Se.ATTR_DB_NAME="db.name";Se.ATTR_DB_STATEMENT="db.statement";Se.ATTR_DB_SYSTEM="db.system";Se.ATTR_DB_USER="db.user";Se.ATTR_NET_PEER_NAME="net.peer.name";Se.ATTR_NET_PEER_PORT="net.peer.port";Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Se.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";Se.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var nb=E(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.SpanNames=void 0;var sAe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(sAe=bd.SpanNames||(bd.SpanNames={}))});var Pz=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var Zs=(b(),O(v)),RE=eb(),fr=(le(),O(Ae)),Ve=tb(),ga=ne(),yz=nb();function Iz(t,e){if(!e)return yz.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:Oz(e.text);return`${yz.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=Iz;function Oz(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}me.parseNormalizedOperationName=Oz;function Nz(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=Nz;function rb(t){if("connectionString"in t&&t.connectionString)return Nz(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=rb;function yE(t){if(Number.isInteger(t))return t}function bz(t,e){let n={};return e&ga.SemconvStability.OLD&&(n={...n,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_DB_USER]:t.user,[Ve.ATTR_NET_PEER_NAME]:t.host,[Ve.ATTR_NET_PEER_PORT]:yE(t.port)}),e&ga.SemconvStability.STABLE&&(n={...n,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:t.host,[fr.ATTR_SERVER_PORT]:yE(t.port)}),n}me.getSemanticAttributesFromConnection=bz;function iAe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[RE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[RE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&ga.SemconvStability.OLD&&(r={...r,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Ve.ATTR_NET_PEER_PORT]:Number(n?.port)||yE(t.port),[Ve.ATTR_DB_USER]:n?.username??t.user}),e&ga.SemconvStability.STABLE&&(r={...r,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[fr.ATTR_SERVER_PORT]:Number(n?.port)||yE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=iAe;function aAe(t){return t.requireParentSpan===!0&&Zs.trace.getSpan(Zs.context.active())===void 0}me.shouldSkipInstrumentation=aAe;function cAe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=Iz(s,r),a=t.startSpan(i,{kind:Zs.SpanKind.CLIENT,attributes:bz(o,n)});if(!r)return a;if(r.text&&(n&ga.SemconvStability.OLD&&a.setAttribute(Ve.ATTR_DB_STATEMENT,r.text),n&ga.SemconvStability.STABLE&&a.setAttribute(fr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(RE.AttributeNames.PG_VALUES,c)}catch(c){Zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(RE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=cAe;function Cz(t,e,n){typeof t.responseHook=="function"&&(0,ga.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&Zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=Cz;function uAe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[fr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(IE(i)),e.setStatus({code:Zs.SpanStatusCode.ERROR,message:i.message})):Cz(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=uAe;function lAe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}me.getPoolName=lAe;function pAe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=pAe;function dAe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(IE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=dAe;function _Ae(t,e){return function(r){r&&(r instanceof Error&&t.recordException(IE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=_Ae;function fAe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=fAe;function mAe(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=mAe;function IE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=IE});var Mz=E(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.PACKAGE_NAME=Bu.PACKAGE_VERSION=void 0;Bu.PACKAGE_VERSION="0.66.0";Bu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var wz=E(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.PgInstrumentation=void 0;var mn=ne(),Ie=(b(),O(v)),xz=Rz(),ke=Pz(),vz=jN(),Lz=Mz(),Dz=nb(),OE=Te(),wr=(le(),O(Ae)),Cd=tb();function ju(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var ob=class extends mn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(Lz.PACKAGE_NAME,Lz.PACKAGE_VERSION,e),this._semconvStability=(0,mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(wr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.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(Cd.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(Cd.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new mn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new mn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new mn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=ju(a);return this._patchPgClient(c.Client),a},a=>{let c=ju(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new mn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=ju(a);return(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=ju(a);(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}recordOperationDuration(e,n){let r={},o=[wr.ATTR_DB_NAMESPACE,wr.ATTR_ERROR_TYPE,wr.ATTR_SERVER_PORT,wr.ATTR_SERVER_ADDRESS,wr.ATTR_DB_OPERATION_NAME];this._semconvStability&mn.SemconvStability.OLD&&o.push(Cd.ATTR_DB_SYSTEM),this._semconvStability&mn.SemconvStability.STABLE&&o.push(wr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,OE.hrTimeToMilliseconds)((0,OE.hrTimeDuration)(n,(0,OE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,OE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,p={[Cd.ATTR_DB_SYSTEM]:Cd.DB_SYSTEM_VALUE_POSTGRESQL,[wr.ATTR_DB_NAMESPACE]:this.database,[wr.ATTR_SERVER_PORT]:this.connectionParameters.port,[wr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[wr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,vz.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,vz.addSqlCommenterComment)(f,i.text)})),o.length>0){let T=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),T&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let S=ke.patchCallback(e.getConfig(),f,l.callback,p,d);T&&(S=Ie.context.bind(Ie.context.active(),S)),o[0].callback=S}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,mn.safeExecuteInTheMiddle)(()=>{let{database:T,host:S,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:T,host:S,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let h;try{h=n.apply(this,o)}catch(T){throw T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(T)}),f.end(),T}return h instanceof Promise?h.then(T=>new Promise(S=>{ke.handleExecutionResult(e.getConfig(),f,T),d(),f.end(),S(T)})).catch(T=>new Promise((S,R)=>{T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:T.message}),d(),f.end(),R(T)})):h})}_setPoolConnectEventListeners(e){if(e[xz.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[xz.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}};NE.PgInstrumentation=ob;function Uz(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var kz=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.AttributeNames=Hu.PgInstrumentation=void 0;var hAe=wz();Object.defineProperty(Hu,"PgInstrumentation",{enumerable:!0,get:function(){return hAe.PgInstrumentation}});var TAe=eb();Object.defineProperty(Hu,"AttributeNames",{enumerable:!0,get:function(){return TAe.AttributeNames}})});var $z=E(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SeverityNumber=void 0;var RAe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(RAe=Pd.SeverityNumber||(Pd.SeverityNumber={}))});var CE=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.NOOP_LOGGER=Fu.NoopLogger=void 0;var bE=class{emit(e){}};Fu.NoopLogger=bE;Fu.NOOP_LOGGER=new bE});var ME=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.NOOP_LOGGER_PROVIDER=Vu.NoopLoggerProvider=void 0;var yAe=CE(),PE=class{getLogger(e,n,r){return new yAe.NoopLogger}};Vu.NoopLoggerProvider=PE;Vu.NOOP_LOGGER_PROVIDER=new PE});var cb=E(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.ProxyLogger=void 0;var IAe=CE(),ab=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):IAe.NOOP_LOGGER}};xE.ProxyLogger=ab});var lb=E(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE.ProxyLoggerProvider=void 0;var OAe=ME(),NAe=cb(),ub=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new NAe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:OAe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};vE.ProxyLoggerProvider=ub});var Yz=E(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE._globalThis=void 0;LE._globalThis=typeof globalThis=="object"?globalThis:global});var Wz=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE._globalThis=void 0;var bAe=Yz();Object.defineProperty(DE,"_globalThis",{enumerable:!0,get:function(){return bAe._globalThis}})});var zz=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE._globalThis=void 0;var CAe=Wz();Object.defineProperty(UE,"_globalThis",{enumerable:!0,get:function(){return CAe._globalThis}})});var Kz=E(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.API_BACKWARDS_COMPATIBILITY_VERSION=_o.makeGetter=_o._global=_o.GLOBAL_LOGS_API_KEY=void 0;var PAe=zz();_o.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");_o._global=PAe._globalThis;function MAe(t,e,n){return r=>r===t?e:n}_o.makeGetter=MAe;_o.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Xz=E(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.LogsAPI=void 0;var mr=Kz(),xAe=ME(),Qz=lb(),pb=class t{constructor(){this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return mr._global[mr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(mr._global[mr.GLOBAL_LOGS_API_KEY]=(0,mr.makeGetter)(mr.API_BACKWARDS_COMPATIBILITY_VERSION,e,xAe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=mr._global[mr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(mr._global,mr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete mr._global[mr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}};wE.LogsAPI=pb});var db=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.logs=Pt.ProxyLoggerProvider=Pt.ProxyLogger=Pt.NoopLoggerProvider=Pt.NOOP_LOGGER_PROVIDER=Pt.NoopLogger=Pt.NOOP_LOGGER=Pt.SeverityNumber=void 0;var vAe=$z();Object.defineProperty(Pt,"SeverityNumber",{enumerable:!0,get:function(){return vAe.SeverityNumber}});var Jz=CE();Object.defineProperty(Pt,"NOOP_LOGGER",{enumerable:!0,get:function(){return Jz.NOOP_LOGGER}});Object.defineProperty(Pt,"NoopLogger",{enumerable:!0,get:function(){return Jz.NoopLogger}});var Zz=ME();Object.defineProperty(Pt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Zz.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Pt,"NoopLoggerProvider",{enumerable:!0,get:function(){return Zz.NoopLoggerProvider}});var LAe=cb();Object.defineProperty(Pt,"ProxyLogger",{enumerable:!0,get:function(){return LAe.ProxyLogger}});var DAe=lb();Object.defineProperty(Pt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return DAe.ProxyLoggerProvider}});var UAe=Xz();Pt.logs=UAe.LogsAPI.getInstance()});var eK=E(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.disableInstrumentations=qu.enableInstrumentations=void 0;function wAe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}qu.enableInstrumentations=wAe;function kAe(t){t.forEach(e=>e.disable())}qu.disableInstrumentations=kAe});var rK=E(kE=>{"use strict";Object.defineProperty(kE,"__esModule",{value:!0});kE.registerInstrumentations=void 0;var tK=(b(),O(v)),GAe=db(),nK=eK();function BAe(t){let e=t.tracerProvider||tK.trace.getTracerProvider(),n=t.meterProvider||tK.metrics.getMeterProvider(),r=t.loggerProvider||GAe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,nK.enableInstrumentations)(o,e,n,r),()=>{(0,nK.disableInstrumentations)(o)}}kE.registerInstrumentations=BAe});var dK=E(GE=>{"use strict";Object.defineProperty(GE,"__esModule",{value:!0});GE.satisfies=void 0;var hb=(b(),O(v)),cK=/^(?: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-]+)*))?$/,jAe=/^(?<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-]+)*))?$/,HAe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function FAe(t,e,n){if(!VAe(t))return hb.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=WAe(t);if(!r)return!1;let o=[],s=uK(r,e,o,n);return s&&!n?.includePrerelease?$Ae(r,o):s}GE.satisfies=FAe;function VAe(t){return typeof t=="string"&&cK.test(t)}function uK(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(_b(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=fRe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!_b(t,s,n,r))return!1;return!0}return _b(t,e,n,r)}function _b(t,e,n,r){if(e=YAe(e,r),e.includes(" "))return uK(t,e,n,r);{let o=zAe(e);return n.push(o),qAe(t,o)}}function qAe(t,e){if(e.invalid)return!1;if(!e.version||mb(e.version))return!0;let n=sK(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=sK(r,o)}return HAe[e.op]?.includes(n)}function $Ae(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function YAe(t,e){return t=t.trim(),t=dRe(t,e),t=pRe(t),t=_Re(t,e),t=t.trim(),t}function hn(t){return!t||t.toLowerCase()==="x"||t==="*"}function WAe(t){let e=t.match(cK);if(!e){hb.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function zAe(t){if(!t)return{};let e=t.match(jAe);if(!e)return hb.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function mb(t){return t==="*"||t==="x"||t==="X"}function oK(t){let e=parseInt(t,10);return isNaN(e)?t:e}function KAe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function QAe(t,e){if(mb(t)||mb(e))return 0;let[n,r]=KAe(oK(t),oK(e));return n>r?1:n<r?-1:0}function sK(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=QAe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var lK="[a-zA-Z0-9-]",pK="0|[1-9]\\d*",XAe=`\\d*[a-zA-Z-]${lK}*`,JAe="((?:<|>)?=?)",iK=`(?:${pK}|${XAe})`,ZAe=`(?:-(${iK}(?:\\.${iK})*))`,aK=`${lK}+`,eRe=`(?:\\+(${aK}(?:\\.${aK})*))`,fb=`${pK}|x|X|\\*`,Md=`[v=\\s]*(${fb})(?:\\.(${fb})(?:\\.(${fb})(?:${ZAe})?${eRe}?)?)?`,tRe=`^${JAe}\\s*${Md}$`,nRe=new RegExp(tRe),rRe=`^\\s*(${Md})\\s+-\\s+(${Md})\\s*$`,oRe=new RegExp(rRe),sRe="(?:~>?)",iRe=`^${sRe}${Md}$`,aRe=new RegExp(iRe),cRe="(?:\\^)",uRe=`^${cRe}${Md}$`,lRe=new RegExp(uRe);function pRe(t){let e=aRe;return t.replace(e,(n,r,o,s,i)=>{let a;return hn(r)?a="":hn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:hn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function dRe(t,e){let n=lRe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return hn(s)?l="":hn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:hn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function _Re(t,e){let n=nRe;return t.replace(n,(r,o,s,i,a,c)=>{let l=hn(s),p=l||hn(i),d=p||hn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function fRe(t,e){let n=oRe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(hn(s)?o="":hn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:hn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,hn(d)?p="":hn(_)?p=`<${+d+1}.0.0-0`:hn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var Tb=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.massUnwrap=Ht.unwrap=Ht.massWrap=Ht.wrap=void 0;var Tn=console.error.bind(console);function xd(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var mRe=(t,e,n)=>{if(!t||!t[e]){Tn("no original function "+String(e)+" to wrap");return}if(!n){Tn("no wrapper function"),Tn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Tn("original object and wrapper must be functions");return}let o=n(r,e);return xd(o,"__original",r),xd(o,"__unwrap",()=>{t[e]===o&&xd(t,e,r)}),xd(o,"__wrapped",!0),xd(t,e,o),o};Ht.wrap=mRe;var hRe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Ht.wrap)(r,o,n)})})};Ht.massWrap=hRe;var TRe=(t,e)=>{if(!t||!t[e]){Tn("no function to unwrap."),Tn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Tn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Ht.unwrap=TRe;var ERe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Ht.unwrap)(n,r)})})};Ht.massUnwrap=ERe;function vd(t){t&&t.logger&&(typeof t.logger!="function"?Tn("new logger isn't a function, not replacing"):Tn=t.logger)}Ht.default=vd;vd.wrap=Ht.wrap;vd.massWrap=Ht.massWrap;vd.unwrap=Ht.unwrap;vd.massUnwrap=Ht.massUnwrap});var _K=E(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.InstrumentationAbstract=void 0;var Eb=(b(),O(v)),SRe=db(),BE=Tb(),Sb=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=Eb.diag.createComponentLogger({namespace:e}),this._tracer=Eb.trace.getTracer(e,n),this._meter=Eb.metrics.getMeter(e,n),this._logger=SRe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=BE.wrap;_unwrap=BE.unwrap;_massWrap=BE.massWrap;_massUnwrap=BE.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};jE.InstrumentationAbstract=Sb});var fK=E(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ModuleNameTrie=ti.ModuleNameSeparator=void 0;ti.ModuleNameSeparator="/";var HE=class{hooks=[];children=new Map},gb=class{_trie=new HE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ti.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new HE,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ti.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ti.ModuleNameTrie=gb});var hK=E(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0});FE.RequireInTheMiddleSingleton=void 0;var gRe=ki(),mK=U("path"),Ab=fK(),ARe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Rb=class t{_moduleNameTrie=new Ab.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new gRe.Hook(null,{internals:!0},(e,n,r)=>{let o=RRe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return ARe?new t:this._instance=this._instance??new t}};FE.RequireInTheMiddleSingleton=Rb;function RRe(t){return mK.sep!==Ab.ModuleNameSeparator?t.split(mK.sep).join(Ab.ModuleNameSeparator):t}});var yb=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.isWrapped=ni.safeExecuteInTheMiddleAsync=ni.safeExecuteInTheMiddle=void 0;function yRe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddle=yRe;async function IRe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddleAsync=IRe;function ORe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ni.isWrapped=ORe});var SK=E(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.InstrumentationBase=void 0;var Ld=U("path"),TK=U("util"),NRe=dK(),Ib=Tb(),bRe=_K(),CRe=hK(),PRe=oN(),Dd=(b(),O(v)),MRe=ki(),xRe=U("fs"),vRe=yb(),Ob=class extends bRe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=CRe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,vRe.isWrapped)(e[n])&&this._unwrap(e,n),TK.types.isProxy(e)){let o=(0,Ib.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,Ib.wrap)(e,n,r)};_unwrap=(e,n)=>TK.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,Ib.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,xRe.readFileSync)(Ld.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Dd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return EK(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Ld.normalize(r);return i.filter(l=>l.name===a).filter(l=>EK(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Ld.isAbsolute(a)){let l=Ld.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Ld.isAbsolute(e.name)?new MRe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new PRe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};VE.InstrumentationBase=Ob;function EK(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,NRe.satisfies)(e,r,{includePrerelease:n}))}});var gK=E(qE=>{"use strict";Object.defineProperty(qE,"__esModule",{value:!0});qE.normalize=void 0;var LRe=U("path");Object.defineProperty(qE,"normalize",{enumerable:!0,get:function(){return LRe.normalize}})});var AK=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.normalize=$u.InstrumentationBase=void 0;var DRe=SK();Object.defineProperty($u,"InstrumentationBase",{enumerable:!0,get:function(){return DRe.InstrumentationBase}});var URe=gK();Object.defineProperty($u,"normalize",{enumerable:!0,get:function(){return URe.normalize}})});var Nb=E(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.normalize=Yu.InstrumentationBase=void 0;var RK=AK();Object.defineProperty(Yu,"InstrumentationBase",{enumerable:!0,get:function(){return RK.InstrumentationBase}});Object.defineProperty(Yu,"normalize",{enumerable:!0,get:function(){return RK.normalize}})});var yK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.InstrumentationNodeModuleDefinition=void 0;var bb=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};$E.InstrumentationNodeModuleDefinition=bb});var IK=E(YE=>{"use strict";Object.defineProperty(YE,"__esModule",{value:!0});YE.InstrumentationNodeModuleFile=void 0;var wRe=Nb(),Cb=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,wRe.normalize)(e)}};YE.InstrumentationNodeModuleFile=Cb});var OK=E(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.semconvStabilityFromStr=Aa.SemconvStability=void 0;var WE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(WE=Aa.SemconvStability||(Aa.SemconvStability={}));function kRe(t,e){let n=WE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=WE.DUPLICATE;break}else o.toLowerCase()===t&&(n=WE.STABLE);return n}Aa.semconvStabilityFromStr=kRe});var bK=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var GRe=rK();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return GRe.registerInstrumentations}});var BRe=Nb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return BRe.InstrumentationBase}});var jRe=yK();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return jRe.InstrumentationNodeModuleDefinition}});var HRe=IK();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return HRe.InstrumentationNodeModuleFile}});var Pb=yb();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return Pb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddleAsync}});var NK=OK();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return NK.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return NK.semconvStabilityFromStr}})});var kK=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.PACKAGE_NAME=zu.PACKAGE_VERSION=void 0;zu.PACKAGE_VERSION="0.60.0";zu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Lb=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HapiLifecycleMethodNames=fo.HapiLayerType=fo.handlerPatched=fo.HapiComponentName=void 0;fo.HapiComponentName="@hapi/hapi";fo.handlerPatched=Symbol("hapi-handler-patched");fo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};fo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var GK=E(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.ATTR_HTTP_METHOD=void 0;KE.ATTR_HTTP_METHOD="http.method"});var Db=E(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.AttributeNames=void 0;var rye;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(rye=Ud.AttributeNames||(Ud.AttributeNames={}))});var HK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var BK=(le(),O(Ae)),oye=GK(),wd=Lb(),ri=Db(),jK=ne();function sye(t){return t.name?t.name:t.pkg.name}lt.getPluginName=sye;var iye=t=>typeof t=="string"&&wd.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=iye;var aye=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=aye;var cye=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=cye;var uye=t=>!Array.isArray(t);lt.isPatchableExtMethod=uye;var lye=(t,e,n)=>{let r={[BK.ATTR_HTTP_ROUTE]:t.path};e&jK.SemconvStability.OLD&&(r[oye.ATTR_HTTP_METHOD]=t.method),e&jK.SemconvStability.STABLE&&(r[BK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.PLUGIN,r[ri.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=lye;var pye=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT,[ri.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT},name:r}};lt.getExtMetadata=pye;var dye=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=dye});var qK=E(QE=>{"use strict";Object.defineProperty(QE,"__esModule",{value:!0});QE.HapiInstrumentation=void 0;var Wn=(b(),O(v)),FK=Te(),kd=ne(),VK=kK(),Gd=Lb(),Qo=HK(),Ub=class extends kd.InstrumentationBase{_semconvStability;constructor(e={}){super(VK.PACKAGE_NAME,VK.PACKAGE_VERSION,e),this._semconvStability=(0,kd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new kd.InstrumentationNodeModuleDefinition(Gd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,kd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,kd.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,Qo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Qo.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,Qo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Qo.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,Qo.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,Qo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,Qo.isPatchableExtMethod)(e))return e[Gd.handlerPatched]===!0?e:(e[Gd.handlerPatched]=!0,async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await e.apply(this,i);let a=(0,Qo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:Wn.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Gd.handlerPatched]===!0)return e;e[Gd.handlerPatched]=!0;let o=s=>async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await s.call(this,...i);let a=(0,FK.getRPCMetadata)(Wn.context.active());a?.type===FK.RPCType.HTTP&&(a.route=e.path);let c=(0,Qo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:Wn.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};QE.HapiInstrumentation=Ub});var $K=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AttributeNames=Ku.HapiInstrumentation=void 0;var _ye=qK();Object.defineProperty(Ku,"HapiInstrumentation",{enumerable:!0,get:function(){return _ye.HapiInstrumentation}});var fye=Db();Object.defineProperty(Ku,"AttributeNames",{enumerable:!0,get:function(){return fye.AttributeNames}})});var ZE=E(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.KoaLayerType=void 0;var gye;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(gye=jd.KoaLayerType||(jd.KoaLayerType={}))});var ZK=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PACKAGE_NAME=Qu.PACKAGE_VERSION=void 0;Qu.PACKAGE_VERSION="0.62.0";Qu.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var wb=E(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.AttributeNames=void 0;var Aye;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(Aye=Hd.AttributeNames||(Hd.AttributeNames={}))});var t2=E(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.isLayerIgnored=Xu.getMiddlewareMetadata=void 0;var e2=ZE(),eS=wb(),Rye=(le(),O(Ae)),yye=(t,e,n,r)=>n?{attributes:{[eS.AttributeNames.KOA_NAME]:r?.toString(),[eS.AttributeNames.KOA_TYPE]:e2.KoaLayerType.ROUTER,[Rye.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[eS.AttributeNames.KOA_NAME]:e.name??"middleware",[eS.AttributeNames.KOA_TYPE]:e2.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Xu.getMiddlewareMetadata=yye;var Iye=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Xu.isLayerIgnored=Iye});var n2=E(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.kLayerPatched=void 0;tS.kLayerPatched=Symbol("koa-layer-patched")});var c2=E(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS.KoaInstrumentation=void 0;var mo=(b(),O(v)),Fd=ne(),r2=ZE(),o2=ZK(),s2=t2(),i2=Te(),a2=n2(),kb=class extends Fd.InstrumentationBase{constructor(e={}){super(o2.PACKAGE_NAME,o2.PACKAGE_VERSION,e)}init(){return new Fd.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){mo.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?r2.KoaLayerType.ROUTER:r2.KoaLayerType.MIDDLEWARE;return e[a2.kLayerPatched]===!0||(0,s2.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(mo.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[a2.kLayerPatched]=!0,mo.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(mo.trace.getSpan(mo.context.active())===void 0)return e(s,i);let c=(0,s2.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,i2.getRPCMetadata)(mo.context.active());p?.type===i2.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Fd.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&mo.diag.error("koa instrumentation: request hook failed",f)},!0);let _=mo.trace.setSpan(mo.context.active(),l);return mo.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};nS.KoaInstrumentation=kb});var u2=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.KoaLayerType=si.AttributeNames=si.KoaInstrumentation=void 0;var Oye=c2();Object.defineProperty(si,"KoaInstrumentation",{enumerable:!0,get:function(){return Oye.KoaInstrumentation}});var Nye=wb();Object.defineProperty(si,"AttributeNames",{enumerable:!0,get:function(){return Nye.AttributeNames}});var bye=ZE();Object.defineProperty(si,"KoaLayerType",{enumerable:!0,get:function(){return bye.KoaLayerType}})});var Gb=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.ConnectNames=kr.ConnectTypes=kr.AttributeNames=void 0;var Pye;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(Pye=kr.AttributeNames||(kr.AttributeNames={}));var Mye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Mye=kr.ConnectTypes||(kr.ConnectTypes={}));var xye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(xye=kr.ConnectNames||(kr.ConnectNames={}))});var f2=E(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.PACKAGE_NAME=Ju.PACKAGE_VERSION=void 0;Ju.PACKAGE_VERSION="0.57.0";Ju.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var m2=E(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});rS._LAYERS_STORE_PROPERTY=void 0;rS._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var h2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.generateRoute=ai.replaceCurrentStackRoute=ai.addNewStackLayer=void 0;var vye=(b(),O(v)),ii=m2(),Lye=t=>{Array.isArray(t[ii._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ii._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ii._LAYERS_STORE_PROPERTY].push("/");let e=t[ii._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ii._LAYERS_STORE_PROPERTY].length?t[ii._LAYERS_STORE_PROPERTY].pop():vye.diag.warn("Connect: Trying to pop the stack multiple time")}};ai.addNewStackLayer=Lye;var Dye=(t,e)=>{e&&t[ii._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ai.replaceCurrentStackRoute=Dye;var Uye=t=>t[ii._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ai.generateRoute=Uye});var S2=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.ConnectInstrumentation=ci.ANONYMOUS_NAME=void 0;var wye=(b(),O(v)),T2=Te(),Zu=Gb(),E2=f2(),oS=ne(),kye=(le(),O(Ae)),Bb=h2();ci.ANONYMOUS_NAME="anonymous";var jb=class extends oS.InstrumentationBase{constructor(e={}){super(E2.PACKAGE_NAME,E2.PACKAGE_VERSION,e)}init(){return[new oS.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,oS.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,oS.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=Zu.ConnectTypes.REQUEST_HANDLER,s=Zu.ConnectNames.REQUEST_HANDLER,o=e):(r=Zu.ConnectTypes.MIDDLEWARE,s=Zu.ConnectNames.MIDDLEWARE,o=n.name||ci.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[kye.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[Zu.AttributeNames.CONNECT_TYPE]:r,[Zu.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],l=arguments[i],p=arguments[a],d=arguments[c];(0,Bb.replaceCurrentStackRoute)(l,e);let _=(0,T2.getRPCMetadata)(wye.context.active());e&&_?.type===T2.RPCType.HTTP&&(_.route=(0,Bb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ci.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let h=!1;function T(){h?r._diag.debug(`span ${m.name} - already finished`):(h=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",T)}return p.addListener("close",T),arguments[c]=r._patchNext(d,T),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,Bb.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ci.ConnectInstrumentation=jb});var A2=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.ConnectTypes=hr.ConnectNames=hr.AttributeNames=hr.ANONYMOUS_NAME=hr.ConnectInstrumentation=void 0;var g2=S2();Object.defineProperty(hr,"ConnectInstrumentation",{enumerable:!0,get:function(){return g2.ConnectInstrumentation}});Object.defineProperty(hr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return g2.ANONYMOUS_NAME}});var Hb=Gb();Object.defineProperty(hr,"AttributeNames",{enumerable:!0,get:function(){return Hb.AttributeNames}});Object.defineProperty(hr,"ConnectNames",{enumerable:!0,get:function(){return Hb.ConnectNames}});Object.defineProperty(hr,"ConnectTypes",{enumerable:!0,get:function(){return Hb.ConnectTypes}})});var N2=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DB_SYSTEM_VALUE_MSSQL=Mt.ATTR_NET_PEER_PORT=Mt.ATTR_NET_PEER_NAME=Mt.ATTR_DB_USER=Mt.ATTR_DB_SYSTEM=Mt.ATTR_DB_STATEMENT=Mt.ATTR_DB_SQL_TABLE=Mt.ATTR_DB_NAME=void 0;Mt.ATTR_DB_NAME="db.name";Mt.ATTR_DB_SQL_TABLE="db.sql.table";Mt.ATTR_DB_STATEMENT="db.statement";Mt.ATTR_DB_SYSTEM="db.system";Mt.ATTR_DB_USER="db.user";Mt.ATTR_NET_PEER_NAME="net.peer.name";Mt.ATTR_NET_PEER_PORT="net.peer.port";Mt.DB_SYSTEM_VALUE_MSSQL="mssql"});var b2=E(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.once=el.getSpanName=void 0;function Bye(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}el.getSpanName=Bye;var jye=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};el.once=jye});var C2=E(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.PACKAGE_NAME=tl.PACKAGE_VERSION=void 0;tl.PACKAGE_VERSION="0.33.0";tl.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var L2=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.TediousInstrumentation=li.INJECTED_CTX=void 0;var nl=(b(),O(v)),Hye=U("events"),ho=ne(),Ra=(le(),O(Ae)),ui=N2(),P2=b2(),M2=C2(),v2=Symbol("opentelemetry.instrumentation-tedious.current-database");li.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var x2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function sS(t){Object.defineProperty(this,v2,{value:t,writable:!0})}var Fb=class t extends ho.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(M2.PACKAGE_NAME,M2.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ho.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ho.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new ho.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of x2)(0,ho.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,ho.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of x2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return sS.call(this,this.config?.options?.database),this.removeListener("databaseChange",sS),this.on("databaseChange",sS),this.once("end",()=>{this.removeListener("databaseChange",sS)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||nl.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,li.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[li.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof Hye.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[v2],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_DB_SYSTEM]=ui.DB_SYSTEM_VALUE_MSSQL,f[ui.ATTR_DB_NAME]=d,f[ui.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[ui.ATTR_DB_STATEMENT]=_,f[ui.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_DB_NAMESPACE]=d,f[Ra.ATTR_DB_SYSTEM_NAME]=Ra.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[Ra.ATTR_DB_QUERY_TEXT]=_,f[Ra.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_NET_PEER_NAME]=this.config?.server,f[ui.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_SERVER_ADDRESS]=this.config?.server,f[Ra.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,P2.getSpanName)(e,d,_,i.table),{kind:nl.SpanKind.CLIENT,attributes:f}),h=(0,P2.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",h),this.removeListener("end",h),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:nl.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",h),this.on("end",h),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(h)):o._diag.error("Expected request.callback to be a function");let T=()=>nl.context.with(nl.trace.setSpan(nl.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return T();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(T)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};li.TediousInstrumentation=Fb});var D2=E(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});iS.TediousInstrumentation=void 0;var Fye=L2();Object.defineProperty(iS,"TediousInstrumentation",{enumerable:!0,get:function(){return Fye.TediousInstrumentation}})});var B2=E(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.PACKAGE_NAME=rl.PACKAGE_VERSION=void 0;rl.PACKAGE_VERSION="0.57.0";rl.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var H2=E(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.GenericPoolInstrumentation=void 0;var ol=(b(),O(v)),ya=ne(),j2=B2(),Vb="generic-pool",qb=class extends ya.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(j2.PACKAGE_NAME,j2.PACKAGE_VERSION,e)}init(){return[new ya.InstrumentationNodeModuleDefinition(Vb,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition(Vb,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition(Vb,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,ya.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=ol.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return ol.context.with(ol.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=ol.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return ol.context.with(ol.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};aS.GenericPoolInstrumentation=qb});var F2=E(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.GenericPoolInstrumentation=void 0;var $ye=H2();Object.defineProperty(cS,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return $ye.GenericPoolInstrumentation}})});var $b=E(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ATTR_NET_PEER_PORT=To.ATTR_NET_PEER_NAME=To.ATTR_MESSAGING_SYSTEM=To.ATTR_MESSAGING_OPERATION=void 0;To.ATTR_MESSAGING_OPERATION="messaging.operation";To.ATTR_MESSAGING_SYSTEM="messaging.system";To.ATTR_NET_PEER_NAME="net.peer.name";To.ATTR_NET_PEER_PORT="net.peer.port"});var Yb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var Wb=E(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.DEFAULT_CONFIG=Ia.EndOperation=void 0;var Wye;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(Wye=Ia.EndOperation||(Ia.EndOperation={}));Ia.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var Q2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var zb=(b(),O(v)),pi=ne(),uS=(le(),O(Ae)),Vd=$b(),lS=Yb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Kb=(0,zb.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),zye=t=>t!==""?t:"<default>";$e.normalizeExchange=zye;var Kye=t=>t.replace(/:[^:@/]*@/,":***@"),W2=(t,e)=>t||(e==="AMQP"?5672:5671),z2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},K2=t=>t||"localhost",Eo=(t,e,n,r)=>n?{[e]:n}:(zb.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),Qye=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Vd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=Qye;var Xye=(t,e)=>{let n={[lS.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=z2(r?.protocol);Object.assign(n,{...Eo(t,lS.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=K2(r?.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(t,Vd.ATTR_NET_PEER_NAME,s,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(t,uS.ATTR_SERVER_ADDRESS,s,"hostname")});let i=W2(r.port,o);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(t,Vd.ATTR_NET_PEER_PORT,i,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(t,uS.ATTR_SERVER_PORT,i,"port"))}else{let r=Kye(t);n[lS.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=z2(o.protocol);Object.assign(n,{...Eo(r,lS.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=K2(o.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(r,Vd.ATTR_NET_PEER_NAME,i,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(r,uS.ATTR_SERVER_ADDRESS,i,"hostname")});let a=W2(o.port?parseInt(o.port):void 0,s);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(r,Vd.ATTR_NET_PEER_PORT,a,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(r,uS.ATTR_SERVER_PORT,a,"port"))}catch(o){zb.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=Xye;var Jye=t=>t.setValue(Kb,!0);$e.markConfirmChannelTracing=Jye;var Zye=t=>t.deleteValue(Kb);$e.unmarkConfirmChannelTracing=Zye;var eIe=t=>t.getValue(Kb)===!0;$e.isConfirmChannelTracing=eIe});var X2=E(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.PACKAGE_NAME=sl.PACKAGE_VERSION=void 0;sl.PACKAGE_VERSION="0.61.0";sl.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Z2=E(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});_S.AmqplibInstrumentation=void 0;var Ge=(b(),O(v)),pS=Te(),Ee=ne(),tIe=$b(),zn=Yb(),En=Wb(),Ye=Q2(),J2=X2(),dS=[">=0.5.5 <1"],Qb=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(J2.PACKAGE_NAME,J2.PACKAGE_VERSION,{...En.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...En.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",dS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",dS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",dS,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",dS,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,En.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,En.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,En.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,En.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,En.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let l=this,p=n===En.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==En.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let h=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:f,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[tIe.ATTR_MESSAGING_OPERATION]:zn.MESSAGING_OPERATION_VALUE_PROCESS,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:T}=r.getConfig();T&&(0,Ee.safeExecuteInTheMiddle)(()=>T(h,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,pS.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=h);let S=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(S,h),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(h,p,!1,En.EndOperation.AutoAck),h.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),S=>{S&&Ge.diag.error("amqplib instrumentation: publishHook error",S)},!0);let m=function(S,R){try{l?.call(this,S,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:S}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),S&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},h=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),T=[...arguments];return T[3]=_,T[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(h,d)),m),Ge.context.with(h,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),h=>{h&&Ge.diag.error("amqplib instrumentation: publishHook error",h)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:n,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==En.EndOperation.ChannelClosed&&r!==En.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,pS.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,pS.hrTimeDuration)(i.timeOfConsume,n);if((0,pS.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,En.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};_S.AmqplibInstrumentation=Qb});var t4=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.EndOperation=di.DEFAULT_CONFIG=di.AmqplibInstrumentation=void 0;var nIe=Z2();Object.defineProperty(di,"AmqplibInstrumentation",{enumerable:!0,get:function(){return nIe.AmqplibInstrumentation}});var e4=Wb();Object.defineProperty(di,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return e4.DEFAULT_CONFIG}});Object.defineProperty(di,"EndOperation",{enumerable:!0,get:function(){return e4.EndOperation}})});b();var tq=K(OG(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function cn(){return fs(J),J}function fs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ir(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var ql=["debug","info","warn","error","log","assert","trace"],nae="Sentry Logger ",Tc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(Tc);r.forEach(o=>{let s=Tc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function rae(){AR().enabled=!0}function oae(){AR().enabled=!1}function NG(){return AR().enabled}function sae(...t){gR("log",...t)}function iae(...t){gR("warn",...t)}function aae(...t){gR("error",...t)}function gR(t,...e){C&&NG()&&Qe(()=>{J.console[t](`${nae}[${t}]:`,...e)})}function AR(){return C?Ir("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:rae,disable:oae,isEnabled:NG,log:sae,warn:iae,error:aae};var xf="?",bG=/\(error: (.*)\)/,CG=/captureMessage|captureException/;function vf(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
|
|
13
|
-
`);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=
|
|
5
|
+
`+s),t.push(o+"m+"+Tf.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Lse()+e+" "+t[0]}function Lse(){return St.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Dse(...t){return process.stderr.write(hf.formatWithOptions(St.inspectOpts,...t)+`
|
|
6
|
+
`)}function Use(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function wse(){return process.env.DEBUG}function kse(t){t.inspectOpts={};let e=Object.keys(St.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=St.inspectOpts[e[n]]}Tf.exports=KA()(St);var{formatters:wk}=Tf.exports;wk.o=function(t){return this.inspectOpts.colors=this.useColors,hf.inspect(t,this.inspectOpts).split(`
|
|
7
|
+
`).map(e=>e.trim()).join(" ")};wk.O=function(t){return this.inspectOpts.colors=this.useColors,hf.inspect(t,this.inspectOpts)}});var Gk=E((rDe,JA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?JA.exports=Mk():JA.exports=kk()});var Ef=E((oDe,Bk)=>{"use strict";var ZA=U("path").sep;Bk.exports=function(t){var e=t.split(ZA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+ZA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+ZA;return{name:o,basedir:i,path:l}}}});var ki=E((sDe,nR)=>{"use strict";var pc=U("path"),yr=U("module"),ze=Gk()("require-in-the-middle"),Gse=Ef();nR.exports=wl;nR.exports.Hook=wl;var eR,gf;if(yr.isBuiltin)gf=yr.isBuiltin;else if(yr.builtinModules)gf=t=>t.startsWith("node:")?!0:(eR===void 0&&(eR=new Set(yr.builtinModules)),eR.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var Bse=/([/\\]index)?(\.js)?$/,tR=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function wl(t,e,n){if(!(this instanceof wl))return new wl(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof yr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof yr._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues",process.version);return}this._cache=new tR,this._unhooked=!1,this._origRequire=yr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=yr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=gf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);gf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=yr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let h=o.has(_);h===!1&&o.add(_);let T=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(h===!0)return ze("module is in the process of being patched already - ignoring: %s",_),T;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),T;f=_}else if(i===!0&&t.includes(_)){let R=pc.parse(_);f=R.name,m=R.dir}else{let R=Gse(_);if(R===void 0)return ze("could not parse filename: %s",_),T;f=R.name,m=R.basedir;let I=jse(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return T;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let F;try{F=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,T,d),T}if(F!==_)if(s===!0)f=f+pc.sep+pc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",F),r._cache.set(_,T,d),T}}r._cache.set(_,T,d),ze("calling require hook: %s",f);let g=n(T,f,m);return r._cache.set(_,g,d),ze("returning module: %s",f),g}}wl.prototype.unhook=function(){this._unhooked=!0,this._require===yr.prototype.require?(yr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function jse(t){let e=pc.sep!=="/"?t.path.split(pc.sep).join("/"):t.path;return pc.posix.join(t.name,e).replace(Bse,"")}});var jk=E(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ModuleNameTrie=ls.ModuleNameSeparator=void 0;ls.ModuleNameSeparator="/";var Sf=class{hooks=[];children=new Map},rR=class{_trie=new Sf;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ls.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Sf,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ls.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ls.ModuleNameTrie=rR});var Fk=E(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.RequireInTheMiddleSingleton=void 0;var Hse=ki(),Hk=U("path"),oR=jk(),Fse=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),sR=class t{_moduleNameTrie=new oR.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Hse.Hook(null,{internals:!0},(e,n,r)=>{let o=Vse(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return Fse?new t:this._instance=this._instance??new t}};Af.RequireInTheMiddleSingleton=sR;function Vse(t){return Hk.sep!==oR.ModuleNameSeparator?t.split(Hk.sep).join(oR.ModuleNameSeparator):t}});var Wk=E(kl=>{var Vk=[],iR=new WeakMap,qk=new WeakMap,$k=new Map,Yk=[],qse={set(t,e,n){let r=iR.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=qk.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=iR.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function $se(t,e,n,r,o){$k.set(t,o),iR.set(e,n),qk.set(e,r);let s=new Proxy(e,qse);Vk.forEach(i=>i(t,s,o)),Yk.push([t,s,o])}kl.register=$se;kl.importHooks=Vk;kl.specifiers=$k;kl.toHook=Yk});var lR=E((lDe,_c)=>{var zk=U("path"),Yse=Ef(),{fileURLToPath:Wse}=U("url"),{MessageChannel:zse}=U("worker_threads"),{isBuiltin:aR}=U("module");aR||(aR=()=>!0);var{importHooks:cR,specifiers:Kse,toHook:Qse}=Wk();function Kk(t){cR.push(t),Qse.forEach(([e,n,r])=>t(e,n,r))}function Qk(t){let e=cR.indexOf(t);e>-1&&cR.splice(e,1)}function dc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var uR;function Xse(){let{port1:t,port2:e}=new zse,n=0,r;uR=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Gl(t,e,n){if(!(this instanceof Gl))return new Gl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;uR&&Array.isArray(t)&&uR(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);aR(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=Wse(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=Yse(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)dc(n,s,l,void 0);else if(d===o){if(!p)dc(n,s,o,p);else if(p.endsWith(Kse.get(a)))dc(n,s,o,p);else if(r){let _=o+zk.sep+zk.relative(p,l);dc(n,s,_,p)}}else d===i&&dc(n,s,i,p);else dc(n,s,o,p)},Kk(this._iitmHook)}Gl.prototype.unhook=function(){Qk(this._iitmHook)};_c.exports=Gl;_c.exports.Hook=Gl;_c.exports.addHook=Kk;_c.exports.removeHook=Qk;_c.exports.createAddHookMessageChannel=Xse});var pR=E(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.isWrapped=ps.safeExecuteInTheMiddleAsync=ps.safeExecuteInTheMiddle=void 0;function Jse(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddle=Jse;async function Zse(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddleAsync=Zse;function eie(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ps.isWrapped=eie});var Zk=E(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InstrumentationBase=void 0;var Bl=U("path"),Xk=U("util"),tie=Nk(),dR=YA(),nie=Ok(),rie=Fk(),oie=lR(),jl=(b(),N(v)),sie=ki(),iie=U("fs"),aie=pR(),_R=class extends nie.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=rie.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,aie.isWrapped)(e[n])&&this._unwrap(e,n),Xk.types.isProxy(e)){let o=(0,dR.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,dR.wrap)(e,n,r)};_unwrap=(e,n)=>Xk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,dR.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,iie.readFileSync)(Bl.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{jl.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return Jk(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Bl.normalize(r);return i.filter(l=>l.name===a&&Jk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Bl.isAbsolute(a)){let l=Bl.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Bl.isAbsolute(e.name)?new sie.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new oie.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};Rf.InstrumentationBase=_R;function Jk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,tie.satisfies)(e,r,{includePrerelease:n}))}});var eG=E(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.normalize=void 0;var cie=U("path");Object.defineProperty(yf,"normalize",{enumerable:!0,get:function(){return cie.normalize}})});var tG=E(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.normalize=fc.InstrumentationBase=void 0;var uie=Zk();Object.defineProperty(fc,"InstrumentationBase",{enumerable:!0,get:function(){return uie.InstrumentationBase}});var lie=eG();Object.defineProperty(fc,"normalize",{enumerable:!0,get:function(){return lie.normalize}})});var fR=E(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.normalize=mc.InstrumentationBase=void 0;var nG=tG();Object.defineProperty(mc,"InstrumentationBase",{enumerable:!0,get:function(){return nG.InstrumentationBase}});Object.defineProperty(mc,"normalize",{enumerable:!0,get:function(){return nG.normalize}})});var rG=E(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.InstrumentationNodeModuleDefinition=void 0;var mR=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};If.InstrumentationNodeModuleDefinition=mR});var oG=E(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.InstrumentationNodeModuleFile=void 0;var pie=fR(),hR=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,pie.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};Nf.InstrumentationNodeModuleFile=hR});var sG=E(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.semconvStabilityFromStr=Gi.SemconvStability=void 0;var Of;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(Of=Gi.SemconvStability||(Gi.SemconvStability={}));function die(t,e){let n=Of.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=Of.DUPLICATE;break}else o.toLowerCase()===t&&(n=Of.STABLE);return n}Gi.semconvStabilityFromStr=die});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var _ie=hk();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return _ie.registerInstrumentations}});var fie=fR();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return fie.InstrumentationBase}});var mie=rG();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return mie.InstrumentationNodeModuleDefinition}});var hie=oG();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return hie.InstrumentationNodeModuleFile}});var TR=pR();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return TR.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return TR.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return TR.safeExecuteInTheMiddleAsync}});var iG=sG();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return iG.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return iG.semconvStabilityFromStr}})});var aG=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var cG=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.AttributeNames=void 0;var Tie;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(Tie=Hl.AttributeNames||(Hl.AttributeNames={}))});var ER=E(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.DEFAULT_QUERY_STRINGS_TO_REDACT=zr.STR_REDACTED=zr.SYNTHETIC_BOT_NAMES=zr.SYNTHETIC_TEST_NAMES=void 0;zr.SYNTHETIC_TEST_NAMES=["alwayson"];zr.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];zr.STR_REDACTED="REDACTED";zr.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var lG=E((yDe,uG)=>{"use strict";var Eie=U("util");function gR(t,e){Error.captureStackTrace(this,gR),this.name=this.constructor.name,this.message=t,this.input=e}Eie.inherits(gR,Error);uG.exports=gR});var dG=E((IDe,pG)=>{"use strict";function gie(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function Sie(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function Aie(t){return t>=32&&t<=126}function Rie(t){return t>=128&&t<=255}pG.exports={isDelimiter:gie,isTokenChar:Sie,isExtended:Rie,isPrint:Aie}});var TG=E((NDe,hG)=>{"use strict";var yie=U("util"),hc=lG(),bf=dG(),Iie=bf.isDelimiter,_G=bf.isTokenChar,fG=bf.isExtended,Nie=bf.isPrint;function mG(t){return t.replace(/\\(.)/g,"$1")}function Fl(t,e){return yie.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function Oie(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(_G(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new hc(Fl(t,p),t)}else if(n&&(l===9||Nie(l)||fG(l)))n=!1;else if(_G(l)){if(a!==-1)throw new hc(Fl(t,p),t);i===-1&&(i=p)}else if(Iie(l)||fG(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?mG(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new hc(Fl(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new hc(Fl(t,p),t)}else throw new hc(Fl(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new hc("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?mG(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}hG.exports=Oie});var OG=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Vl=(b(),N(v)),ae=(le(),N(Ae)),V=aG(),EG=Te(),kn=ne(),bie=U("url"),Pf=cG(),gG=ER(),Cf=ER(),Cie=TG(),Pie=(t,e,n="http:",r=Array.from(Cf.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,Cf.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${Cf.STR_REDACTED}:${Cf.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=Pie;var Mie=(t,e)=>{let n=t===Vl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Vl.SpanStatusCode.UNSET:Vl.SpanStatusCode.ERROR};$.parseResponseStatus=Mie;var xie=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=xie;var vie=(t,e,n)=>{let r=e.message;n&kn.SemconvStability.OLD&&(t.setAttribute(Pf.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(Pf.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&kn.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Vl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=vie;var Lie=(t,e)=>{let n=AG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=Lie;var Die=(t,e)=>{let n=AG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=Die;function AG(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var Uie=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=Uie;function wie(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var kie=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=wie(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof bie.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=kie;var Gie=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=Gie;var Bie=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=Bie;var jie=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=IG(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[V.ATTR_HTTP_URL]:p,[V.ATTR_HTTP_METHOD]:i,[V.ATTR_HTTP_TARGET]:t.path||"/",[V.ATTR_NET_PEER_NAME]:o,[V.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=RG(l)),l!==void 0&&(d[V.ATTR_HTTP_USER_AGENT]=l),n){case kn.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case kn.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=jie;var Hie=t=>{let e={};return e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_PEER_NAME]=t[V.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=Hie;var Fie=(t,e)=>{t&&(e[V.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_TCP:e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=Fie;var RG=t=>{let e=String(t).toLowerCase();for(let n of gG.SYNTHETIC_TEST_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of gG.SYNTHETIC_BOT_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},Vie=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[V.ATTR_NET_PEER_IP]=c,i[V.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[V.ATTR_HTTP_STATUS_CODE]=n,i[Pf.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case kn.SemconvStability.STABLE:return a;case kn.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=Vie;var qie=t=>{let e={};return e[V.ATTR_NET_PEER_PORT]=t[V.ATTR_NET_PEER_PORT],e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=qie;var $ie=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=$ie;function ds(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function Yie(t,e){let n=t.headers.forwarded;if(n){for(let s of NG(n))if(s.host)return ds(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?ds(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r,t.headers["x-forwarded-proto"][0]):ds(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?ds(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r[0],t.headers["x-forwarded-proto"][0]):ds(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?ds(o,e):null}function yG(t){let e=t.headers.forwarded;if(e){for(let o of NG(e))if(o.for)return SG(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),SG(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=yG;function SG(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function Wie(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var zie=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=Wie(r,t,n),h,T;if(i!==kn.SemconvStability.OLD){let g=IG(p),R=Yie(t,r),I=yG(t);h={[ae.ATTR_HTTP_REQUEST_METHOD]:g,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(h[ae.ATTR_URL_PATH]=m.pathname),m.search&&(h[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(h[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(h[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==g&&(h[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(h[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=RG(_))}if(i!==kn.SemconvStability.STABLE){let g=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";T={[V.ATTR_HTTP_URL]:m.toString(),[V.ATTR_HTTP_HOST]:d,[V.ATTR_NET_HOST_NAME]:g,[V.ATTR_HTTP_METHOD]:p,[V.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(T[V.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(T[V.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(T[V.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(T[V.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,T),(0,$.setAttributesFromHttpKind)(l,T)}switch(i){case kn.SemconvStability.STABLE:return Object.assign(h,s);case kn.SemconvStability.OLD:return Object.assign(T,s);default:return Object.assign(T,h,s)}};$.getIncomingRequestAttributes=zie;var Kie=t=>{let e={};return e[V.ATTR_HTTP_SCHEME]=t[V.ATTR_HTTP_SCHEME],e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_HOST_NAME]=t[V.ATTR_NET_HOST_NAME],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=Kie;var Qie=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,EG.getRPCMetadata)(Vl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[V.ATTR_NET_HOST_IP]=l,c[V.ATTR_NET_HOST_PORT]=p,c[V.ATTR_NET_PEER_IP]=d,c[V.ATTR_NET_PEER_PORT]=_}switch(c[V.ATTR_HTTP_STATUS_CODE]=o,c[Pf.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===EG.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case kn.SemconvStability.STABLE:return i;case kn.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=Qie;var Xie=t=>{let e={};return e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_NET_HOST_PORT]=t[V.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=Xie;var Jie=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=Jie;function Zie(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&kn.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=Zie;var eae=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function IG(t){if(t==null)return"GET";let e=t.toUpperCase();return eae.has(e)?e:"_OTHER"}function NG(t){try{return Cie(t)}catch{return[]}}});var bG=E(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.HttpInstrumentation=void 0;var oe=(b(),N(v)),_s=Te(),tae=U("url"),nae=sk(),At=ne(),SR=U("events"),Le=(le(),N(Ae)),Ke=OG(),AR=class extends At.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=At.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",nae.VERSION,e),this._semconvStability=(0,At.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&At.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&At.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&At.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&At.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new At.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new At.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(SR.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(SR.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,At.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,_s.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,_s.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),h={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let T=oe.propagation.extract(oe.ROOT_CONTEXT,p),g=r._startHttpSpan(l,_,T),R={type:_s.RPCType.HTTP,span:g};return oe.context.with((0,_s.setRPCMetadata)(oe.trace.setSpan(T,g),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(g,a),r.getConfig().responseHook&&r._callResponseHook(g,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,g,m,h,f)}),c.on(SR.errorMonitor,x=>{I=!0,r._onServerResponseError(g,m,h,f,x)}),(0,At.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(g,m,h,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof tae.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,At.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),F=>{F!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",F)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,_s.hrTime)(),h=(0,Ke.getOutgoingRequestMetricAttributes)(f),T={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let g={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,g),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let F=i[i.length-1];typeof F=="function"&&(i[i.length-1]=oe.context.bind(I,F));let B=(0,At.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,h,T,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,h,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,_s.hrTimeToMilliseconds)((0,_s.hrTimeDuration)(r,(0,_s.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,At.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};Mf.HttpInstrumentation=AR});var CG=E(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.HttpInstrumentation=void 0;var rae=bG();Object.defineProperty(xf,"HttpInstrumentation",{enumerable:!0,get:function(){return rae.HttpInstrumentation}})});var SI=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.AbstractAsyncHooksContextManager=void 0;var Gpe=U("events"),Bpe=["addListener","on","once","prependListener","prependOnceListener"],gI=class{bind(e,n){return n instanceof Gpe.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),Bpe.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners))),n}_patchRemoveListener(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};Vm.AbstractAsyncHooksContextManager=gI});var vH=E(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.AsyncHooksContextManager=void 0;var jpe=(b(),N(v)),Hpe=U("async_hooks"),Fpe=SI(),AI=class extends Fpe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=Hpe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??jpe.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};qm.AsyncHooksContextManager=AI});var LH=E($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.AsyncLocalStorageContextManager=void 0;var Vpe=(b(),N(v)),qpe=U("async_hooks"),$pe=SI(),RI=class extends $pe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new qpe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??Vpe.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};$m.AsyncLocalStorageContextManager=RI});var DH=E(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.AsyncLocalStorageContextManager=Qc.AsyncHooksContextManager=void 0;var Ype=vH();Object.defineProperty(Qc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Ype.AsyncHooksContextManager}});var Wpe=LH();Object.defineProperty(Qc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return Wpe.AsyncLocalStorageContextManager}})});var yI=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc._clearDefaultServiceNameCache=Xc.defaultServiceName=void 0;var xp;function zpe(){if(xp===void 0)try{let t=globalThis.process.argv0;xp=t?`unknown_service:${t}`:"unknown_service"}catch{xp="unknown_service"}return xp}Xc.defaultServiceName=zpe;function Kpe(){xp=void 0}Xc._clearDefaultServiceNameCache=Kpe});var UH=E(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});Ym.isPromiseLike=void 0;var Qpe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Ym.isPromiseLike=Qpe});var OI=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.defaultResource=to.emptyResource=to.resourceFromDetectedResource=to.resourceFromAttributes=void 0;var Lp=(b(),N(v)),II=Te(),ia=(le(),N(Ae)),Xpe=yI(),vp=UH(),Wm=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=wH(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,vp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,vp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=wH(this._rawAttributes),this._schemaUrl=tde(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,vp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Lp.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,vp.isPromiseLike)(r)){Lp.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=nde(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function NI(t,e){return Wm.FromAttributeList(Object.entries(t),e)}to.resourceFromAttributes=NI;function Jpe(t,e){return new Wm(t,e)}to.resourceFromDetectedResource=Jpe;function Zpe(){return NI({})}to.emptyResource=Zpe;function ede(){return NI({[ia.ATTR_SERVICE_NAME]:(0,Xpe.defaultServiceName)(),[ia.ATTR_TELEMETRY_SDK_LANGUAGE]:II.SDK_INFO[ia.ATTR_TELEMETRY_SDK_LANGUAGE],[ia.ATTR_TELEMETRY_SDK_NAME]:II.SDK_INFO[ia.ATTR_TELEMETRY_SDK_NAME],[ia.ATTR_TELEMETRY_SDK_VERSION]:II.SDK_INFO[ia.ATTR_TELEMETRY_SDK_VERSION]})}to.defaultResource=ede;function wH(t){return t.map(([e,n])=>(0,vp.isPromiseLike)(n)?[e,n.catch(r=>{Lp.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function tde(t){if(typeof t=="string"||t===void 0)return t;Lp.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function nde(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;Lp.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var GH=E(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.detectResources=void 0;var kH=(b(),N(v)),bI=OI(),rde=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,bI.resourceFromDetectedResource)(n.detect(t));return kH.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return kH.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,bI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,bI.emptyResource)());zm.detectResources=rde});var jH=E(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.envDetector=void 0;var ode=(b(),N(v)),sde=(le(),N(Ae)),BH=Te(),CI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,BH.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,BH.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){ode.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[sde.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};Km.envDetector=new CI});var Dp=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var Xm=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.execAsync=void 0;var ide=U("child_process"),ade=U("util");Qm.execAsync=ade.promisify(ide.exec)});var HH=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.getMachineId=void 0;var cde=Xm(),ude=(b(),N(v));async function lde(){try{let e=(await(0,cde.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
8
|
+
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ude.diag.debug(`error reading machine id: ${t}`)}}Jm.getMachineId=lde});var FH=E(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getMachineId=void 0;var pde=U("fs"),dde=(b(),N(v));async function _de(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await pde.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){dde.diag.debug(`error reading machine id: ${n}`)}}Zm.getMachineId=_de});var qH=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.getMachineId=void 0;var fde=U("fs"),mde=Xm(),VH=(b(),N(v));async function hde(){try{return(await fde.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){VH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,mde.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){VH.diag.debug(`error reading machine id: ${t}`)}}eh.getMachineId=hde});var YH=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.getMachineId=void 0;var $H=U("process"),Tde=Xm(),Ede=(b(),N(v));async function gde(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";$H.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in $H.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,Tde.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){Ede.diag.debug(`error reading machine id: ${n}`)}}th.getMachineId=gde});var WH=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.getMachineId=void 0;var Sde=(b(),N(v));async function Ade(){Sde.diag.debug("could not read machine-id: unsupported platform")}nh.getMachineId=Ade});var zH=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.getMachineId=void 0;var Rde=U("process"),aa;async function yde(){if(!aa)switch(Rde.platform){case"darwin":aa=(await Promise.resolve().then(()=>K(HH()))).getMachineId;break;case"linux":aa=(await Promise.resolve().then(()=>K(FH()))).getMachineId;break;case"freebsd":aa=(await Promise.resolve().then(()=>K(qH()))).getMachineId;break;case"win32":aa=(await Promise.resolve().then(()=>K(YH()))).getMachineId;break;default:aa=(await Promise.resolve().then(()=>K(WH()))).getMachineId;break}return aa()}rh.getMachineId=yde});var PI=E(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.normalizeType=Jc.normalizeArch=void 0;var Ide=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Jc.normalizeArch=Ide;var Nde=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Jc.normalizeType=Nde});var QH=E(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.hostDetector=void 0;var MI=Dp(),KH=U("os"),Ode=zH(),bde=PI(),xI=class{detect(e){return{attributes:{[MI.ATTR_HOST_NAME]:(0,KH.hostname)(),[MI.ATTR_HOST_ARCH]:(0,bde.normalizeArch)((0,KH.arch)()),[MI.ATTR_HOST_ID]:(0,Ode.getMachineId)()}}}};oh.hostDetector=new xI});var ZH=E(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.osDetector=void 0;var XH=Dp(),JH=U("os"),Cde=PI(),vI=class{detect(e){return{attributes:{[XH.ATTR_OS_TYPE]:(0,Cde.normalizeType)((0,JH.platform)()),[XH.ATTR_OS_VERSION]:(0,JH.release)()}}}};sh.osDetector=new vI});var eF=E(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.processDetector=void 0;var Pde=(b(),N(v)),Ho=Dp(),Mde=U("os"),LI=class{detect(e){let n={[Ho.ATTR_PROCESS_PID]:process.pid,[Ho.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Ho.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Ho.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Ho.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Ho.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Ho.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Ho.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=Mde.userInfo();n[Ho.ATTR_PROCESS_OWNER]=r.username}catch(r){Pde.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};ih.processDetector=new LI});var tF=E(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.serviceInstanceIdDetector=void 0;var xde=Dp(),vde=U("crypto"),DI=class{detect(e){return{attributes:{[xde.ATTR_SERVICE_INSTANCE_ID]:(0,vde.randomUUID)()}}}};ah.serviceInstanceIdDetector=new DI});var nF=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.serviceInstanceIdDetector=no.processDetector=no.osDetector=no.hostDetector=void 0;var Lde=QH();Object.defineProperty(no,"hostDetector",{enumerable:!0,get:function(){return Lde.hostDetector}});var Dde=ZH();Object.defineProperty(no,"osDetector",{enumerable:!0,get:function(){return Dde.osDetector}});var Ude=eF();Object.defineProperty(no,"processDetector",{enumerable:!0,get:function(){return Ude.processDetector}});var wde=tF();Object.defineProperty(no,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return wde.serviceInstanceIdDetector}})});var rF=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.serviceInstanceIdDetector=ro.processDetector=ro.osDetector=ro.hostDetector=void 0;var ch=nF();Object.defineProperty(ro,"hostDetector",{enumerable:!0,get:function(){return ch.hostDetector}});Object.defineProperty(ro,"osDetector",{enumerable:!0,get:function(){return ch.osDetector}});Object.defineProperty(ro,"processDetector",{enumerable:!0,get:function(){return ch.processDetector}});Object.defineProperty(ro,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ch.serviceInstanceIdDetector}})});var oF=E(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.noopDetector=Zc.NoopDetector=void 0;var uh=class{detect(){return{attributes:{}}}};Zc.NoopDetector=uh;Zc.noopDetector=new uh});var sF=E(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.noopDetector=Nn.serviceInstanceIdDetector=Nn.processDetector=Nn.osDetector=Nn.hostDetector=Nn.envDetector=void 0;var kde=jH();Object.defineProperty(Nn,"envDetector",{enumerable:!0,get:function(){return kde.envDetector}});var lh=rF();Object.defineProperty(Nn,"hostDetector",{enumerable:!0,get:function(){return lh.hostDetector}});Object.defineProperty(Nn,"osDetector",{enumerable:!0,get:function(){return lh.osDetector}});Object.defineProperty(Nn,"processDetector",{enumerable:!0,get:function(){return lh.processDetector}});Object.defineProperty(Nn,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return lh.serviceInstanceIdDetector}});var Gde=oF();Object.defineProperty(Nn,"noopDetector",{enumerable:!0,get:function(){return Gde.noopDetector}})});var wI=E(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.defaultServiceName=Fe.emptyResource=Fe.defaultResource=Fe.resourceFromAttributes=Fe.serviceInstanceIdDetector=Fe.processDetector=Fe.osDetector=Fe.hostDetector=Fe.envDetector=Fe.detectResources=void 0;var Bde=GH();Object.defineProperty(Fe,"detectResources",{enumerable:!0,get:function(){return Bde.detectResources}});var Up=sF();Object.defineProperty(Fe,"envDetector",{enumerable:!0,get:function(){return Up.envDetector}});Object.defineProperty(Fe,"hostDetector",{enumerable:!0,get:function(){return Up.hostDetector}});Object.defineProperty(Fe,"osDetector",{enumerable:!0,get:function(){return Up.osDetector}});Object.defineProperty(Fe,"processDetector",{enumerable:!0,get:function(){return Up.processDetector}});Object.defineProperty(Fe,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Up.serviceInstanceIdDetector}});var UI=OI();Object.defineProperty(Fe,"resourceFromAttributes",{enumerable:!0,get:function(){return UI.resourceFromAttributes}});Object.defineProperty(Fe,"defaultResource",{enumerable:!0,get:function(){return UI.defaultResource}});Object.defineProperty(Fe,"emptyResource",{enumerable:!0,get:function(){return UI.emptyResource}});var jde=yI();Object.defineProperty(Fe,"defaultServiceName",{enumerable:!0,get:function(){return jde.defaultServiceName}})});var iF=E(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.ExceptionEventName=void 0;ph.ExceptionEventName="exception"});var aF=E(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.SpanImpl=void 0;var wt=(b(),N(v)),kt=Te(),ca=(le(),N(Ae)),Hde=iF(),kI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:wt.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=kt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+kt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return wt.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,kt.isAttributeValue)(n))return wt.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return wt.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&wt.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,kt.isTimeInput)(n)&&((0,kt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,kt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&wt.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,kt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===wt.SpanStatusCode.UNSET)return this;if(this.status.code===wt.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===wt.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&wt.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){wt.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,kt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(wt.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&&wt.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&wt.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(e){if(typeof e=="number"&&e<=kt.otperformance.now())return(0,kt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,kt.millisToHrTime)(e);if(e instanceof Date)return(0,kt.millisToHrTime)(e.getTime());if((0,kt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,kt.millisToHrTime)(Date.now());let n=kt.otperformance.now()-this._performanceStartTime;return(0,kt.addHrTimes)(this.startTime,(0,kt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[ca.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[ca.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[ca.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[ca.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[ca.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[ca.ATTR_EXCEPTION_TYPE]||r[ca.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Hde.ExceptionEventName,r,n):wt.diag.warn(`Failed to record an exception ${e}`)}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 e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);wt.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(wt.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};dh.SpanImpl=kI});var eu=E(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.SamplingDecision=void 0;var Fde;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Fde=wp.SamplingDecision||(wp.SamplingDecision={}))});var fh=E(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.AlwaysOffSampler=void 0;var Vde=eu(),GI=class{shouldSample(){return{decision:Vde.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};_h.AlwaysOffSampler=GI});var hh=E(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.AlwaysOnSampler=void 0;var qde=eu(),BI=class{shouldSample(){return{decision:qde.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};mh.AlwaysOnSampler=BI});var FI=E(Eh=>{"use strict";Object.defineProperty(Eh,"__esModule",{value:!0});Eh.ParentBasedSampler=void 0;var Th=(b(),N(v)),$de=Te(),cF=fh(),jI=hh(),HI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,$de.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new jI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new jI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new cF.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new jI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new cF.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=Th.trace.getSpanContext(e);return!a||!(0,Th.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&Th.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&Th.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};Eh.ParentBasedSampler=HI});var qI=E(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.TraceIdRatioBasedSampler=void 0;var Yde=(b(),N(v)),uF=eu(),VI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,Yde.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?uF.SamplingDecision.RECORD_AND_SAMPLED:uF.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};gh.TraceIdRatioBasedSampler=VI});var WI=E(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.buildSamplerFromEnv=tu.loadDefaultConfig=void 0;var YI=(b(),N(v)),oo=Te(),lF=fh(),$I=hh(),Sh=FI(),pF=qI(),so;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(so||(so={}));var Ah=1;function Wde(){return{sampler:_F(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}tu.loadDefaultConfig=Wde;function _F(){let t=(0,oo.getStringFromEnv)("OTEL_TRACES_SAMPLER")??so.ParentBasedAlwaysOn;switch(t){case so.AlwaysOn:return new $I.AlwaysOnSampler;case so.AlwaysOff:return new lF.AlwaysOffSampler;case so.ParentBasedAlwaysOn:return new Sh.ParentBasedSampler({root:new $I.AlwaysOnSampler});case so.ParentBasedAlwaysOff:return new Sh.ParentBasedSampler({root:new lF.AlwaysOffSampler});case so.TraceIdRatio:return new pF.TraceIdRatioBasedSampler(dF());case so.ParentBasedTraceIdRatio:return new Sh.ParentBasedSampler({root:new pF.TraceIdRatioBasedSampler(dF())});default:return YI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${so.ParentBasedAlwaysOn}".`),new Sh.ParentBasedSampler({root:new $I.AlwaysOnSampler})}}tu.buildSamplerFromEnv=_F;function dF(){let t=(0,oo.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(YI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Ah}.`),Ah):t<0||t>1?(YI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${Ah}.`),Ah):t}});var zI=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.reconfigureLimits=ir.mergeConfig=ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var fF=WI(),Rh=Te();ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function zde(t){let e={sampler:(0,fF.buildSamplerFromEnv)()},n=(0,fF.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}ir.mergeConfig=zde;function Kde(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,Rh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,Rh.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,Rh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Rh.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}ir.reconfigureLimits=Kde});var mF=E(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.BatchSpanProcessorBase=void 0;var nu=(b(),N(v)),Fo=Te(),KI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Fo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(nu.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(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&nu.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&nu.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(nu.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);nu.context.with((0,Fo.suppressTracing)(nu.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Fo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Fo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Fo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};yh.BatchSpanProcessorBase=KI});var hF=E(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.BatchSpanProcessor=void 0;var Qde=mF(),QI=class extends Qde.BatchSpanProcessorBase{onShutdown(){}};Ih.BatchSpanProcessor=QI});var gF=E(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.RandomIdGenerator=void 0;var Xde=8,EF=16,XI=class{generateTraceId=TF(EF);generateSpanId=TF(Xde)};Oh.RandomIdGenerator=XI;var Nh=Buffer.allocUnsafe(EF);function TF(t){return function(){for(let n=0;n<t/4;n++)Nh.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(Nh[n]>0);n++)n===t-1&&(Nh[t-1]=1);return Nh.toString("hex",0,t)}}});var SF=E(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.RandomIdGenerator=ru.BatchSpanProcessor=void 0;var Jde=hF();Object.defineProperty(ru,"BatchSpanProcessor",{enumerable:!0,get:function(){return Jde.BatchSpanProcessor}});var Zde=gF();Object.defineProperty(ru,"RandomIdGenerator",{enumerable:!0,get:function(){return Zde.RandomIdGenerator}})});var JI=E(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.RandomIdGenerator=ou.BatchSpanProcessor=void 0;var AF=SF();Object.defineProperty(ou,"BatchSpanProcessor",{enumerable:!0,get:function(){return AF.BatchSpanProcessor}});Object.defineProperty(ou,"RandomIdGenerator",{enumerable:!0,get:function(){return AF.RandomIdGenerator}})});var RF=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.METRIC_OTEL_SDK_SPAN_STARTED=io.METRIC_OTEL_SDK_SPAN_LIVE=io.ATTR_OTEL_SPAN_SAMPLING_RESULT=io.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;io.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";io.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";io.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";io.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var yF=E(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.TracerMetrics=void 0;var bh=eu(),kp=RF(),ZI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(kp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(kp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=t_e(n);if(this.startedSpans.add(1,{[kp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:e_e(e),[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===bh.SamplingDecision.NOT_RECORD)return()=>{};let o={[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};Ch.TracerMetrics=ZI;function e_e(t){return t?t.isRemote?"remote":"local":"none"}function t_e(t){switch(t){case bh.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case bh.SamplingDecision.RECORD:return"RECORD_ONLY";case bh.SamplingDecision.NOT_RECORD:return"DROP"}}});var IF=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.VERSION=void 0;Ph.VERSION="2.6.1"});var NF=E(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.Tracer=void 0;var Nt=(b(),N(v)),Mh=Te(),n_e=aF(),r_e=zI(),o_e=JI(),s_e=yF(),i_e=IF(),eN=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,r_e.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new o_e.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",i_e.VERSION):Nt.createNoopMeter();this._tracerMetrics=new s_e.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,Mh.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,Mh.sanitizeAttributes)(I.attributes)})),_=(0,Mh.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let h=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,T={traceId:c,spanId:i,traceFlags:h,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(T);let g=(0,Mh.sanitizeAttributes)(Object.assign(_,f.attributes));return new n_e.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:T,name:e,kind:p,links:d,parentSpanContext:a,attributes:g,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};xh.Tracer=eN});var OF=E(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.MultiSpanProcessor=void 0;var a_e=Te(),tN=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,a_e.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};vh.MultiSpanProcessor=tN});var bF=E(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.BasicTracerProvider=ua.ForceFlushState=void 0;var c_e=Te(),u_e=wI(),l_e=NF(),p_e=WI(),d_e=OF(),__e=zI(),su;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(su=ua.ForceFlushState||(ua.ForceFlushState={}));var nN=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,c_e.merge)({},(0,p_e.loadDefaultConfig)(),(0,__e.reconfigureLimits)(e));this._resource=n.resource??(0,u_e.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new d_e.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new l_e.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=su.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==su.timeout&&(s=su.resolved,o(s))}).catch(a=>{clearTimeout(i),s=su.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==su.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ua.BasicTracerProvider=nN});var CF=E(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.ConsoleSpanExporter=void 0;var rN=Te(),oN=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,rN.hrTimeToMicroseconds)(e.startTime),duration:(0,rN.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:rN.ExportResultCode.SUCCESS})}};Lh.ConsoleSpanExporter=oN});var MF=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.InMemorySpanExporter=void 0;var PF=Te(),sN=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:PF.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:PF.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};Dh.InMemorySpanExporter=sN});var xF=E(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.SimpleSpanProcessor=void 0;var f_e=(b(),N(v)),Uh=Te(),iN=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Uh.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(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&f_e.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,Uh.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await Uh.internal._export(this._exporter,[e]);if(n.code!==Uh.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};wh.SimpleSpanProcessor=iN});var vF=E(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.NoopSpanProcessor=void 0;var aN=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};kh.NoopSpanProcessor=aN});var cN=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var m_e=bF();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return m_e.BasicTracerProvider}});var LF=JI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return LF.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return LF.RandomIdGenerator}});var h_e=CF();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return h_e.ConsoleSpanExporter}});var T_e=MF();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return T_e.InMemorySpanExporter}});var E_e=xF();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return E_e.SimpleSpanProcessor}});var g_e=vF();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return g_e.NoopSpanProcessor}});var S_e=fh();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return S_e.AlwaysOffSampler}});var A_e=hh();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return A_e.AlwaysOnSampler}});var R_e=FI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return R_e.ParentBasedSampler}});var y_e=qI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return y_e.TraceIdRatioBasedSampler}});var I_e=eu();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return I_e.SamplingDecision}})});var iq=E(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.PACKAGE_NAME=lu.PACKAGE_VERSION=void 0;lu.PACKAGE_VERSION="0.24.0";lu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var cq=E(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.UndiciInstrumentation=void 0;var wN=U("diagnostics_channel"),Wme=U("url"),Yp=ne(),qn=(b(),N(v)),Xh=Te(),ot=(le(),N(Ae)),aq=iq(),kN=class extends Yp.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(aq.PACKAGE_NAME,aq.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.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(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:qn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)wN.subscribe?.(e,n),i=()=>wN.unsubscribe?.(e,n);else{let a=wN.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
|
|
9
|
+
`);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,Yp.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),B=>B&&this._diag.error("caught ignoreRequestHook error: ",B),!0))return;let s=(0,Xh.hrTime)(),i;try{i=new Wme.URL(e.path,e.origin)}catch(B){this._diag.warn("could not determine url.full:",B);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),l={[ot.ATTR_HTTP_REQUEST_METHOD]:c,[ot.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[ot.ATTR_URL_FULL]:i.toString(),[ot.ATTR_URL_PATH]:i.pathname,[ot.ATTR_URL_QUERY]:i.search,[ot.ATTR_URL_SCHEME]:a},p={https:"443",http:"80"},d=i.hostname,_=i.port||p[a];l[ot.ATTR_SERVER_ADDRESS]=d,_&&!isNaN(Number(_))&&(l[ot.ATTR_SERVER_PORT]=Number(_));let m=this.parseRequestHeaders(e).get("user-agent");if(m){let B=Array.isArray(m)?m[m.length-1]:m;l[ot.ATTR_USER_AGENT_ORIGINAL]=B}let h=(0,Yp.safeExecuteInTheMiddle)(()=>n.startSpanHook?.(e),B=>B&&this._diag.error("caught startSpanHook error: ",B),!0);h&&Object.entries(h).forEach(([B,se])=>{l[B]=se});let T=qn.context.active(),g=qn.trace.getSpan(T),R;n.requireParentforSpans&&(!g||!qn.trace.isSpanContextValid(g.spanContext()))?R=qn.trace.wrapSpanContext(qn.INVALID_SPAN_CONTEXT):R=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:qn.SpanKind.CLIENT,attributes:l},T),(0,Yp.safeExecuteInTheMiddle)(()=>n.requestHook?.(R,e),B=>B&&this._diag.error("caught requestHook error: ",B),!0);let I=qn.trace.setSpan(qn.context.active(),R),x={};qn.propagation.inject(I,x);let F=Object.entries(x);for(let B=0;B<F.length;B++){let[se,ve]=F[B];typeof e.addHeader=="function"?e.addHeader(se,ve):typeof e.headers=="string"?e.headers+=`${se}: ${ve}\r
|
|
10
|
+
`:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,Yp.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?qn.SpanStatusCode.ERROR:qn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:qn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,Xh.hrTimeToMilliseconds)((0,Xh.hrTimeDuration)(n,(0,Xh.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};Jh.UndiciInstrumentation=kN});var uq=E(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.UndiciInstrumentation=void 0;var zme=cq();Object.defineProperty(Zh,"UndiciInstrumentation",{enumerable:!0,get:function(){return zme.UndiciInstrumentation}})});var eT=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.ExpressLayerType=void 0;var ehe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(ehe=Wp.ExpressLayerType||(Wp.ExpressLayerType={}))});var tT=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.AttributeNames=void 0;var the;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(the=zp.AttributeNames||(zp.AttributeNames={}))});var GN=E(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu._LAYERS_STORE_PROPERTY=pu.kLayerPatched=void 0;pu.kLayerPatched=Symbol("express-layer-patched");pu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var hq=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var BN=eT(),du=tT(),la=GN(),nhe=(t,e)=>(Array.isArray(t[la._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,la._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[la._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=nhe;var rhe=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=rhe;var ohe=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[du.AttributeNames.EXPRESS_NAME]:o,[du.AttributeNames.EXPRESS_TYPE]:BN.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[du.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[du.AttributeNames.EXPRESS_TYPE]:BN.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[du.AttributeNames.EXPRESS_NAME]:e.name,[du.AttributeNames.EXPRESS_TYPE]:BN.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=ohe;var she=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},ihe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(she(t,r))return!0}catch{}return!1};st.isLayerIgnored=ihe;var ahe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=ahe;var che=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>fq(n)||"").join(","):fq(e)};st.getLayerPath=che;var fq=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function mq(t){let n=(Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=mq;function uhe(t){let e=Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=mq(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||lhe(r))?r:void 0}st.getActualMatchedRoute=uhe;function lhe(t){return t.includes(":")||t.includes("*")}});var Tq=E(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.PACKAGE_NAME=_u.PACKAGE_VERSION=void 0;_u.PACKAGE_VERSION="0.62.0";_u.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var Rq=E(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});rT.ExpressInstrumentation=void 0;var Eq=Te(),On=(b(),N(v)),gq=eT(),Sq=tT(),uo=hq(),Aq=Tq(),fu=ne(),phe=(le(),N(Ae)),nT=GN(),jN=class extends fu.InstrumentationBase{constructor(e={}){super(Aq.PACKAGE_NAME,Aq.PACKAGE_VERSION,e)}init(){return[new fu.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,fu.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,fu.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,fu.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,uo.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[nT.kLayerPatched]!==!0&&(e[nT.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,uo.storeLayerPath)(i,n),l=(0,uo.getConstructedRoute)(i),p=(0,uo.getActualMatchedRoute)(i),d={[phe.ATTR_HTTP_ROUTE]:p},_=(0,uo.getLayerMetadata)(l,e,n),f=_.attributes[Sq.AttributeNames.EXPRESS_TYPE],m=(0,Eq.getRPCMetadata)(On.context.active());if(m?.type===Eq.RPCType.HTTP&&(m.route=p),(0,uo.isLayerIgnored)(_.name,f,r.getConfig()))return f===gq.ExpressLayerType.MIDDLEWARE&&i[nT._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(On.trace.getSpan(On.context.active())===void 0)return o.apply(this,arguments);let h=r._getSpanName({request:i,layerType:f,route:l},_.name),T=r.tracer.startSpan(h,{attributes:Object.assign(d,_.attributes)}),g=On.context.active(),R=On.trace.setSpan(g,T),{requestHook:I}=r.getConfig();I&&(0,fu.safeExecuteInTheMiddle)(()=>I(T,{request:i,layerType:f,route:l}),ve=>{ve&&On.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[Sq.AttributeNames.EXPRESS_TYPE]===gq.ExpressLayerType.ROUTER&&(T.end(),x=!0,R=g);let F=()=>{x===!1&&(x=!0,T.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],on=![void 0,null,"route","router"].includes(ve);if(!x&&on){let[Ya,Wa]=(0,uo.asErrorAndMessage)(ve);T.recordException(Ya),T.setStatus({code:On.SpanStatusCode.ERROR,message:Wa})}x===!1&&(x=!0,i.res?.removeListener("finish",F),T.end()),!(i.route&&on)&&c&&i[nT._LAYERS_STORE_PROPERTY].pop();let Io=B[se],ss=On.context.active(),Ii=On.trace.getSpan(g),Tt=Ii?On.trace.setSpan(ss,Ii):ss;return On.context.bind(Tt,Io).apply(this,arguments)});try{return On.context.bind(R,o).apply(this,arguments)}catch(ve){let[on,Io]=(0,uo.asErrorAndMessage)(ve);throw T.recordException(on),T.setStatus({code:On.SpanStatusCode.ERROR,message:Io}),ve}finally{x||a.once("finish",F)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return On.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};rT.ExpressInstrumentation=jN});var yq=E(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.AttributeNames=Hs.ExpressLayerType=Hs.ExpressInstrumentation=void 0;var dhe=Rq();Object.defineProperty(Hs,"ExpressInstrumentation",{enumerable:!0,get:function(){return dhe.ExpressInstrumentation}});var _he=eT();Object.defineProperty(Hs,"ExpressLayerType",{enumerable:!0,get:function(){return _he.ExpressLayerType}});var fhe=tT();Object.defineProperty(Hs,"AttributeNames",{enumerable:!0,get:function(){return fhe.AttributeNames}})});var Cq=E(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.SeverityNumber=void 0;var Ehe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Ehe=Kp.SeverityNumber||(Kp.SeverityNumber={}))});var iT=E(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.NOOP_LOGGER=mu.NoopLogger=void 0;var sT=class{emit(e){}};mu.NoopLogger=sT;mu.NOOP_LOGGER=new sT});var Pq=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.API_BACKWARDS_COMPATIBILITY_VERSION=lo.makeGetter=lo._global=lo.GLOBAL_LOGS_API_KEY=void 0;lo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");lo._global=globalThis;function ghe(t,e,n){return r=>r===t?e:n}lo.makeGetter=ghe;lo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var HN=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.NOOP_LOGGER_PROVIDER=hu.NoopLoggerProvider=void 0;var She=iT(),aT=class{getLogger(e,n,r){return new She.NoopLogger}};hu.NoopLoggerProvider=aT;hu.NOOP_LOGGER_PROVIDER=new aT});var Mq=E(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.ProxyLogger=void 0;var Ahe=iT(),FN=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ahe.NOOP_LOGGER}};cT.ProxyLogger=FN});var xq=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.ProxyLoggerProvider=void 0;var Rhe=HN(),yhe=Mq(),VN=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new yhe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Rhe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};uT.ProxyLoggerProvider=VN});var Lq=E(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});lT.LogsAPI=void 0;var ar=Pq(),Ihe=HN(),vq=xq(),qN=class t{constructor(){this._proxyLoggerProvider=new vq.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ar._global[ar.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ar._global[ar.GLOBAL_LOGS_API_KEY]=(0,ar.makeGetter)(ar.API_BACKWARDS_COMPATIBILITY_VERSION,e,Ihe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=ar._global[ar.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ar._global,ar.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete ar._global[ar.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new vq.ProxyLoggerProvider}};lT.LogsAPI=qN});var $N=E(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.logs=po.NoopLogger=po.NOOP_LOGGER=po.SeverityNumber=void 0;var Nhe=Cq();Object.defineProperty(po,"SeverityNumber",{enumerable:!0,get:function(){return Nhe.SeverityNumber}});var Dq=iT();Object.defineProperty(po,"NOOP_LOGGER",{enumerable:!0,get:function(){return Dq.NOOP_LOGGER}});Object.defineProperty(po,"NoopLogger",{enumerable:!0,get:function(){return Dq.NoopLogger}});var Ohe=Lq();po.logs=Ohe.LogsAPI.getInstance()});var Uq=E(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.disableInstrumentations=Tu.enableInstrumentations=void 0;function bhe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}Tu.enableInstrumentations=bhe;function Che(t){t.forEach(e=>e.disable())}Tu.disableInstrumentations=Che});var Gq=E(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});pT.registerInstrumentations=void 0;var wq=(b(),N(v)),Phe=$N(),kq=Uq();function Mhe(t){let e=t.tracerProvider||wq.trace.getTracerProvider(),n=t.meterProvider||wq.metrics.getMeterProvider(),r=t.loggerProvider||Phe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,kq.enableInstrumentations)(o,e,n,r),()=>{(0,kq.disableInstrumentations)(o)}}pT.registerInstrumentations=Mhe});var Wq=E(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});dT.satisfies=void 0;var KN=(b(),N(v)),Vq=/^(?: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-]+)*))?$/,xhe=/^(?<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-]+)*))?$/,vhe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Lhe(t,e,n){if(!Dhe(t))return KN.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Ghe(t);if(!r)return!1;let o=[],s=qq(r,e,o,n);return s&&!n?.includePrerelease?whe(r,o):s}dT.satisfies=Lhe;function Dhe(t){return typeof t=="string"&&Vq.test(t)}function qq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(YN(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=sTe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!YN(t,s,n,r))return!1;return!0}return YN(t,e,n,r)}function YN(t,e,n,r){if(e=khe(e,r),e.includes(" "))return qq(t,e,n,r);{let o=Bhe(e);return n.push(o),Uhe(t,o)}}function Uhe(t,e){if(e.invalid)return!1;if(!e.version||zN(e.version))return!0;let n=jq(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=jq(r,o)}return vhe[e.op]?.includes(n)}function whe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function khe(t,e){return t=t.trim(),t=rTe(t,e),t=nTe(t),t=oTe(t,e),t=t.trim(),t}function _n(t){return!t||t.toLowerCase()==="x"||t==="*"}function Ghe(t){let e=t.match(Vq);if(!e){KN.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Bhe(t){if(!t)return{};let e=t.match(xhe);if(!e)return KN.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function zN(t){return t==="*"||t==="x"||t==="X"}function Bq(t){let e=parseInt(t,10);return isNaN(e)?t:e}function jhe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Hhe(t,e){if(zN(t)||zN(e))return 0;let[n,r]=jhe(Bq(t),Bq(e));return n>r?1:n<r?-1:0}function jq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Hhe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var $q="[a-zA-Z0-9-]",Yq="0|[1-9]\\d*",Fhe=`\\d*[a-zA-Z-]${$q}*`,Vhe="((?:<|>)?=?)",Hq=`(?:${Yq}|${Fhe})`,qhe=`(?:-(${Hq}(?:\\.${Hq})*))`,Fq=`${$q}+`,$he=`(?:\\+(${Fq}(?:\\.${Fq})*))`,WN=`${Yq}|x|X|\\*`,Qp=`[v=\\s]*(${WN})(?:\\.(${WN})(?:\\.(${WN})(?:${qhe})?${$he}?)?)?`,Yhe=`^${Vhe}\\s*${Qp}$`,Whe=new RegExp(Yhe),zhe=`^\\s*(${Qp})\\s+-\\s+(${Qp})\\s*$`,Khe=new RegExp(zhe),Qhe="(?:~>?)",Xhe=`^${Qhe}${Qp}$`,Jhe=new RegExp(Xhe),Zhe="(?:\\^)",eTe=`^${Zhe}${Qp}$`,tTe=new RegExp(eTe);function nTe(t){let e=Jhe;return t.replace(e,(n,r,o,s,i)=>{let a;return _n(r)?a="":_n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:_n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function rTe(t,e){let n=tTe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return _n(s)?l="":_n(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:_n(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function oTe(t,e){let n=Whe;return t.replace(n,(r,o,s,i,a,c)=>{let l=_n(s),p=l||_n(i),d=p||_n(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function sTe(t,e){let n=Khe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(_n(s)?o="":_n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:_n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,_n(d)?p="":_n(_)?p=`<${+d+1}.0.0-0`:_n(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var QN=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.massUnwrap=Gt.unwrap=Gt.massWrap=Gt.wrap=void 0;var fn=console.error.bind(console);function Xp(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var iTe=(t,e,n)=>{if(!t||!t[e]){fn("no original function "+String(e)+" to wrap");return}if(!n){fn("no wrapper function"),fn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){fn("original object and wrapper must be functions");return}let o=n(r,e);return Xp(o,"__original",r),Xp(o,"__unwrap",()=>{t[e]===o&&Xp(t,e,r)}),Xp(o,"__wrapped",!0),Xp(t,e,o),o};Gt.wrap=iTe;var aTe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Gt.wrap)(r,o,n)})})};Gt.massWrap=aTe;var cTe=(t,e)=>{if(!t||!t[e]){fn("no function to unwrap."),fn(new Error().stack);return}let n=t[e];if(!n.__unwrap)fn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Gt.unwrap=cTe;var uTe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Gt.unwrap)(n,r)})})};Gt.massUnwrap=uTe;function Jp(t){t&&t.logger&&(typeof t.logger!="function"?fn("new logger isn't a function, not replacing"):fn=t.logger)}Gt.default=Jp;Jp.wrap=Gt.wrap;Jp.massWrap=Gt.massWrap;Jp.unwrap=Gt.unwrap;Jp.massUnwrap=Gt.massUnwrap});var zq=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.InstrumentationAbstract=void 0;var XN=(b(),N(v)),lTe=$N(),_T=QN(),JN=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=XN.diag.createComponentLogger({namespace:e}),this._tracer=XN.trace.getTracer(e,n),this._meter=XN.metrics.getMeter(e,n),this._logger=lTe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=_T.wrap;_unwrap=_T.unwrap;_massWrap=_T.massWrap;_massUnwrap=_T.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};fT.InstrumentationAbstract=JN});var Kq=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ModuleNameTrie=Fs.ModuleNameSeparator=void 0;Fs.ModuleNameSeparator="/";var mT=class{hooks=[];children=new Map},ZN=class{_trie=new mT;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Fs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new mT,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(Fs.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};Fs.ModuleNameTrie=ZN});var Xq=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.RequireInTheMiddleSingleton=void 0;var pTe=ki(),Qq=U("path"),eO=Kq(),dTe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),tO=class t{_moduleNameTrie=new eO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new pTe.Hook(null,{internals:!0},(e,n,r)=>{let o=_Te(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return dTe?new t:this._instance=this._instance??new t}};hT.RequireInTheMiddleSingleton=tO;function _Te(t){return Qq.sep!==eO.ModuleNameSeparator?t.split(Qq.sep).join(eO.ModuleNameSeparator):t}});var n$=E(Zp=>{var Jq=[],nO=new WeakMap,Zq=new WeakMap,e$=new Map,t$=[],fTe={set(t,e,n){let r=nO.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Zq.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=nO.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function mTe(t,e,n,r,o){e$.set(t,o),nO.set(e,n),Zq.set(e,r);let s=new Proxy(e,fTe);Jq.forEach(i=>i(t,s,o)),t$.push([t,s,o])}Zp.register=mTe;Zp.importHooks=Jq;Zp.specifiers=e$;Zp.toHook=t$});var iO=E((PKe,gu)=>{var r$=U("path"),hTe=Ef(),{fileURLToPath:TTe}=U("url"),{MessageChannel:ETe}=U("worker_threads"),{isBuiltin:rO}=U("module");rO||(rO=()=>!0);var{importHooks:oO,specifiers:gTe,toHook:STe}=n$();function o$(t){oO.push(t),STe.forEach(([e,n,r])=>t(e,n,r))}function s$(t){let e=oO.indexOf(t);e>-1&&oO.splice(e,1)}function Eu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var sO;function ATe(){let{port1:t,port2:e}=new ETe,n=0,r;sO=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function ed(t,e,n){if(!(this instanceof ed))return new ed(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;sO&&Array.isArray(t)&&sO(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);rO(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=TTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=hTe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)Eu(n,s,l,void 0);else if(d===o){if(!p)Eu(n,s,o,p);else if(p.endsWith(gTe.get(a)))Eu(n,s,o,p);else if(r){let _=o+r$.sep+r$.relative(p,l);Eu(n,s,_,p)}}else d===i&&Eu(n,s,i,p);else Eu(n,s,o,p)},o$(this._iitmHook)}ed.prototype.unhook=function(){s$(this._iitmHook)};gu.exports=ed;gu.exports.Hook=ed;gu.exports.addHook=o$;gu.exports.removeHook=s$;gu.exports.createAddHookMessageChannel=ATe});var aO=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isWrapped=Vs.safeExecuteInTheMiddleAsync=Vs.safeExecuteInTheMiddle=void 0;function RTe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddle=RTe;async function yTe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddleAsync=yTe;function ITe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Vs.isWrapped=ITe});var c$=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.InstrumentationBase=void 0;var td=U("path"),i$=U("util"),NTe=Wq(),cO=QN(),OTe=zq(),bTe=Xq(),CTe=iO(),nd=(b(),N(v)),PTe=ki(),MTe=U("fs"),xTe=aO(),uO=class extends OTe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=bTe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,xTe.isWrapped)(e[n])&&this._unwrap(e,n),i$.types.isProxy(e)){let o=(0,cO.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,cO.wrap)(e,n,r)};_unwrap=(e,n)=>i$.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,cO.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,MTe.readFileSync)(td.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{nd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return a$(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=td.normalize(r);return i.filter(l=>l.name===a&&a$(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&td.isAbsolute(a)){let l=td.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=td.isAbsolute(e.name)?new PTe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new CTe.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};TT.InstrumentationBase=uO;function a$(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,NTe.satisfies)(e,r,{includePrerelease:n}))}});var u$=E(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});ET.normalize=void 0;var vTe=U("path");Object.defineProperty(ET,"normalize",{enumerable:!0,get:function(){return vTe.normalize}})});var l$=E(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.normalize=Su.InstrumentationBase=void 0;var LTe=c$();Object.defineProperty(Su,"InstrumentationBase",{enumerable:!0,get:function(){return LTe.InstrumentationBase}});var DTe=u$();Object.defineProperty(Su,"normalize",{enumerable:!0,get:function(){return DTe.normalize}})});var lO=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.normalize=Au.InstrumentationBase=void 0;var p$=l$();Object.defineProperty(Au,"InstrumentationBase",{enumerable:!0,get:function(){return p$.InstrumentationBase}});Object.defineProperty(Au,"normalize",{enumerable:!0,get:function(){return p$.normalize}})});var d$=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.InstrumentationNodeModuleDefinition=void 0;var pO=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};gT.InstrumentationNodeModuleDefinition=pO});var _$=E(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0});ST.InstrumentationNodeModuleFile=void 0;var UTe=lO(),dO=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,UTe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};ST.InstrumentationNodeModuleFile=dO});var f$=E(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.semconvStabilityFromStr=pa.SemconvStability=void 0;var AT;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(AT=pa.SemconvStability||(pa.SemconvStability={}));function wTe(t,e){let n=AT.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=AT.DUPLICATE;break}else o.toLowerCase()===t&&(n=AT.STABLE);return n}pa.semconvStabilityFromStr=wTe});var h$=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var kTe=Gq();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return kTe.registerInstrumentations}});var GTe=lO();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return GTe.InstrumentationBase}});var BTe=d$();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return BTe.InstrumentationNodeModuleDefinition}});var jTe=_$();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return jTe.InstrumentationNodeModuleFile}});var _O=aO();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return _O.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return _O.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return _O.safeExecuteInTheMiddleAsync}});var m$=f$();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return m$.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return m$.semconvStabilityFromStr}})});var T$=E((jKe,HTe)=>{HTe.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"}}});var g$=E(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.range=da.balanced=void 0;var FTe=(t,e,n)=>{let r=t instanceof RegExp?E$(t,n):t,o=e instanceof RegExp?E$(e,n):e,s=r!==null&&o!=null&&(0,da.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};da.balanced=FTe;var E$=(t,e)=>{let n=e.match(t);return n?n[0]:null},VTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};da.range=VTe});var O$=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.EXPANSION_MAX=void 0;Ru.expand=nEe;var S$=g$(),A$="\0SLASH"+Math.random()+"\0",R$="\0OPEN"+Math.random()+"\0",mO="\0CLOSE"+Math.random()+"\0",y$="\0COMMA"+Math.random()+"\0",I$="\0PERIOD"+Math.random()+"\0",qTe=new RegExp(A$,"g"),$Te=new RegExp(R$,"g"),YTe=new RegExp(mO,"g"),WTe=new RegExp(y$,"g"),zTe=new RegExp(I$,"g"),KTe=/\\\\/g,QTe=/\\{/g,XTe=/\\}/g,JTe=/\\,/g,ZTe=/\\\./g;Ru.EXPANSION_MAX=1e5;function fO(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function eEe(t){return t.replace(KTe,A$).replace(QTe,R$).replace(XTe,mO).replace(JTe,y$).replace(ZTe,I$)}function tEe(t){return t.replace(qTe,"\\").replace($Te,"{").replace(YTe,"}").replace(WTe,",").replace(zTe,".")}function N$(t){if(!t)return[""];let e=[],n=(0,S$.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=N$(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function nEe(t,e={}){if(!t)return[];let{max:n=Ru.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),rd(eEe(t),n,!0).map(tEe)}function rEe(t){return"{"+t+"}"}function oEe(t){return/^-?0\d/.test(t)}function sEe(t,e){return t<=e}function iEe(t,e){return t>=e}function rd(t,e,n){let r=[],o=(0,S$.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?rd(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+mO+o.post,rd(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=N$(o.body),d.length===1&&d[0]!==void 0&&(d=rd(d[0],e,!1).map(rEe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=fO(d[0]),m=fO(d[1]),h=Math.max(d[0].length,d[1].length),T=d.length===3&&d[2]!==void 0?Math.abs(fO(d[2])):1,g=sEe;m<f&&(T*=-1,g=iEe);let I=d.some(oEe);_=[];for(let x=f;g(x,m);x+=T){let F;if(c)F=String.fromCharCode(x),F==="\\"&&(F="");else if(F=String(x),I){let B=h-F.length;if(B>0){let se=new Array(B+1).join("0");x<0?F="-"+se+F.slice(1):F=se+F}}_.push(F)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,rd(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let h=s+_[f]+i[m];(!n||l||h)&&r.push(h)}}return r}});var b$=E(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.assertValidPattern=void 0;var aEe=1024*64,cEe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>aEe)throw new TypeError("pattern is too long")};RT.assertValidPattern=cEe});var P$=E(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.parseClass=void 0;var uEe={"[: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]},od=t=>t.replace(/[[\]\\-]/g,"\\$&"),lEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),C$=t=>t.join(""),pEe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+1){l=!0,s++;continue}if(h==="]"&&i&&!c){p=s+1;break}if(i=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[g,R,I]]of Object.entries(uEe))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-n,!0];s+=T.length,I?o.push(g):r.push(g),a=a||R;continue e}}if(c=!1,d){h>d?r.push(od(d)+"-"+od(h)):h===d&&r.push(od(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(od(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(od(h)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[lEe(h),!1,p-n,!1]}let _="["+(l?"^":"")+C$(r)+"]",f="["+(l?"":"^")+C$(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};yT.parseClass=pEe});var NT=E(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0});IT.unescape=void 0;var dEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");IT.unescape=dEe});var EO=E(PT=>{"use strict";var bn;Object.defineProperty(PT,"__esModule",{value:!0});PT.AST=void 0;var _Ee=P$(),OT=NT(),fEe=new Set(["!","?","+","*","@"]),hO=t=>fEe.has(t),M$=t=>hO(t.type),mEe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),hEe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),TEe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),x$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),EEe="(?!(?:^|/)\\.\\.?(?:$|/))",bT="(?!\\.)",gEe=new Set(["[","."]),SEe=new Set(["..","."]),AEe=new Set("().*{}+?[]^$\\!"),REe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),TO="[^/]",v$=TO+"*?",L$=TO+"+?",yEe=0,CT=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++yEe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#T(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof bn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof bn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new bn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let h=r,T="";for(;h<e.length;){let g=e.charAt(h++);if(a||g==="\\"){a=!a,T+=g;continue}if(c){h===l+1?(g==="^"||g==="!")&&(p=!0):g==="]"&&!(h===l+2&&p)&&(c=!1),T+=g;continue}else if(g==="["){c=!0,l=h,p=!1,T+=g;continue}if(!o.noext&&hO(g)&&e.charAt(h)==="("&&s<=i){n.push(T),T="";let I=new bn(g,n);h=bn.#p(e,I,h,o,s+1),n.push(I);continue}T+=g}return n.push(T),h}let d=r+1,_=new bn(null,n),f=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(p=!0):h==="]"&&!(d===l+2&&p)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,p=!1,m+=h;continue}if(!o.noext&&hO(h)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(h))){let g=n&&n.#d(h)?0:1;_.push(m),m="";let R=new bn(h,_);_.push(R),d=bn.#p(e,R,d,o,s+g);continue}if(h==="|"){_.push(m),m="",f.push(_),_=new bn(null,n);continue}if(h===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=h}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,hEe)}#f(e,n=mEe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=TEe){return!!n.get(this.type)?.includes(e)}#g(e,n){let r=e.#e[0],o=new bn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#S(e){return!!x$.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#S(n.type)}#R(e){let n=x$.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new bn(null,void 0,n);return bn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#T()),!M$(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,h,T,g]=typeof f=="string"?bn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||g,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&SEe.has(this.#e[0]))){let m=gEe,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!n&&!e&&m.has(l.charAt(0));p=h?EEe:T?bT:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,OT.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,OT.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!bT?"":this.#h(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?bT:"")+L$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?bT:"")+v$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,OT.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(M$(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#g(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#h(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(AEe.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?L$:v$,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,_Ee.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=TO,n=!0;continue}s+=REe(l)}return[s,(0,OT.unescape)(e),!!n,i]}};PT.AST=CT;bn=CT});var gO=E(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0});MT.escape=void 0;var IEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");MT.escape=IEe});var j$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var NEe=O$(),xT=b$(),w$=EO(),OEe=gO(),bEe=NT(),CEe=(t,e,n={})=>((0,xT.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new _a(e,n).match(t));k.minimatch=CEe;var PEe=/^\*+([^+@!?\*\[\(]*)$/,MEe=t=>e=>!e.startsWith(".")&&e.endsWith(t),xEe=t=>e=>e.endsWith(t),vEe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),LEe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),DEe=/^\*+\.\*+$/,UEe=t=>!t.startsWith(".")&&t.includes("."),wEe=t=>t!=="."&&t!==".."&&t.includes("."),kEe=/^\.\*+$/,GEe=t=>t!=="."&&t!==".."&&t.startsWith("."),BEe=/^\*+$/,jEe=t=>t.length!==0&&!t.startsWith("."),HEe=t=>t.length!==0&&t!=="."&&t!=="..",FEe=/^\?+([^+@!?\*\[\(]*)?$/,VEe=([t,e=""])=>{let n=k$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},qEe=([t,e=""])=>{let n=G$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},$Ee=([t,e=""])=>{let n=G$([t]);return e?r=>n(r)&&r.endsWith(e):n},YEe=([t,e=""])=>{let n=k$([t]);return e?r=>n(r)&&r.endsWith(e):n},k$=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},G$=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},B$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",D$={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=B$==="win32"?D$.win32.sep:D$.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var WEe="[^/]",zEe=WEe+"*?",KEe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",QEe="(?:(?!(?:\\/|^)\\.).)*?",XEe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=XEe;k.minimatch.filter=k.filter;var cr=(t,e={})=>Object.assign({},t,e),JEe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,cr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,cr(t,s))}static defaults(o){return e.defaults(cr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,cr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,cr(t,s))}},unescape:(r,o={})=>e.unescape(r,cr(t,o)),escape:(r,o={})=>e.escape(r,cr(t,o)),filter:(r,o={})=>e.filter(r,cr(t,o)),defaults:r=>e.defaults(cr(t,r)),makeRe:(r,o={})=>e.makeRe(r,cr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,cr(t,o)),match:(r,o,s={})=>e.match(r,o,cr(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=JEe;k.minimatch.defaults=k.defaults;var ZEe=(t,e={})=>((0,xT.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,NEe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=ZEe;k.minimatch.braceExpand=k.braceExpand;var ege=(t,e={})=>new _a(t,e).makeRe();k.makeRe=ege;k.minimatch.makeRe=k.makeRe;var tge=(t,e,n={})=>{let r=new _a(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=tge;k.minimatch.match=k.match;var U$=/[?*]|[+@!]\(.*?\)|\[|\]/,nge=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_a=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,xT.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||B$,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!U$.test(s[2]))&&!U$.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,h=[0];for(let R of l)R===k.GLOBSTAR?(h.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let T=_.length-1,g=e.length-d;for(let R of _)R[1]=g-(h[T--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,xT.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(BEe))?o=n.dot?HEe:jEe:(r=e.match(PEe))?o=(n.nocase?n.dot?LEe:vEe:n.dot?xEe:MEe)(r[1]):(r=e.match(FEe))?o=(n.nocase?n.dot?qEe:VEe:n.dot?$Ee:YEe)(r):(r=e.match(DEe))?o=n.dot?wEe:UEe:(r=e.match(kEe))&&(o=GEe);let s=w$.AST.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?zEe:n.dot?KEe:QEe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?nge(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=_a;var rge=EO();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return rge.AST}});var oge=gO();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return oge.escape}});var sge=NT();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return sge.unescape}});k.minimatch.AST=w$.AST;k.minimatch.Minimatch=_a;k.minimatch.escape=OEe.escape;k.minimatch.unescape=bEe.unescape});var W$=E((XKe,RO)=>{"use strict";var H$=U("node:diagnostics_channel"),{context:vT,trace:SO,SpanStatusCode:LT,propagation:AO,diag:ige}=(b(),N(v)),{getRPCMetadata:age,RPCType:cge}=Te(),{ATTR_HTTP_ROUTE:DT,ATTR_HTTP_RESPONSE_STATUS_CODE:F$,ATTR_HTTP_REQUEST_METHOD:uge,ATTR_URL_PATH:lge}=(le(),N(Ae)),{InstrumentationBase:pge}=h$(),{version:dge,name:V$}=T$(),_ge=">=4.0.0 <6",q$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},qs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},qo="anonymous",$s=Symbol("fastify otel instance"),Ys=Symbol("fastify otel request spans"),sd=Symbol("fastify otel request context"),$$=Symbol("fastify otel addhook original"),Y$=Symbol("fastify otel setnotfound original"),id=Symbol("fastify otel ignore path"),ad=Symbol("fastify otel record exceptions"),UT=class extends pge{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(V$,dge,e),this.logger=ige.createComponentLogger({namespace:V$}),this[id]=null,this[ad]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[ad]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=null;this[id]=o=>typeof n=="function"?n(o):(r==null&&(r=j$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},H$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(H$.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:_ge,name:"@fastify/otel"},n;function n(r,o,s){r.decorate($s,e),r.decorate($$,r.addHook),r.decorate(Y$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[sd],m=this[Ys];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(h,T)=>AO.inject(f,h,T),extract:(h,T)=>AO.extract(f,h,T)}}),r.decorateRequest(Ys,null),r.decorateRequest(sd,null),r.addHook("onRoute",function(f){if(e[id]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of q$)if(f[m]!=null){let h=f[m];if(typeof h=="function")f[m]=d(h,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[DT]:f.url,[Me.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:qo});else if(Array.isArray(h)){let T=[];for(let g of h)T.push(d(g,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[DT]:f.url,[Me.HOOK_CALLBACK_NAME]:g.name?.length>0?g.name:qo}));f[m]=T}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:qs.HANDLER,[DT]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:qo})}),r.addHook("onRequest",function(f,m,h){if(this[$s].isEnabled()===!1||f.routeOptions.config?.otel===!1)return h();if(this[$s][id]?.({url:f.url,method:f.method})===!0)return this[$s].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),h();let T=vT.active();SO.getSpan(T)==null&&(T=AO.extract(T,f.headers));let g=age(T);f.routeOptions.url!=null&&g?.type===cge.HTTP&&(g.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[uge]:f.method,[lge]:f.url};f.routeOptions.url!=null&&(R[DT]=f.routeOptions.url);let I=this[$s].tracer.startSpan("request",{attributes:R},T);try{this[$s]._requestHook?.(I,f)}catch(x){this[$s].logger.error({err:x},"requestHook threw")}f[sd]=SO.setSpan(T,I),f[Ys]=I,vT.with(f[sd],()=>{h()})}),r.addHook("onResponse",function(f,m,h){let T=f[Ys];T!=null&&(T.setAttributes({[F$]:m.statusCode}),T.end()),f[Ys]=null,h()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,h){let T=_[Ys];T!=null&&(f.statusCode>=500&&T.setStatus({code:LT.ERROR}),T.setAttributes({[F$]:f.statusCode}),T.end()),_[Ys]=null,h(null,m)}function a(_,f,m,h){let T=_[Ys];T!=null&&(T.setStatus({code:LT.ERROR,message:m.message}),e[ad]!==!1&&T.recordException(m)),h()}function c(_,f){let m=this[$$];return q$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo})):m.call(this,_,f)}function l(_,f){let m=this[Y$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:qo}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:qo})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:qo})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...T){let g=this[$s],R=p(T);if(R===null)return g.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...T);if(g.isEnabled()===!1||R.routeOptions.config?.otel===!1)return g.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...T);if(g[id]?.({url:R.url,method:R.method})===!0)return g.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...T);let I=R[sd]??vT.active(),x=_.name?.length>0?_.name:this.pluginName??qo,F=g.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(g._lifecycleHook!=null)try{g._lifecycleHook(F,{hookName:f,request:R,handler:x})}catch(B){g.logger.error({err:B},"Execution of lifecycleHook failed")}return vT.with(SO.setSpan(I,F),function(){try{let B=_.call(this,...T);return typeof B?.then=="function"?B.then(se=>(F.end(),se),se=>(F.setStatus({code:LT.ERROR,message:se.message}),g[ad]!==!1&&F.recordException(se),F.end(),Promise.reject(se))):(F.end(),B)}catch(B){throw F.setStatus({code:LT.ERROR,message:B.message}),g[ad]!==!1&&F.recordException(B),F.end(),B}},this)}}}}};RO.exports=UT;RO.exports.FastifyOtelInstrumentation=UT});var NO=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SpanNames=Dr.TokenKind=Dr.AllowedOperationTypes=void 0;var Rge;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(Rge=Dr.AllowedOperationTypes||(Dr.AllowedOperationTypes={}));var yge;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(yge=Dr.TokenKind||(Dr.TokenKind={}));var Ige;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(Ige=Dr.SpanNames||(Dr.SpanNames={}))});var OO=E(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.AttributeNames=void 0;var Nge;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(Nge=pd.AttributeNames||(pd.AttributeNames={}))});var jT=E(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.OTEL_GRAPHQL_DATA_SYMBOL=yu.OTEL_PATCHED_SYMBOL=void 0;yu.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");yu.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var sY=E(HT=>{"use strict";Object.defineProperty(HT,"__esModule",{value:!0});HT.OPERATION_NOT_SUPPORTED=void 0;var T2e=jT();HT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var gY=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.wrapFieldResolver=mt.wrapFields=mt.getSourceFromLocation=mt.getOperation=mt.endSpan=mt.addSpanSource=mt.addInputVariableAttributes=mt.isPromise=void 0;var Iu=(b(),N(v)),Ws=NO(),ma=OO(),Yo=jT(),iY=Object.values(Ws.AllowedOperationTypes),Oge=t=>typeof t?.then=="function";mt.isPromise=Oge;var bge=t=>typeof t=="object"&&t!==null;function bO(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{bO(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{bO(t,`${e}.${r}`,o)}):t.setAttribute(`${ma.AttributeNames.VARIABLES}${String(e)}`,n)}function Cge(t,e){Object.entries(e).forEach(([n,r])=>{bO(t,n,r)})}mt.addInputVariableAttributes=Cge;function lY(t,e,n,r,o){let s=mY(e,n,r,o);t.setAttribute(ma.AttributeNames.SOURCE,s)}mt.addSpanSource=lY;function Pge(t,e,n,r,o){let s=pY(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?_Y(n):dY(n,o);return s={span:Mge(t,e,n,r,o,a)},Lge(n,o,s),{field:s,spanAdded:!0}}function Mge(t,e,n,r,o,s){let i={[ma.AttributeNames.FIELD_NAME]:r.fieldName,[ma.AttributeNames.FIELD_PATH]:o.join("."),[ma.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[ma.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Ws.SpanNames.RESOLVE} ${i[ma.AttributeNames.FIELD_PATH]}`,{attributes:i},s?Iu.trace.setSpan(Iu.context.active(),s):void 0),c=n[Yo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&lY(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function xge(t,e){e&&t.recordException(e),t.end()}mt.endSpan=xge;function vge(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>iY.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>iY.indexOf(n?.operation)!==-1)}mt.getOperation=vge;function Lge(t,e,n){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function pY(t,e){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function dY(t,e){for(let n=e.length-1;n>0;n--){let r=pY(t,e.slice(0,n));if(r)return r.span}return _Y(t)}function _Y(t){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].span}function Dge(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function Uge(t){return fY(`
|
|
11
|
+
`,t)}function aY(t){return fY(" ",t)}function fY(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var wge=[Ws.TokenKind.FLOAT,Ws.TokenKind.STRING,Ws.TokenKind.INT,Ws.TokenKind.BLOCK_STRING];function mY(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let l=a.value||a.kind,p="";!e&&wge.indexOf(a.kind)>=0&&(l="*"),a.kind===Ws.TokenKind.STRING&&(l=`"${l}"`),a.kind===Ws.TokenKind.EOF&&(l=""),a.line>c?(o+=Uge(a.line-c),c=a.line,p=aY(a.column-1)):a.line===a.prev?.line&&(p=aY(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}mt.getSourceFromLocation=mY;function hY(t,e,n){if(!t||t[Yo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Yo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=EY(e,n,s.resolve)),s.type)){let i=TY(s.type);for(let a of i)hY(a,e,n)}})}mt.wrapFields=hY;function TY(t){return"ofType"in t?TY(t.ofType):kge(t)?t.getTypes():Gge(t)?[t]:[]}function kge(t){return"getTypes"in t&&typeof t.getTypes=="function"}function Gge(t){return"getFields"in t&&typeof t.getFields=="function"}var cY=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Iu.SpanStatusCode.ERROR,message:e.message}),t.end())},uY=(t,e)=>{e&&t.end()};function EY(t,e,n,r=!1){if(o[Yo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(bge(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Yo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=Dge(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=dY(a,p);else{let{field:m,spanAdded:h}=Pge(t,e,a,c,p);_=m.span,f=h}return Iu.context.with(Iu.trace.setSpan(Iu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,mt.isPromise)(m)?m.then(h=>(uY(_,f),h),h=>{throw cY(_,h,f),h}):(uY(_,f),m)}catch(m){throw cY(_,m,f),m}})}return o[Yo.OTEL_PATCHED_SYMBOL]=!0,o}mt.wrapFieldResolver=EY});var SY=E(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.PACKAGE_NAME=Nu.PACKAGE_VERSION=void 0;Nu.PACKAGE_VERSION="0.62.0";Nu.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var yY=E(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0});qT.GraphQLInstrumentation=void 0;var Wo=(b(),N(v)),ur=ne(),dd=NO(),FT=OO(),CO=jT(),Bge=sY(),Kt=gY(),AY=SY(),RY={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},VT=[">=14.0.0 <17"],PO=class extends ur.InstrumentationBase{constructor(e={}){super(AY.PACKAGE_NAME,AY.PACKAGE_VERSION,{...RY,...e})}setConfig(e={}){super.setConfig({...RY,...e})}init(){let e=new ur.InstrumentationNodeModuleDefinition("graphql",VT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ur.InstrumentationNodeModuleFile("graphql/execution/execute.js",VT,e=>((0,ur.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new ur.InstrumentationNodeModuleFile("graphql/language/parser.js",VT,e=>((0,ur.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ur.InstrumentationNodeModuleFile("graphql/validation/validate.js",VT,e=>((0,ur.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Kt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[CO.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[CO.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Kt.endSpan)(e,n);return}if((0,Kt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Kt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Kt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Kt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ur.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Kt.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(dd.SpanNames.PARSE);return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),i),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Kt.getOperation)(c)?c.loc&&(0,Kt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(dd.SpanNames.SCHEMA_PARSE)),(0,Kt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(dd.SpanNames.VALIDATE,{});return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(dd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:FT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Kt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(dd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(FT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(FT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=Bge.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(FT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Kt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Kt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[CO.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let p=a==null,d=a??l;return a=(0,Kt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Kt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Kt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};qT.GraphQLInstrumentation=PO});var IY=E($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});$T.GraphQLInstrumentation=void 0;var jge=yY();Object.defineProperty($T,"GraphQLInstrumentation",{enumerable:!0,get:function(){return jge.GraphQLInstrumentation}})});var MY=E(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0});YT.EVENT_LISTENERS_SET=void 0;YT.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var xY=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.bufferTextMapGetter=void 0;WT.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var vY=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var LY=E(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.PACKAGE_NAME=Ou.PACKAGE_VERSION=void 0;Ou.PACKAGE_VERSION="0.23.0";Ou.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var BY=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.KafkaJsInstrumentation=void 0;var ye=(b(),N(v)),lr=ne(),bu=(le(),N(Ae)),DY=MY(),UY=xY(),G=vY(),wY=LY();function zT(t,e,n){return r=>{t.add(e,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}function kY(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}var GY=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],MO=class extends lr.InstrumentationBase{constructor(e={}){super(wY.PACKAGE_NAME,wY.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:GY}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:GY}})}init(){let e=r=>{(0,lr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,lr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new lr.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[DY.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[DY.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[bu.ATTR_SERVER_ADDRESS]:n,[bu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,lr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,lr.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,lr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,lr.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,UY.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[kY(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),zT(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[zT(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,UY.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(kY(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push(zT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>zT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=bu.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(bu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,lr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,lr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};KT.KafkaJsInstrumentation=MO});var jY=E(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});QT.KafkaJsInstrumentation=void 0;var Vge=BY();Object.defineProperty(QT,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return Vge.KafkaJsInstrumentation}})});var $Y=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.58.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var KY=E(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});XT.LruMemoizerInstrumentation=void 0;var YY=(b(),N(v)),WY=ne(),zY=$Y(),xO=class extends WY.InstrumentationBase{constructor(e={}){super(zY.PACKAGE_NAME,zY.PACKAGE_VERSION,e)}init(){return[new WY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?YY.context.bind(YY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};XT.LruMemoizerInstrumentation=xO});var QY=E(JT=>{"use strict";Object.defineProperty(JT,"__esModule",{value:!0});JT.LruMemoizerInstrumentation=void 0;var $ge=KY();Object.defineProperty(JT,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return $ge.LruMemoizerInstrumentation}})});var tW=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var nW=E(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.MongodbCommandType=void 0;var Wge;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(Wge=_d.MongodbCommandType||(_d.MongodbCommandType={}))});var rW=E(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.PACKAGE_NAME=Pu.PACKAGE_VERSION=void 0;Pu.PACKAGE_VERSION="0.67.0";Pu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var iW=E(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.MongoDBInstrumentation=void 0;var we=(b(),N(v)),fe=ne(),zo=(le(),N(Ae)),$n=tW(),ha=nW(),oW=rW(),sW={requireParentSpan:!0},vO=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(oW.PACKAGE_NAME,oW.PACKAGE_VERSION,{...sW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...sW,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter($n.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,"insert"),this._unwrap(e,"remove"),this._unwrap(e,"update"),this._unwrap(e,"command"),this._unwrap(e,"query"),this._unwrap(e,"getMore"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,fe.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,fe.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=we.context.bind(we.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),h=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=n._patchEnd(h,_);return typeof c=="function"?r.call(this,s,i,a,T):r.call(this,s,i,a,c,T)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ha.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),h=e._spanNameFromAttrs(m),T=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m}),g=e._patchEnd(T,d);return typeof a=="function"?n.call(this,o,s,i,g):n.call(this,o,s,i,a,g)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),h=e._spanNameFromAttrs(m);_=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),h=e._spanNameFromAttrs(m);d=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}static _getCommandType(e){return e.createIndexes!==void 0?ha.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ha.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ha.MongodbCommandType.IS_MASTER:e.count!==void 0?ha.MongodbCommandType.COUNT:e.aggregate!==void 0?ha.MongodbCommandType.AGGREGATE:ha.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_SYSTEM]=$n.DB_SYSTEM_VALUE_MONGODB,a[$n.ATTR_DB_NAME]=e,a[$n.ATTR_DB_MONGODB_COLLECTION]=n,a[$n.ATTR_DB_OPERATION]=i,a[$n.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_SYSTEM_NAME]=$n.DB_SYSTEM_NAME_VALUE_MONGODB,a[zo.ATTR_DB_NAMESPACE]=e,a[zo.ATTR_DB_OPERATION_NAME]=i,a[zo.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[zo.ATTR_DB_OPERATION_NAME],e[zo.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||$n.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[$n.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};ZT.MongoDBInstrumentation=vO});var aW=E(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});fd.MongodbCommandType=void 0;var zge;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(zge=fd.MongodbCommandType||(fd.MongodbCommandType={}))});var cW=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.MongodbCommandType=Mu.MongoDBInstrumentation=void 0;var Kge=iW();Object.defineProperty(Mu,"MongoDBInstrumentation",{enumerable:!0,get:function(){return Kge.MongoDBInstrumentation}});var Qge=aW();Object.defineProperty(Mu,"MongodbCommandType",{enumerable:!0,get:function(){return Qge.MongodbCommandType}})});var DO=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var mW=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.handleCallbackResponse=zs.handlePromiseResponse=zs.getAttributesFromCollection=void 0;var _W=(b(),N(v)),hd=ne(),md=DO(),eE=(le(),N(Ae));function nSe(t,e,n){let r={};return e&hd.SemconvStability.OLD&&(r[md.ATTR_DB_MONGODB_COLLECTION]=t.name,r[md.ATTR_DB_NAME]=t.conn.name,r[md.ATTR_DB_USER]=t.conn.user),e&hd.SemconvStability.STABLE&&(r[eE.ATTR_DB_COLLECTION_NAME]=t.name,r[eE.ATTR_DB_NAMESPACE]=t.conn.name),n&hd.SemconvStability.OLD&&(r[md.ATTR_NET_PEER_NAME]=t.conn.host,r[md.ATTR_NET_PEER_PORT]=t.conn.port),n&hd.SemconvStability.STABLE&&(r[eE.ATTR_SERVER_ADDRESS]=t.conn.host,r[eE.ATTR_SERVER_PORT]=t.conn.port),r}zs.getAttributesFromCollection=nSe;function fW(t,e={}){t.recordException(e),t.setStatus({code:_W.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
12
|
+
Mongoose Error Code: ${e.code}`:""}`})}function UO(t,e,n,r=void 0){n&&(0,hd.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&_W.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function rSe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(UO(e,o,n,r),o)).catch(o=>{throw fW(e,o),o}).finally(()=>e.end()):(UO(e,t,n,r),e.end(),t)}zs.handlePromiseResponse=rSe;function oSe(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,l)=>(c?fW(r,c):UO(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}zs.handleCallbackResponse=oSe});var hW=E(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.PACKAGE_NAME=xu.PACKAGE_VERSION=void 0;xu.PACKAGE_VERSION="0.60.0";xu.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var AW=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MongooseInstrumentation=Cn._ALREADY_INSTRUMENTED=Cn._STORED_PARENT_SPAN=void 0;var ht=(b(),N(v)),sSe=Te(),wO=mW(),Bt=ne(),TW=hW(),Ks=DO(),Ta=(le(),N(Ae)),tE=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],iSe=["remove","count","findOneAndRemove",...tE],aSe=["count","findOneAndRemove",...tE],cSe=[...tE];function EW(t){return t?t.startsWith("6.")||t.startsWith("5.")?iSe:t.startsWith("7.")?aSe:cSe:tE}function gW(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function SW(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Cn._STORED_PARENT_SPAN=Symbol("stored-parent-span");Cn._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var kO=class extends Bt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(TW.PACKAGE_NAME,TW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Bt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Bt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new Bt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,gW(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),SW(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),EW(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=EW(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,gW(n)&&this._unwrap(r.Model.prototype,"remove"),SW(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&ht.trace.getSpan(ht.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&Bt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&Bt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[Cn._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&ht.trace.getSpan(ht.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&Bt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&Bt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&ht.trace.getSpan(ht.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&Bt.SemconvStability.OLD&&(l[Ks.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&Bt.SemconvStability.STABLE&&(l[Ta.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&ht.trace.getSpan(ht.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let T=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&Bt.SemconvStability.OLD&&(_[Ks.ATTR_DB_STATEMENT]=T),r._dbSemconvStability&Bt.SemconvStability.STABLE&&(_[Ta.ATTR_DB_QUERY_TEXT]=T)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),h=r._handleResponse(m,o,this,arguments,l,n);return h&&typeof h=="object"&&(h[Cn._ALREADY_INSTRUMENTED]=!0),h}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&ht.trace.getSpan(ht.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&Bt.SemconvStability.OLD&&(p[Ks.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&Bt.SemconvStability.STABLE&&(p[Ta.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=ht.trace.getSpan(ht.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Cn._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Cn._STORED_PARENT_SPAN]=ht.trace.getSpan(ht.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,wO.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&Bt.SemconvStability.OLD&&(i[Ks.ATTR_DB_OPERATION]=r,i[Ks.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&Bt.SemconvStability.STABLE&&(i[Ta.ATTR_DB_OPERATION_NAME]=r,i[Ta.ATTR_DB_SYSTEM_NAME]=Ks.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&Bt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:ht.SpanKind.CLIENT,attributes:i},s?ht.trace.setSpan(ht.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,wO.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,wO.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?ht.context.with((0,sSe.suppressTracing)(ht.context.active()),e):e()}};Cn.MongooseInstrumentation=kO});var RW=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.MongooseInstrumentation=void 0;var uSe=AW();Object.defineProperty(nE,"MongooseInstrumentation",{enumerable:!0,get:function(){return uSe.MongooseInstrumentation}})});var bW=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var CW=E(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.AttributeNames=void 0;var pSe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(pSe=Td.AttributeNames||(Td.AttributeNames={}))});var PW=E(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.getPoolNameOld=Qt.arrayStringifyHelper=Qt.getSpanName=Qt.getDbValues=Qt.getDbQueryText=Qt.getJDBCString=Qt.getConfig=void 0;function dSe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Qt.getConfig=dSe;function _Se(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Qt.getJDBCString=_Se;function fSe(t){return typeof t=="string"?t:t.sql}Qt.getDbQueryText=fSe;function mSe(t,e){return GO(typeof t=="string"?e:e||t.values)}Qt.getDbValues=mSe;function hSe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Qt.getSpanName=hSe;function GO(t){return t?`[${t.toString()}]`:""}Qt.arrayStringifyHelper=GO;function TSe(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}Qt.getPoolNameOld=TSe});var MW=E(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.PACKAGE_NAME=vu.PACKAGE_VERSION=void 0;vu.PACKAGE_VERSION="0.60.0";vu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var vW=E(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.MySQLInstrumentation=void 0;var Pn=(b(),N(v)),pr=ne(),Lu=(le(),N(Ae)),Ko=bW(),ESe=CW(),Ea=PW(),xW=MW(),BO=class extends pr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(xW.PACKAGE_NAME,xW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,pr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,pr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ko.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new pr.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,pr.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,pr.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,pr.isWrapped)(e.createPoolCluster)&&this._unwrap(e,"createPoolCluster"),this._wrap(e,"createPoolCluster",this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,"createConnection"),this._unwrap(e,"createPool"),this._unwrap(e,"createPoolCluster"))})]}_patchCreateConnection(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,l=(0,Ea.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),l=a[c].pool;r._setPoolCallbacks(l,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=Pn.context.active();return function(o,s){s&&((0,pr.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Pn.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:l,database:p,user:d}=(0,Ea.getConfig)(e.config),_=parseInt(l,10),f=(0,Ea.getDbQueryText)(o);r._dbSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_DB_SYSTEM]=Ko.DB_SYSTEM_VALUE_MYSQL,a[Ko.ATTR_DB_CONNECTION_STRING]=(0,Ea.getJDBCString)(c,l,p),a[Ko.ATTR_DB_NAME]=p,a[Ko.ATTR_DB_USER]=d,a[Ko.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_DB_SYSTEM_NAME]=Lu.DB_SYSTEM_NAME_VALUE_MYSQL,a[Lu.ATTR_DB_NAMESPACE]=p,a[Lu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Ko.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[Lu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,Ea.getSpanName)(o),{kind:Pn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let g;Array.isArray(s)?g=s:arguments[2]&&(g=[s]),m.setAttribute(ESe.AttributeNames.MYSQL_VALUES,(0,Ea.getDbValues)(o,g))}let h=Array.from(arguments).findIndex(g=>typeof g=="function"),T=Pn.context.active();if(h===-1){let g=Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments));return Pn.context.bind(T,g),g.on("error",R=>m.setStatus({code:Pn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,h,r._patchCallbackQuery(m,T)),Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Pn.SpanStatusCode.ERROR,message:o.message}),e.end(),Pn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Ea.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};rE.MySQLInstrumentation=BO});var LW=E(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.MySQLInstrumentation=void 0;var gSe=vW();Object.defineProperty(oE,"MySQLInstrumentation",{enumerable:!0,get:function(){return gSe.MySQLInstrumentation}})});var jO=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.DB_SYSTEM_VALUE_MYSQL=bt.ATTR_NET_PEER_PORT=bt.ATTR_NET_PEER_NAME=bt.ATTR_DB_USER=bt.ATTR_DB_SYSTEM=bt.ATTR_DB_STATEMENT=bt.ATTR_DB_NAME=bt.ATTR_DB_CONNECTION_STRING=void 0;bt.ATTR_DB_CONNECTION_STRING="db.connection_string";bt.ATTR_DB_NAME="db.name";bt.ATTR_DB_STATEMENT="db.statement";bt.ATTR_DB_SYSTEM="db.system";bt.ATTR_DB_USER="db.user";bt.ATTR_NET_PEER_NAME="net.peer.name";bt.ATTR_NET_PEER_PORT="net.peer.port";bt.DB_SYSTEM_VALUE_MYSQL="mysql"});var FO=E(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.addSqlCommenterComment=void 0;var HO=(b(),N(v)),ASe=Te();function RSe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function ySe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function ISe(t,e){if(typeof e!="string"||e.length===0||RSe(e))return e;let n=new ASe.W3CTraceContextPropagator,r={};n.inject(HO.trace.setSpan(HO.ROOT_CONTEXT,t),r,HO.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=ySe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}sE.addSqlCommenterComment=ISe});var GW=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getConnectionPrototypeToInstrument=dr.once=dr.getSpanName=dr.getQueryText=dr.getConnectionAttributes=void 0;var Ed=jO(),iE=ne(),VO=(le(),N(Ae));function NSe(t,e,n){let{host:r,port:o,database:s,user:i}=OSe(t),a={};e&iE.SemconvStability.OLD&&(a[Ed.ATTR_DB_CONNECTION_STRING]=bSe(r,o,s),a[Ed.ATTR_DB_NAME]=s,a[Ed.ATTR_DB_USER]=i),e&iE.SemconvStability.STABLE&&(a[VO.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&iE.SemconvStability.OLD&&(a[Ed.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[Ed.ATTR_NET_PEER_PORT]=c)),n&iE.SemconvStability.STABLE&&(a[VO.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[VO.ATTR_SERVER_PORT]=c)),a}dr.getConnectionAttributes=NSe;function OSe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function bSe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function CSe(t,e,n,r=!1,o=PSe){let[s,i]=typeof t=="string"?[t,n]:[t.sql,MSe(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}dr.getQueryText=CSe;function PSe(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function MSe(t){return"values"in t}function xSe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}dr.getSpanName=xSe;var vSe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};dr.once=vSe;function LSe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}dr.getConnectionPrototypeToInstrument=LSe});var BW=E(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.PACKAGE_NAME=Du.PACKAGE_VERSION=void 0;Du.PACKAGE_VERSION="0.60.0";Du.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var VW=E(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.MySQL2Instrumentation=void 0;var jW=(b(),N(v)),Ur=ne(),qO=jO(),HW=FO(),Uu=GW(),FW=BW(),$O=(le(),N(Ae)),YO=[">=1.4.2 <4"],WO=class extends Ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(FW.PACKAGE_NAME,FW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,Ur.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Ur.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new Ur.InstrumentationNodeModuleDefinition("mysql2",YO,s=>(n(s),s),()=>{},[new Ur.InstrumentationNodeModuleFile("mysql2/promise.js",YO,s=>(n(s),s),()=>{}),new Ur.InstrumentationNodeModuleFile("mysql2/lib/connection.js",YO,s=>{let i=(0,Uu.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Uu.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Uu.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Uu.getQueryText)(s,e,c,l,p);o._dbSemconvStability&Ur.SemconvStability.OLD&&(_[qO.ATTR_DB_SYSTEM]=qO.DB_SYSTEM_VALUE_MYSQL,_[qO.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&Ur.SemconvStability.STABLE&&(_[$O.ATTR_DB_SYSTEM_NAME]=$O.DB_SYSTEM_NAME_VALUE_MYSQL,_[$O.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Uu.getSpanName)(s),{kind:jW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,HW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,HW.addSqlCommenterComment)(m,s.sql)}));let h=(0,Uu.once)((T,g)=>{T?m.setStatus({code:jW.SpanStatusCode.ERROR,message:T.message}):typeof d=="function"&&(0,Ur.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:g})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(h));let T=r.apply(this,arguments);return T.once("error",g=>{h(g)}).once("result",g=>{h(void 0,g)}),T}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(h)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(h)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};aE.MySQL2Instrumentation=WO});var qW=E(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.MySQL2Instrumentation=void 0;var DSe=VW();Object.defineProperty(cE,"MySQL2Instrumentation",{enumerable:!0,get:function(){return DSe.MySQL2Instrumentation}})});var KW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.DB_SYSTEM_VALUE_REDIS=Xt.DB_SYSTEM_NAME_VALUE_REDIS=Xt.ATTR_NET_PEER_PORT=Xt.ATTR_NET_PEER_NAME=Xt.ATTR_DB_SYSTEM=Xt.ATTR_DB_STATEMENT=Xt.ATTR_DB_CONNECTION_STRING=void 0;Xt.ATTR_DB_CONNECTION_STRING="db.connection_string";Xt.ATTR_DB_STATEMENT="db.statement";Xt.ATTR_DB_SYSTEM="db.system";Xt.ATTR_NET_PEER_NAME="net.peer.name";Xt.ATTR_NET_PEER_PORT="net.peer.port";Xt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Xt.DB_SYSTEM_VALUE_REDIS="redis"});var QW=E(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.endSpan=void 0;var wSe=(b(),N(v)),kSe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:wSe.SpanStatusCode.ERROR,message:e.message})),t.end()};uE.endSpan=kSe});var pE=E(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.defaultDbStatementSerializer=void 0;var GSe=[{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}],BSe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=GSe.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};lE.defaultDbStatementSerializer=BSe});var XW=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.PACKAGE_NAME=wu.PACKAGE_VERSION=void 0;wu.PACKAGE_VERSION="0.62.0";wu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var tz=E(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0});dE.IORedisInstrumentation=void 0;var Qs=(b(),N(v)),Mn=ne(),Xs=(le(),N(Ae)),xn=KW(),JW=ne(),gd=QW(),jSe=pE(),ZW=XW(),ez={requireParentSpan:!0},zO=class extends Mn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(ZW.PACKAGE_NAME,ZW.PACKAGE_VERSION,{...ez,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Mn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...ez,...e})}init(){return[new Mn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Mn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Mn.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||jSe.defaultDbStatementSerializer,a=Qs.trace.getSpan(Qs.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,c[xn.ATTR_DB_STATEMENT]=d,c[xn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,c[Xs.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_NET_PEER_NAME]=l,c[xn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_SERVER_ADDRESS]=l,c[Xs.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:Qs.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,JW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&Qs.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),h=o.resolve;o.resolve=function(g){(0,JW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,g),R=>{R&&Qs.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,gd.endSpan)(_,null),h(g)};let T=o.reject;return o.reject=function(g){(0,gd.endSpan)(_,g),T(g)},m}catch(m){throw(0,gd.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=Qs.trace.getSpan(Qs.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,o[xn.ATTR_DB_STATEMENT]="connect",o[xn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,o[Xs.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_NET_PEER_NAME]=s,o[xn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_SERVER_ADDRESS]=s,o[Xs.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Qs.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,gd.endSpan)(a,null),c}catch(c){throw(0,gd.endSpan)(a,c),c}}}};dE.IORedisInstrumentation=zO});var nz=E(_E=>{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.IORedisInstrumentation=void 0;var HSe=tz();Object.defineProperty(_E,"IORedisInstrumentation",{enumerable:!0,get:function(){return HSe.IORedisInstrumentation}})});var fE=E(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.PACKAGE_NAME=ku.PACKAGE_VERSION=void 0;ku.PACKAGE_VERSION="0.62.0";ku.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var rz=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTracedCreateStreamTrace=Js.getTracedCreateClient=Js.endSpan=void 0;var Sd=(b(),N(v)),FSe=(t,e)=>{e&&t.setStatus({code:Sd.SpanStatusCode.ERROR,message:e.message}),t.end()};Js.endSpan=FSe;var VSe=t=>function(){let n=t.apply(this,arguments);return Sd.context.bind(Sd.context.active(),n)};Js.getTracedCreateClient=VSe;var qSe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){Sd.context.bind(Sd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Js.getTracedCreateStreamTrace=qSe});var mE=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var sz=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.RedisInstrumentationV2_V3=void 0;var Yn=ne(),hE=rz(),oz=fE(),Ad=(b(),N(v)),Rd=(le(),N(Ae)),ga=mE(),$Se=pE(),KO=class t extends Yn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(oz.PACKAGE_NAME,oz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Yn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Yn.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,Yn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Yn.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=Ad.trace.getSpan(Ad.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||$Se.defaultDbStatementSerializer,l={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(l,{[ga.ATTR_DB_SYSTEM]:ga.DB_SYSTEM_VALUE_REDIS,[ga.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(l,{[Rd.ATTR_DB_SYSTEM_NAME]:ga.DB_SYSTEM_NAME_VALUE_REDIS,[Rd.ATTR_DB_OPERATION_NAME]:s.command,[Rd.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:Ad.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(_,{[ga.ATTR_NET_PEER_NAME]:this.connection_options.host,[ga.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(_,{[Rd.ATTR_SERVER_ADDRESS]:this.connection_options.host,[Rd.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&Yn.SemconvStability.OLD&&p.setAttribute(ga.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=Ad.context.active();arguments[0].callback=function(m,h){if(i?.responseHook){let T=i.responseHook;(0,Yn.safeExecuteInTheMiddle)(()=>{T(p,s.command,s.args,h)},g=>{g&&e._diag.error("Error executing responseHook",g)},!0)}return(0,hE.endSpan)(p,m),Ad.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,hE.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,hE.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,hE.getTracedCreateStreamTrace)(n)}}};TE.RedisInstrumentationV2_V3=KO});var az=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE.getClientAttributes=void 0;var QO=(le(),N(Ae)),Gu=mE(),iz=ne();function YSe(t,e,n){let r={};return n&iz.SemconvStability.OLD&&Object.assign(r,{[Gu.ATTR_DB_SYSTEM]:Gu.DB_SYSTEM_VALUE_REDIS,[Gu.ATTR_NET_PEER_NAME]:e?.socket?.host,[Gu.ATTR_NET_PEER_PORT]:e?.socket?.port,[Gu.ATTR_DB_CONNECTION_STRING]:WSe(t,e?.url)}),n&iz.SemconvStability.STABLE&&Object.assign(r,{[QO.ATTR_DB_SYSTEM_NAME]:Gu.DB_SYSTEM_NAME_VALUE_REDIS,[QO.ATTR_SERVER_ADDRESS]:e?.socket?.host,[QO.ATTR_SERVER_PORT]:e?.socket?.port}),r}EE.getClientAttributes=YSe;function WSe(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var pz=E(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.RedisInstrumentationV4_V5=void 0;var _r=(b(),N(v)),xe=ne(),cz=az(),zSe=pE(),uz=fE(),XO=(le(),N(Ae)),KSe=mE(),yd=Symbol("opentelemetry.instrumentation.redis.open_spans"),lz=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),JO=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(uz.PACKAGE_NAME,uz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[yd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[yd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[lz]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,cz.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:_r.SpanKind.CLIENT,attributes:i});return _r.context.with(_r.trace.setSpan(_r.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:_r.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(_r.trace.getSpan(_r.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[lz],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||zSe.defaultDbStatementSerializer,p=(0,cz.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[XO.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[KSe.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[XO.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:_r.SpanKind.CLIENT,attributes:p}),_=_r.context.with(_r.trace.setSpan(_r.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[yd]=f[yd]||[],f[yd].push({span:d,commandName:a,commandArgs:c})}return _}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(XO.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:_r.SpanStatusCode.ERROR,message:s?.message})),e.end()}};gE.RedisInstrumentationV4_V5=JO});var fz=E(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.RedisInstrumentation=void 0;var QSe=ne(),dz=fE(),XSe=sz(),JSe=pz(),_z={requireParentSpan:!1},ZO=class extends QSe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={..._z,...e};super(dz.PACKAGE_NAME,dz.PACKAGE_VERSION,n),this.instrumentationV2_V3=new XSe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new JSe.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={..._z,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}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())}};SE.RedisInstrumentation=ZO});var mz=E(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.RedisInstrumentation=void 0;var ZSe=fz();Object.defineProperty(AE,"RedisInstrumentation",{enumerable:!0,get:function(){return ZSe.RedisInstrumentation}})});var Nz=E(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.EVENT_LISTENERS_SET=void 0;yE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var nb=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.AttributeNames=void 0;var iAe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(iAe=Od.AttributeNames||(Od.AttributeNames={}))});var rb=E(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=ge.METRIC_DB_CLIENT_CONNECTION_COUNT=ge.DB_SYSTEM_VALUE_POSTGRESQL=ge.DB_CLIENT_CONNECTION_STATE_VALUE_USED=ge.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=ge.ATTR_NET_PEER_PORT=ge.ATTR_NET_PEER_NAME=ge.ATTR_DB_USER=ge.ATTR_DB_SYSTEM=ge.ATTR_DB_STATEMENT=ge.ATTR_DB_NAME=ge.ATTR_DB_CONNECTION_STRING=ge.ATTR_DB_CLIENT_CONNECTION_STATE=ge.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;ge.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";ge.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";ge.ATTR_DB_CONNECTION_STRING="db.connection_string";ge.ATTR_DB_NAME="db.name";ge.ATTR_DB_STATEMENT="db.statement";ge.ATTR_DB_SYSTEM="db.system";ge.ATTR_DB_USER="db.user";ge.ATTR_NET_PEER_NAME="net.peer.name";ge.ATTR_NET_PEER_PORT="net.peer.port";ge.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";ge.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";ge.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";ge.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";ge.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var ob=E(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.SpanNames=void 0;var aAe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(aAe=bd.SpanNames||(bd.SpanNames={}))});var vz=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var Zs=(b(),N(v)),IE=nb(),fr=(le(),N(Ae)),Ve=rb(),Sa=ne(),Oz=ob();function bz(t,e){if(!e)return Oz.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:Cz(e.text);return`${Oz.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=bz;function Cz(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}me.parseNormalizedOperationName=Cz;function Pz(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=Pz;function sb(t){if("connectionString"in t&&t.connectionString)return Pz(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=sb;function NE(t){if(Number.isInteger(t))return t}function Mz(t,e){let n={};return e&Sa.SemconvStability.OLD&&(n={...n,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:t.database,[Ve.ATTR_DB_CONNECTION_STRING]:sb(t),[Ve.ATTR_DB_USER]:t.user,[Ve.ATTR_NET_PEER_NAME]:t.host,[Ve.ATTR_NET_PEER_PORT]:NE(t.port)}),e&Sa.SemconvStability.STABLE&&(n={...n,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:t.host,[fr.ATTR_SERVER_PORT]:NE(t.port)}),n}me.getSemanticAttributesFromConnection=Mz;function cAe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[IE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[IE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&Sa.SemconvStability.OLD&&(r={...r,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Ve.ATTR_DB_CONNECTION_STRING]:sb(t),[Ve.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Ve.ATTR_NET_PEER_PORT]:Number(n?.port)||NE(t.port),[Ve.ATTR_DB_USER]:n?.username??t.user}),e&Sa.SemconvStability.STABLE&&(r={...r,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[fr.ATTR_SERVER_PORT]:Number(n?.port)||NE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=cAe;function uAe(t){return t.requireParentSpan===!0&&Zs.trace.getSpan(Zs.context.active())===void 0}me.shouldSkipInstrumentation=uAe;function lAe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=bz(s,r),a=t.startSpan(i,{kind:Zs.SpanKind.CLIENT,attributes:Mz(o,n)});if(!r)return a;if(r.text&&(n&Sa.SemconvStability.OLD&&a.setAttribute(Ve.ATTR_DB_STATEMENT,r.text),n&Sa.SemconvStability.STABLE&&a.setAttribute(fr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(IE.AttributeNames.PG_VALUES,c)}catch(c){Zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(IE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=lAe;function xz(t,e,n){typeof t.responseHook=="function"&&(0,Sa.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&Zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=xz;function pAe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[fr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(OE(i)),e.setStatus({code:Zs.SpanStatusCode.ERROR,message:i.message})):xz(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=pAe;function dAe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}me.getPoolName=dAe;function _Ae(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=_Ae;function fAe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(OE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=fAe;function mAe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(OE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=mAe;function hAe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=hAe;function TAe(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=TAe;function OE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=OE});var Lz=E(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.PACKAGE_NAME=Bu.PACKAGE_VERSION=void 0;Bu.PACKAGE_VERSION="0.66.0";Bu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var Bz=E(CE=>{"use strict";Object.defineProperty(CE,"__esModule",{value:!0});CE.PgInstrumentation=void 0;var mn=ne(),Ie=(b(),N(v)),Dz=Nz(),ke=vz(),Uz=FO(),wz=Lz(),kz=ob(),bE=Te(),wr=(le(),N(Ae)),Cd=rb();function ju(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var ib=class extends mn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(wz.PACKAGE_NAME,wz.PACKAGE_VERSION,e),this._semconvStability=(0,mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(wr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.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(Cd.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(Cd.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new mn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new mn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new mn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=ju(a);return this._patchPgClient(c.Client),a},a=>{let c=ju(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new mn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=ju(a);return(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=ju(a);(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(kz.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Gz(i,a)}}recordOperationDuration(e,n){let r={},o=[wr.ATTR_DB_NAMESPACE,wr.ATTR_ERROR_TYPE,wr.ATTR_SERVER_PORT,wr.ATTR_SERVER_ADDRESS,wr.ATTR_DB_OPERATION_NAME];this._semconvStability&mn.SemconvStability.OLD&&o.push(Cd.ATTR_DB_SYSTEM),this._semconvStability&mn.SemconvStability.STABLE&&o.push(wr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,bE.hrTimeToMilliseconds)((0,bE.hrTimeDuration)(n,(0,bE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,bE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,p={[Cd.ATTR_DB_SYSTEM]:Cd.DB_SYSTEM_VALUE_POSTGRESQL,[wr.ATTR_DB_NAMESPACE]:this.database,[wr.ATTR_SERVER_PORT]:this.connectionParameters.port,[wr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[wr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,Uz.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,Uz.addSqlCommenterComment)(f,i.text)})),o.length>0){let T=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),T&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let g=ke.patchCallback(e.getConfig(),f,l.callback,p,d);T&&(g=Ie.context.bind(Ie.context.active(),g)),o[0].callback=g}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,mn.safeExecuteInTheMiddle)(()=>{let{database:T,host:g,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:T,host:g,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let h;try{h=n.apply(this,o)}catch(T){throw T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(T)}),f.end(),T}return h instanceof Promise?h.then(T=>new Promise(g=>{ke.handleExecutionResult(e.getConfig(),f,T),d(),f.end(),g(T)})).catch(T=>new Promise((g,R)=>{T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:T.message}),d(),f.end(),R(T)})):h})}_setPoolConnectEventListeners(e){if(e[Dz.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[Dz.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(kz.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Gz(i,a)}}};CE.PgInstrumentation=ib;function Gz(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var jz=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.AttributeNames=Hu.PgInstrumentation=void 0;var EAe=Bz();Object.defineProperty(Hu,"PgInstrumentation",{enumerable:!0,get:function(){return EAe.PgInstrumentation}});var gAe=nb();Object.defineProperty(Hu,"AttributeNames",{enumerable:!0,get:function(){return gAe.AttributeNames}})});var zz=E(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SeverityNumber=void 0;var IAe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(IAe=Pd.SeverityNumber||(Pd.SeverityNumber={}))});var ME=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.NOOP_LOGGER=Fu.NoopLogger=void 0;var PE=class{emit(e){}};Fu.NoopLogger=PE;Fu.NOOP_LOGGER=new PE});var vE=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.NOOP_LOGGER_PROVIDER=Vu.NoopLoggerProvider=void 0;var NAe=ME(),xE=class{getLogger(e,n,r){return new NAe.NoopLogger}};Vu.NoopLoggerProvider=xE;Vu.NOOP_LOGGER_PROVIDER=new xE});var lb=E(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.ProxyLogger=void 0;var OAe=ME(),ub=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):OAe.NOOP_LOGGER}};LE.ProxyLogger=ub});var db=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.ProxyLoggerProvider=void 0;var bAe=vE(),CAe=lb(),pb=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new CAe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:bAe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};DE.ProxyLoggerProvider=pb});var Kz=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE._globalThis=void 0;UE._globalThis=typeof globalThis=="object"?globalThis:global});var Qz=E(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE._globalThis=void 0;var PAe=Kz();Object.defineProperty(wE,"_globalThis",{enumerable:!0,get:function(){return PAe._globalThis}})});var Xz=E(kE=>{"use strict";Object.defineProperty(kE,"__esModule",{value:!0});kE._globalThis=void 0;var MAe=Qz();Object.defineProperty(kE,"_globalThis",{enumerable:!0,get:function(){return MAe._globalThis}})});var Jz=E(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.API_BACKWARDS_COMPATIBILITY_VERSION=_o.makeGetter=_o._global=_o.GLOBAL_LOGS_API_KEY=void 0;var xAe=Xz();_o.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");_o._global=xAe._globalThis;function vAe(t,e,n){return r=>r===t?e:n}_o.makeGetter=vAe;_o.API_BACKWARDS_COMPATIBILITY_VERSION=1});var eK=E(GE=>{"use strict";Object.defineProperty(GE,"__esModule",{value:!0});GE.LogsAPI=void 0;var mr=Jz(),LAe=vE(),Zz=db(),_b=class t{constructor(){this._proxyLoggerProvider=new Zz.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return mr._global[mr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(mr._global[mr.GLOBAL_LOGS_API_KEY]=(0,mr.makeGetter)(mr.API_BACKWARDS_COMPATIBILITY_VERSION,e,LAe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=mr._global[mr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(mr._global,mr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete mr._global[mr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Zz.ProxyLoggerProvider}};GE.LogsAPI=_b});var fb=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.logs=Ct.ProxyLoggerProvider=Ct.ProxyLogger=Ct.NoopLoggerProvider=Ct.NOOP_LOGGER_PROVIDER=Ct.NoopLogger=Ct.NOOP_LOGGER=Ct.SeverityNumber=void 0;var DAe=zz();Object.defineProperty(Ct,"SeverityNumber",{enumerable:!0,get:function(){return DAe.SeverityNumber}});var tK=ME();Object.defineProperty(Ct,"NOOP_LOGGER",{enumerable:!0,get:function(){return tK.NOOP_LOGGER}});Object.defineProperty(Ct,"NoopLogger",{enumerable:!0,get:function(){return tK.NoopLogger}});var nK=vE();Object.defineProperty(Ct,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return nK.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Ct,"NoopLoggerProvider",{enumerable:!0,get:function(){return nK.NoopLoggerProvider}});var UAe=lb();Object.defineProperty(Ct,"ProxyLogger",{enumerable:!0,get:function(){return UAe.ProxyLogger}});var wAe=db();Object.defineProperty(Ct,"ProxyLoggerProvider",{enumerable:!0,get:function(){return wAe.ProxyLoggerProvider}});var kAe=eK();Ct.logs=kAe.LogsAPI.getInstance()});var rK=E(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.disableInstrumentations=qu.enableInstrumentations=void 0;function GAe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}qu.enableInstrumentations=GAe;function BAe(t){t.forEach(e=>e.disable())}qu.disableInstrumentations=BAe});var iK=E(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.registerInstrumentations=void 0;var oK=(b(),N(v)),jAe=fb(),sK=rK();function HAe(t){let e=t.tracerProvider||oK.trace.getTracerProvider(),n=t.meterProvider||oK.metrics.getMeterProvider(),r=t.loggerProvider||jAe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,sK.enableInstrumentations)(o,e,n,r),()=>{(0,sK.disableInstrumentations)(o)}}BE.registerInstrumentations=HAe});var mK=E(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.satisfies=void 0;var Eb=(b(),N(v)),pK=/^(?: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-]+)*))?$/,FAe=/^(?<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-]+)*))?$/,VAe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function qAe(t,e,n){if(!$Ae(t))return Eb.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=KAe(t);if(!r)return!1;let o=[],s=dK(r,e,o,n);return s&&!n?.includePrerelease?WAe(r,o):s}jE.satisfies=qAe;function $Ae(t){return typeof t=="string"&&pK.test(t)}function dK(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(mb(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=hRe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!mb(t,s,n,r))return!1;return!0}return mb(t,e,n,r)}function mb(t,e,n,r){if(e=zAe(e,r),e.includes(" "))return dK(t,e,n,r);{let o=QAe(e);return n.push(o),YAe(t,o)}}function YAe(t,e){if(e.invalid)return!1;if(!e.version||Tb(e.version))return!0;let n=cK(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=cK(r,o)}return VAe[e.op]?.includes(n)}function WAe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function zAe(t,e){return t=t.trim(),t=fRe(t,e),t=_Re(t),t=mRe(t,e),t=t.trim(),t}function hn(t){return!t||t.toLowerCase()==="x"||t==="*"}function KAe(t){let e=t.match(pK);if(!e){Eb.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function QAe(t){if(!t)return{};let e=t.match(FAe);if(!e)return Eb.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function Tb(t){return t==="*"||t==="x"||t==="X"}function aK(t){let e=parseInt(t,10);return isNaN(e)?t:e}function XAe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function JAe(t,e){if(Tb(t)||Tb(e))return 0;let[n,r]=XAe(aK(t),aK(e));return n>r?1:n<r?-1:0}function cK(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=JAe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var _K="[a-zA-Z0-9-]",fK="0|[1-9]\\d*",ZAe=`\\d*[a-zA-Z-]${_K}*`,eRe="((?:<|>)?=?)",uK=`(?:${fK}|${ZAe})`,tRe=`(?:-(${uK}(?:\\.${uK})*))`,lK=`${_K}+`,nRe=`(?:\\+(${lK}(?:\\.${lK})*))`,hb=`${fK}|x|X|\\*`,Md=`[v=\\s]*(${hb})(?:\\.(${hb})(?:\\.(${hb})(?:${tRe})?${nRe}?)?)?`,rRe=`^${eRe}\\s*${Md}$`,oRe=new RegExp(rRe),sRe=`^\\s*(${Md})\\s+-\\s+(${Md})\\s*$`,iRe=new RegExp(sRe),aRe="(?:~>?)",cRe=`^${aRe}${Md}$`,uRe=new RegExp(cRe),lRe="(?:\\^)",pRe=`^${lRe}${Md}$`,dRe=new RegExp(pRe);function _Re(t){let e=uRe;return t.replace(e,(n,r,o,s,i)=>{let a;return hn(r)?a="":hn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:hn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function fRe(t,e){let n=dRe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return hn(s)?l="":hn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:hn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function mRe(t,e){let n=oRe;return t.replace(n,(r,o,s,i,a,c)=>{let l=hn(s),p=l||hn(i),d=p||hn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function hRe(t,e){let n=iRe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(hn(s)?o="":hn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:hn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,hn(d)?p="":hn(_)?p=`<${+d+1}.0.0-0`:hn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var gb=E(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.massUnwrap=jt.unwrap=jt.massWrap=jt.wrap=void 0;var Tn=console.error.bind(console);function xd(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var TRe=(t,e,n)=>{if(!t||!t[e]){Tn("no original function "+String(e)+" to wrap");return}if(!n){Tn("no wrapper function"),Tn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Tn("original object and wrapper must be functions");return}let o=n(r,e);return xd(o,"__original",r),xd(o,"__unwrap",()=>{t[e]===o&&xd(t,e,r)}),xd(o,"__wrapped",!0),xd(t,e,o),o};jt.wrap=TRe;var ERe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,jt.wrap)(r,o,n)})})};jt.massWrap=ERe;var gRe=(t,e)=>{if(!t||!t[e]){Tn("no function to unwrap."),Tn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Tn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};jt.unwrap=gRe;var SRe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,jt.unwrap)(n,r)})})};jt.massUnwrap=SRe;function vd(t){t&&t.logger&&(typeof t.logger!="function"?Tn("new logger isn't a function, not replacing"):Tn=t.logger)}jt.default=vd;vd.wrap=jt.wrap;vd.massWrap=jt.massWrap;vd.unwrap=jt.unwrap;vd.massUnwrap=jt.massUnwrap});var hK=E(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0});FE.InstrumentationAbstract=void 0;var Sb=(b(),N(v)),ARe=fb(),HE=gb(),Ab=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=Sb.diag.createComponentLogger({namespace:e}),this._tracer=Sb.trace.getTracer(e,n),this._meter=Sb.metrics.getMeter(e,n),this._logger=ARe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=HE.wrap;_unwrap=HE.unwrap;_massWrap=HE.massWrap;_massUnwrap=HE.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};FE.InstrumentationAbstract=Ab});var TK=E(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ModuleNameTrie=ti.ModuleNameSeparator=void 0;ti.ModuleNameSeparator="/";var VE=class{hooks=[];children=new Map},Rb=class{_trie=new VE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ti.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new VE,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ti.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ti.ModuleNameTrie=Rb});var gK=E(qE=>{"use strict";Object.defineProperty(qE,"__esModule",{value:!0});qE.RequireInTheMiddleSingleton=void 0;var RRe=ki(),EK=U("path"),yb=TK(),yRe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Ib=class t{_moduleNameTrie=new yb.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new RRe.Hook(null,{internals:!0},(e,n,r)=>{let o=IRe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return yRe?new t:this._instance=this._instance??new t}};qE.RequireInTheMiddleSingleton=Ib;function IRe(t){return EK.sep!==yb.ModuleNameSeparator?t.split(EK.sep).join(yb.ModuleNameSeparator):t}});var Nb=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.isWrapped=ni.safeExecuteInTheMiddleAsync=ni.safeExecuteInTheMiddle=void 0;function NRe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddle=NRe;async function ORe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddleAsync=ORe;function bRe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ni.isWrapped=bRe});var RK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.InstrumentationBase=void 0;var Ld=U("path"),SK=U("util"),CRe=mK(),Ob=gb(),PRe=hK(),MRe=gK(),xRe=iO(),Dd=(b(),N(v)),vRe=ki(),LRe=U("fs"),DRe=Nb(),bb=class extends PRe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=MRe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,DRe.isWrapped)(e[n])&&this._unwrap(e,n),SK.types.isProxy(e)){let o=(0,Ob.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,Ob.wrap)(e,n,r)};_unwrap=(e,n)=>SK.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,Ob.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,LRe.readFileSync)(Ld.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Dd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return AK(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Ld.normalize(r);return i.filter(l=>l.name===a).filter(l=>AK(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Ld.isAbsolute(a)){let l=Ld.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Ld.isAbsolute(e.name)?new vRe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new xRe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};$E.InstrumentationBase=bb;function AK(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,CRe.satisfies)(e,r,{includePrerelease:n}))}});var yK=E(YE=>{"use strict";Object.defineProperty(YE,"__esModule",{value:!0});YE.normalize=void 0;var URe=U("path");Object.defineProperty(YE,"normalize",{enumerable:!0,get:function(){return URe.normalize}})});var IK=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.normalize=$u.InstrumentationBase=void 0;var wRe=RK();Object.defineProperty($u,"InstrumentationBase",{enumerable:!0,get:function(){return wRe.InstrumentationBase}});var kRe=yK();Object.defineProperty($u,"normalize",{enumerable:!0,get:function(){return kRe.normalize}})});var Cb=E(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.normalize=Yu.InstrumentationBase=void 0;var NK=IK();Object.defineProperty(Yu,"InstrumentationBase",{enumerable:!0,get:function(){return NK.InstrumentationBase}});Object.defineProperty(Yu,"normalize",{enumerable:!0,get:function(){return NK.normalize}})});var OK=E(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});WE.InstrumentationNodeModuleDefinition=void 0;var Pb=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};WE.InstrumentationNodeModuleDefinition=Pb});var bK=E(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});zE.InstrumentationNodeModuleFile=void 0;var GRe=Cb(),Mb=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,GRe.normalize)(e)}};zE.InstrumentationNodeModuleFile=Mb});var CK=E(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.semconvStabilityFromStr=Aa.SemconvStability=void 0;var KE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(KE=Aa.SemconvStability||(Aa.SemconvStability={}));function BRe(t,e){let n=KE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=KE.DUPLICATE;break}else o.toLowerCase()===t&&(n=KE.STABLE);return n}Aa.semconvStabilityFromStr=BRe});var MK=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var jRe=iK();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return jRe.registerInstrumentations}});var HRe=Cb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return HRe.InstrumentationBase}});var FRe=OK();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return FRe.InstrumentationNodeModuleDefinition}});var VRe=bK();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return VRe.InstrumentationNodeModuleFile}});var xb=Nb();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return xb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return xb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return xb.safeExecuteInTheMiddleAsync}});var PK=CK();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return PK.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return PK.semconvStabilityFromStr}})});var jK=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.PACKAGE_NAME=zu.PACKAGE_VERSION=void 0;zu.PACKAGE_VERSION="0.60.0";zu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Ub=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HapiLifecycleMethodNames=fo.HapiLayerType=fo.handlerPatched=fo.HapiComponentName=void 0;fo.HapiComponentName="@hapi/hapi";fo.handlerPatched=Symbol("hapi-handler-patched");fo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};fo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var HK=E(XE=>{"use strict";Object.defineProperty(XE,"__esModule",{value:!0});XE.ATTR_HTTP_METHOD=void 0;XE.ATTR_HTTP_METHOD="http.method"});var wb=E(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.AttributeNames=void 0;var sye;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(sye=Ud.AttributeNames||(Ud.AttributeNames={}))});var qK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var FK=(le(),N(Ae)),iye=HK(),wd=Ub(),ri=wb(),VK=ne();function aye(t){return t.name?t.name:t.pkg.name}lt.getPluginName=aye;var cye=t=>typeof t=="string"&&wd.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=cye;var uye=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=uye;var lye=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=lye;var pye=t=>!Array.isArray(t);lt.isPatchableExtMethod=pye;var dye=(t,e,n)=>{let r={[FK.ATTR_HTTP_ROUTE]:t.path};e&VK.SemconvStability.OLD&&(r[iye.ATTR_HTTP_METHOD]=t.method),e&VK.SemconvStability.STABLE&&(r[FK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.PLUGIN,r[ri.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=dye;var _ye=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT,[ri.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT},name:r}};lt.getExtMetadata=_ye;var fye=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=fye});var WK=E(JE=>{"use strict";Object.defineProperty(JE,"__esModule",{value:!0});JE.HapiInstrumentation=void 0;var Wn=(b(),N(v)),$K=Te(),kd=ne(),YK=jK(),Gd=Ub(),Qo=qK(),kb=class extends kd.InstrumentationBase{_semconvStability;constructor(e={}){super(YK.PACKAGE_NAME,YK.PACKAGE_VERSION,e),this._semconvStability=(0,kd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new kd.InstrumentationNodeModuleDefinition(Gd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,kd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,kd.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,Qo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Qo.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,Qo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Qo.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,Qo.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,Qo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,Qo.isPatchableExtMethod)(e))return e[Gd.handlerPatched]===!0?e:(e[Gd.handlerPatched]=!0,async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await e.apply(this,i);let a=(0,Qo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:Wn.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Gd.handlerPatched]===!0)return e;e[Gd.handlerPatched]=!0;let o=s=>async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await s.call(this,...i);let a=(0,$K.getRPCMetadata)(Wn.context.active());a?.type===$K.RPCType.HTTP&&(a.route=e.path);let c=(0,Qo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:Wn.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};JE.HapiInstrumentation=kb});var zK=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AttributeNames=Ku.HapiInstrumentation=void 0;var mye=WK();Object.defineProperty(Ku,"HapiInstrumentation",{enumerable:!0,get:function(){return mye.HapiInstrumentation}});var hye=wb();Object.defineProperty(Ku,"AttributeNames",{enumerable:!0,get:function(){return hye.AttributeNames}})});var tg=E(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.KoaLayerType=void 0;var Rye;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(Rye=jd.KoaLayerType||(jd.KoaLayerType={}))});var n2=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PACKAGE_NAME=Qu.PACKAGE_VERSION=void 0;Qu.PACKAGE_VERSION="0.62.0";Qu.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var Gb=E(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.AttributeNames=void 0;var yye;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(yye=Hd.AttributeNames||(Hd.AttributeNames={}))});var o2=E(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.isLayerIgnored=Xu.getMiddlewareMetadata=void 0;var r2=tg(),ng=Gb(),Iye=(le(),N(Ae)),Nye=(t,e,n,r)=>n?{attributes:{[ng.AttributeNames.KOA_NAME]:r?.toString(),[ng.AttributeNames.KOA_TYPE]:r2.KoaLayerType.ROUTER,[Iye.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[ng.AttributeNames.KOA_NAME]:e.name??"middleware",[ng.AttributeNames.KOA_TYPE]:r2.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Xu.getMiddlewareMetadata=Nye;var Oye=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Xu.isLayerIgnored=Oye});var s2=E(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});rg.kLayerPatched=void 0;rg.kLayerPatched=Symbol("koa-layer-patched")});var p2=E(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.KoaInstrumentation=void 0;var mo=(b(),N(v)),Fd=ne(),i2=tg(),a2=n2(),c2=o2(),u2=Te(),l2=s2(),Bb=class extends Fd.InstrumentationBase{constructor(e={}){super(a2.PACKAGE_NAME,a2.PACKAGE_VERSION,e)}init(){return new Fd.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){mo.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?i2.KoaLayerType.ROUTER:i2.KoaLayerType.MIDDLEWARE;return e[l2.kLayerPatched]===!0||(0,c2.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(mo.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[l2.kLayerPatched]=!0,mo.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(mo.trace.getSpan(mo.context.active())===void 0)return e(s,i);let c=(0,c2.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,u2.getRPCMetadata)(mo.context.active());p?.type===u2.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Fd.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&mo.diag.error("koa instrumentation: request hook failed",f)},!0);let _=mo.trace.setSpan(mo.context.active(),l);return mo.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};og.KoaInstrumentation=Bb});var d2=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.KoaLayerType=si.AttributeNames=si.KoaInstrumentation=void 0;var bye=p2();Object.defineProperty(si,"KoaInstrumentation",{enumerable:!0,get:function(){return bye.KoaInstrumentation}});var Cye=Gb();Object.defineProperty(si,"AttributeNames",{enumerable:!0,get:function(){return Cye.AttributeNames}});var Pye=tg();Object.defineProperty(si,"KoaLayerType",{enumerable:!0,get:function(){return Pye.KoaLayerType}})});var jb=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.ConnectNames=kr.ConnectTypes=kr.AttributeNames=void 0;var xye;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(xye=kr.AttributeNames||(kr.AttributeNames={}));var vye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(vye=kr.ConnectTypes||(kr.ConnectTypes={}));var Lye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(Lye=kr.ConnectNames||(kr.ConnectNames={}))});var T2=E(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.PACKAGE_NAME=Ju.PACKAGE_VERSION=void 0;Ju.PACKAGE_VERSION="0.57.0";Ju.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var E2=E(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});sg._LAYERS_STORE_PROPERTY=void 0;sg._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var g2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.generateRoute=ai.replaceCurrentStackRoute=ai.addNewStackLayer=void 0;var Dye=(b(),N(v)),ii=E2(),Uye=t=>{Array.isArray(t[ii._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ii._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ii._LAYERS_STORE_PROPERTY].push("/");let e=t[ii._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ii._LAYERS_STORE_PROPERTY].length?t[ii._LAYERS_STORE_PROPERTY].pop():Dye.diag.warn("Connect: Trying to pop the stack multiple time")}};ai.addNewStackLayer=Uye;var wye=(t,e)=>{e&&t[ii._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ai.replaceCurrentStackRoute=wye;var kye=t=>t[ii._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ai.generateRoute=kye});var R2=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.ConnectInstrumentation=ci.ANONYMOUS_NAME=void 0;var Gye=(b(),N(v)),S2=Te(),Zu=jb(),A2=T2(),ig=ne(),Bye=(le(),N(Ae)),Hb=g2();ci.ANONYMOUS_NAME="anonymous";var Fb=class extends ig.InstrumentationBase{constructor(e={}){super(A2.PACKAGE_NAME,A2.PACKAGE_VERSION,e)}init(){return[new ig.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,ig.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,ig.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=Zu.ConnectTypes.REQUEST_HANDLER,s=Zu.ConnectNames.REQUEST_HANDLER,o=e):(r=Zu.ConnectTypes.MIDDLEWARE,s=Zu.ConnectNames.MIDDLEWARE,o=n.name||ci.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[Bye.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[Zu.AttributeNames.CONNECT_TYPE]:r,[Zu.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],l=arguments[i],p=arguments[a],d=arguments[c];(0,Hb.replaceCurrentStackRoute)(l,e);let _=(0,S2.getRPCMetadata)(Gye.context.active());e&&_?.type===S2.RPCType.HTTP&&(_.route=(0,Hb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ci.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let h=!1;function T(){h?r._diag.debug(`span ${m.name} - already finished`):(h=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",T)}return p.addListener("close",T),arguments[c]=r._patchNext(d,T),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,Hb.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ci.ConnectInstrumentation=Fb});var I2=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.ConnectTypes=hr.ConnectNames=hr.AttributeNames=hr.ANONYMOUS_NAME=hr.ConnectInstrumentation=void 0;var y2=R2();Object.defineProperty(hr,"ConnectInstrumentation",{enumerable:!0,get:function(){return y2.ConnectInstrumentation}});Object.defineProperty(hr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return y2.ANONYMOUS_NAME}});var Vb=jb();Object.defineProperty(hr,"AttributeNames",{enumerable:!0,get:function(){return Vb.AttributeNames}});Object.defineProperty(hr,"ConnectNames",{enumerable:!0,get:function(){return Vb.ConnectNames}});Object.defineProperty(hr,"ConnectTypes",{enumerable:!0,get:function(){return Vb.ConnectTypes}})});var P2=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.DB_SYSTEM_VALUE_MSSQL=Pt.ATTR_NET_PEER_PORT=Pt.ATTR_NET_PEER_NAME=Pt.ATTR_DB_USER=Pt.ATTR_DB_SYSTEM=Pt.ATTR_DB_STATEMENT=Pt.ATTR_DB_SQL_TABLE=Pt.ATTR_DB_NAME=void 0;Pt.ATTR_DB_NAME="db.name";Pt.ATTR_DB_SQL_TABLE="db.sql.table";Pt.ATTR_DB_STATEMENT="db.statement";Pt.ATTR_DB_SYSTEM="db.system";Pt.ATTR_DB_USER="db.user";Pt.ATTR_NET_PEER_NAME="net.peer.name";Pt.ATTR_NET_PEER_PORT="net.peer.port";Pt.DB_SYSTEM_VALUE_MSSQL="mssql"});var M2=E(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.once=el.getSpanName=void 0;function Hye(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}el.getSpanName=Hye;var Fye=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};el.once=Fye});var x2=E(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.PACKAGE_NAME=tl.PACKAGE_VERSION=void 0;tl.PACKAGE_VERSION="0.33.0";tl.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var w2=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.TediousInstrumentation=li.INJECTED_CTX=void 0;var nl=(b(),N(v)),Vye=U("events"),ho=ne(),Ra=(le(),N(Ae)),ui=P2(),v2=M2(),L2=x2(),U2=Symbol("opentelemetry.instrumentation-tedious.current-database");li.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var D2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function ag(t){Object.defineProperty(this,U2,{value:t,writable:!0})}var qb=class t extends ho.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(L2.PACKAGE_NAME,L2.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ho.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ho.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new ho.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of D2)(0,ho.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,ho.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of D2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return ag.call(this,this.config?.options?.database),this.removeListener("databaseChange",ag),this.on("databaseChange",ag),this.once("end",()=>{this.removeListener("databaseChange",ag)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||nl.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,li.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[li.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof Vye.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[U2],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_DB_SYSTEM]=ui.DB_SYSTEM_VALUE_MSSQL,f[ui.ATTR_DB_NAME]=d,f[ui.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[ui.ATTR_DB_STATEMENT]=_,f[ui.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_DB_NAMESPACE]=d,f[Ra.ATTR_DB_SYSTEM_NAME]=Ra.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[Ra.ATTR_DB_QUERY_TEXT]=_,f[Ra.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_NET_PEER_NAME]=this.config?.server,f[ui.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_SERVER_ADDRESS]=this.config?.server,f[Ra.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,v2.getSpanName)(e,d,_,i.table),{kind:nl.SpanKind.CLIENT,attributes:f}),h=(0,v2.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",h),this.removeListener("end",h),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:nl.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",h),this.on("end",h),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(h)):o._diag.error("Expected request.callback to be a function");let T=()=>nl.context.with(nl.trace.setSpan(nl.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return T();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(T)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};li.TediousInstrumentation=qb});var k2=E(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.TediousInstrumentation=void 0;var qye=w2();Object.defineProperty(cg,"TediousInstrumentation",{enumerable:!0,get:function(){return qye.TediousInstrumentation}})});var F2=E(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.PACKAGE_NAME=rl.PACKAGE_VERSION=void 0;rl.PACKAGE_VERSION="0.57.0";rl.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var q2=E(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.GenericPoolInstrumentation=void 0;var ol=(b(),N(v)),ya=ne(),V2=F2(),$b="generic-pool",Yb=class extends ya.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(V2.PACKAGE_NAME,V2.PACKAGE_VERSION,e)}init(){return[new ya.InstrumentationNodeModuleDefinition($b,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition($b,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition($b,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,ya.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=ol.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return ol.context.with(ol.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=ol.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return ol.context.with(ol.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};ug.GenericPoolInstrumentation=Yb});var $2=E(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});lg.GenericPoolInstrumentation=void 0;var Wye=q2();Object.defineProperty(lg,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return Wye.GenericPoolInstrumentation}})});var Wb=E(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ATTR_NET_PEER_PORT=To.ATTR_NET_PEER_NAME=To.ATTR_MESSAGING_SYSTEM=To.ATTR_MESSAGING_OPERATION=void 0;To.ATTR_MESSAGING_OPERATION="messaging.operation";To.ATTR_MESSAGING_SYSTEM="messaging.system";To.ATTR_NET_PEER_NAME="net.peer.name";To.ATTR_NET_PEER_PORT="net.peer.port"});var zb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var Kb=E(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.DEFAULT_CONFIG=Ia.EndOperation=void 0;var Kye;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(Kye=Ia.EndOperation||(Ia.EndOperation={}));Ia.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var Z2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var Qb=(b(),N(v)),pi=ne(),pg=(le(),N(Ae)),Vd=Wb(),dg=zb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Xb=(0,Qb.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),Qye=t=>t!==""?t:"<default>";$e.normalizeExchange=Qye;var Xye=t=>t.replace(/:[^:@/]*@/,":***@"),Q2=(t,e)=>t||(e==="AMQP"?5672:5671),X2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},J2=t=>t||"localhost",Eo=(t,e,n,r)=>n?{[e]:n}:(Qb.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),Jye=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Vd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=Jye;var Zye=(t,e)=>{let n={[dg.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=X2(r?.protocol);Object.assign(n,{...Eo(t,dg.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=J2(r?.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(t,Vd.ATTR_NET_PEER_NAME,s,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(t,pg.ATTR_SERVER_ADDRESS,s,"hostname")});let i=Q2(r.port,o);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(t,Vd.ATTR_NET_PEER_PORT,i,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(t,pg.ATTR_SERVER_PORT,i,"port"))}else{let r=Xye(t);n[dg.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=X2(o.protocol);Object.assign(n,{...Eo(r,dg.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=J2(o.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(r,Vd.ATTR_NET_PEER_NAME,i,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(r,pg.ATTR_SERVER_ADDRESS,i,"hostname")});let a=Q2(o.port?parseInt(o.port):void 0,s);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(r,Vd.ATTR_NET_PEER_PORT,a,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(r,pg.ATTR_SERVER_PORT,a,"port"))}catch(o){Qb.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=Zye;var eIe=t=>t.setValue(Xb,!0);$e.markConfirmChannelTracing=eIe;var tIe=t=>t.deleteValue(Xb);$e.unmarkConfirmChannelTracing=tIe;var nIe=t=>t.getValue(Xb)===!0;$e.isConfirmChannelTracing=nIe});var e4=E(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.PACKAGE_NAME=sl.PACKAGE_VERSION=void 0;sl.PACKAGE_VERSION="0.61.0";sl.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var n4=E(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});mg.AmqplibInstrumentation=void 0;var Ge=(b(),N(v)),_g=Te(),Ee=ne(),rIe=Wb(),zn=zb(),En=Kb(),Ye=Z2(),t4=e4(),fg=[">=0.5.5 <1"],Jb=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(t4.PACKAGE_NAME,t4.PACKAGE_VERSION,{...En.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...En.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",fg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",fg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",fg,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",fg,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,En.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,En.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,En.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,En.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,En.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let l=this,p=n===En.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==En.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let h=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:f,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[rIe.ATTR_MESSAGING_OPERATION]:zn.MESSAGING_OPERATION_VALUE_PROCESS,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:T}=r.getConfig();T&&(0,Ee.safeExecuteInTheMiddle)(()=>T(h,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,_g.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=h);let g=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(g,h),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(h,p,!1,En.EndOperation.AutoAck),h.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),g=>{g&&Ge.diag.error("amqplib instrumentation: publishHook error",g)},!0);let m=function(g,R){try{l?.call(this,g,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:g}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),g&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},h=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),T=[...arguments];return T[3]=_,T[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(h,d)),m),Ge.context.with(h,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),h=>{h&&Ge.diag.error("amqplib instrumentation: publishHook error",h)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:n,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==En.EndOperation.ChannelClosed&&r!==En.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,_g.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,_g.hrTimeDuration)(i.timeOfConsume,n);if((0,_g.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,En.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};mg.AmqplibInstrumentation=Jb});var o4=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.EndOperation=di.DEFAULT_CONFIG=di.AmqplibInstrumentation=void 0;var oIe=n4();Object.defineProperty(di,"AmqplibInstrumentation",{enumerable:!0,get:function(){return oIe.AmqplibInstrumentation}});var r4=Kb();Object.defineProperty(di,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return r4.DEFAULT_CONFIG}});Object.defineProperty(di,"EndOperation",{enumerable:!0,get:function(){return r4.EndOperation}})});b();var oq=K(CG(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function cn(){return fs(J),J}function fs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ir(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var ql=["debug","info","warn","error","log","assert","trace"],oae="Sentry Logger ",Tc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(Tc);r.forEach(o=>{let s=Tc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function sae(){yR().enabled=!0}function iae(){yR().enabled=!1}function PG(){return yR().enabled}function aae(...t){RR("log",...t)}function cae(...t){RR("warn",...t)}function uae(...t){RR("error",...t)}function RR(t,...e){C&&PG()&&Qe(()=>{J.console[t](`${oae}[${t}]:`,...e)})}function yR(){return C?Ir("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var S={enable:sae,disable:iae,isEnabled:PG,log:aae,warn:cae,error:uae};var Lf="?",MG=/\(error: (.*)\)/,xG=/captureMessage|captureException/;function Df(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
|
|
13
|
+
`);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=MG.test(c)?c.replace(MG,"$1"):c;if(!l.match(/\S*Error: /)){for(let p of e){let d=p(l);if(d){s.push(d);break}}if(s.length>=50+o)break}}return vG(s.slice(o))}}function NR(t){return Array.isArray(t)?Df(...t):t}function vG(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(vf(e).function||"")&&e.pop(),e.reverse(),xG.test(vf(e).function||"")&&(e.pop(),xG.test(vf(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||vf(e).filename,function:n.function||Lf}))}function vf(t){return t[t.length-1]||{}}var IR="<anonymous>";function $l(t){try{return!t||typeof t!="function"?IR:t.name||IR}catch{return IR}}function Uf(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function LG(t){let e=t?.startsWith("file://")?t.slice(7):t;return e?.match(/\/[A-Z]:/)&&(e=e.slice(1)),e}var wf={},DG={};function Ec(t,e){wf[t]=wf[t]||[],wf[t].push(e)}function gc(t,e){if(!DG[t]){DG[t]=!0;try{e()}catch(n){C&&S.error(`Error while instrumenting ${t}`,n)}}}function Sc(t,e){let n=t&&wf[t];if(n)for(let r of n)try{r(e)}catch(o){C&&S.error(`Error while triggering instrumentation handler.
|
|
14
14
|
Type: ${t}
|
|
15
15
|
Name: ${$l(r)}
|
|
16
|
-
Error:`,o)}}var IR=null;function vG(t){let e="error";Ec(e,t),Sc(e,cae)}function cae(){IR=J.onerror,J.onerror=function(t,e,n,r,o){return gc("error",{column:r,error:o,line:n,msg:t,url:e}),IR?IR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var OR=null;function LG(t){let e="unhandledrejection";Ec(e,t),Sc(e,uae)}function uae(){OR=J.onunhandledrejection,J.onunhandledrejection=function(t){return gc("unhandledrejection",t),OR?OR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var DG=Object.prototype.toString;function Kr(t){switch(DG.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qr(t,Error)}}function Uf(t,e){return DG.call(t)===`[object ${e}]`}function NR(t){return Uf(t,"ErrorEvent")}function ms(t){return Uf(t,"String")}function Ac(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yl(t){return t===null||Ac(t)||typeof t!="object"&&typeof t!="function"}function Mo(t){return Uf(t,"Object")}function bR(t){return typeof Event<"u"&&Qr(t,Event)}function CR(t){return typeof Element<"u"&&Qr(t,Element)}function PR(t){return Uf(t,"RegExp")}function Lt(t){return!!(t?.then&&typeof t.then=="function")}function MR(t){return Mo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Qr(t,e){try{return t instanceof e}catch{return!1}}function Wl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var lae=J,pae=80;function UG(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||pae;for(;n&&s++<r&&(l=dae(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function dae(t,e){let n=t,r=[];if(!n?.tagName)return"";if(lae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ms(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function xR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&GG(o,r);try{t[e]=o}catch{C&&g.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function GG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function vR(t){return t.__sentry_original__}function wf(t){if(Kr(t))return{message:t.message,name:t.name,stack:t.stack,...kG(t)};if(bR(t)){let e={type:t.type,target:wG(t.target),currentTarget:wG(t.currentTarget),...kG(t)};return typeof CustomEvent<"u"&&Qr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function wG(t){try{return CR(t)?UG(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function kG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function LR(t){let e=Object.keys(wf(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var Rc;function Bi(t){if(Rc!==void 0)return Rc?Rc(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Rc=n[e],Rc(t)):(Rc=null,t())}function yt(){return Bi(()=>Math.random())}function Zn(){return Bi(()=>Date.now())}function hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function DR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function UR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Wl(o)?n.push(Lf(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function xo(t,e,n=!1){return ms(t)?PR(e)?e.test(t):ms(e)?n?t===e:t.includes(e):!1:!1}function Ts(t,e=[],n=!1){return e.some(r=>xo(t,r,n))}function _ae(){let t=J;return t.crypto||t.msCrypto}var wR;function fae(){return yt()*16}function _t(t=_ae()){try{if(t?.randomUUID)return Bi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return wR||(wR="10000000100040008000"+1e11),wR.replace(/[018]/g,e=>(e^(fae()&15)>>e/4).toString(16))}function BG(t){return t.exception?.values?.[0]}function Es(t){let{message:e,event_id:n}=t;if(e)return e;let r=BG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function GR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function yc(t,e){let n=BG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var mae=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function kR(t){return parseInt(t||"",10)}function BR(t){let e=t.match(mae)||[],n=kR(e[1]),r=kR(e[2]),o=kR(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function kf(t){if(jG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function jG(t){try{return t.__sentry_captured__}catch{}}var FG=1e3;function vo(){return Zn()/FG}function hae(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return vo;let e=t.timeOrigin;return()=>(e+Bi(()=>t.now()))/FG}var HG;function Ss(){return(HG??(HG=hae()))()}function VG(t){let e=Ss(),n={sid:_t(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Tae(n)};return t&&Lo(n,t),n}function Lo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ss(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_t()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function qG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Lo(t,n)}function Tae(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function gs(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=gs(r[o],e[o],n-1));return r}function zt(){return _t()}function Kt(){return _t().substring(16)}var jR="_sentrySpan";function ji(t,e){e?nt(t,jR,e):delete t[jR]}function Hi(t){return t[jR]}var Eae=100,An=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:zt(),sampleRand:yt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,ji(e,Hi(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():Mo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,ji(this,void 0),this._attachments=[],this.setPropagationContext({traceId:zt(),sampleRand:yt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:Eae;if(r<=0)return this;let o={timestamp:vo(),...e,message:e.message?hs(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Hi(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=gs(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||_t();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function Ic(){return Ir("defaultCurrentScope",()=>new An)}function er(){return Ir("defaultIsolationScope",()=>new An)}var $G=t=>t instanceof Promise&&!t[YG],YG=Symbol("chained PromiseLike"),Gf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return $G(r)&&$G(t)?r:Sae(t,r)},Sae=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[YG]:!0}),e};var HR=class{constructor(e,n){let r;e?r=e:r=new An;let o;n?o=n:o=new An,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return Lt(r)?Gf(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Oc(){let t=cn(),e=fs(t);return e.stack=e.stack||new HR(Ic(),er())}function gae(t){return Oc().withScope(t)}function Aae(t,e){let n=Oc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function WG(t){return Oc().withScope(()=>t(Oc().getIsolationScope()))}function zG(){return{withIsolationScope:WG,withScope:gae,withSetScope:Aae,withSetIsolationScope:(t,e)=>WG(e),getCurrentScope:()=>Oc().getScope(),getIsolationScope:()=>Oc().getIsolationScope()}}function FR(t){let e=cn(),n=fs(e);n.acs=t}function Or(t){let e=fs(t);return e.acs?e.acs:zG()}var KG;function QG(){return KG?.()}function VR(){return KG!==void 0}function he(){let t=cn();return Or(t).getCurrentScope()}function ue(){let t=cn();return Or(t).getIsolationScope()}function Bf(){return Ir("globalScope",()=>new An)}function Gn(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function zl(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return he().getClient()}function Fi(t){let e=QG();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||Kt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",Nr="sentry.sample_rate",qR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var $R="sentry.measurement_unit",YR="sentry.measurement_value",tr="sentry.custom_span_name",Nc="sentry.profile_id",bc="sentry.exclusive_time",WR="cache.hit",zR="cache.key",KR="cache.item_size",QR="http.request.method",As="url.full";var XR="gen_ai.conversation.id";function Do(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}var XG="_sentryScope",JG="_sentryIsolationScope";function Rae(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function yae(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function Kl(t,e,n){t&&(nt(t,JG,Rae(n)),nt(t,XG,e))}function br(t){let e=t;return{scope:e[XG],isolationScope:yae(e[JG])}}var Xr="sentry-";var eB=8192;function Uo(t){let e=qi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(Xr)){let i=o.slice(Xr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Vi(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Xr}${r}`]=o),n),{});return jf(e)}function qi(t){if(!(!t||!ms(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=ZG(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):ZG(t)}function ZG(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function jf(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>eB?(C&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var Iae=/^o(\d+)\./,Oae=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Nae(t){return t==="http"||t==="https"}function Bn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function bae(t){let e=Oae.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return tB({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function tB(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Cae(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(g.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Nae(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Pae(t){return t.match(Iae)?.[1]}function Hf(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=Pae(n)),r}function nB(t){let e=typeof t=="string"?bae(t):tB(t);if(!(!e||!Cae(e)))return e}function jn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Ff=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function rB(t){if(!t)return;let e=t.match(Ff);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Ql(t,e){let n=rB(t),r=Uo(e);if(!n?.traceId)return{traceId:zt(),sampleRand:yt()};let o=Mae(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function Rs(t=zt(),e=Kt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t=zt(),e=Kt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function Mae(t,e){let n=jn(e?.sample_rand);if(n!==void 0)return n;let r=jn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?yt()*r:r+yt()*(1-r):yt()}function JR(t,e){let n=Hf(t);return e&&n&&e!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var qf=0,$f=1,oB=!1;function iB(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Is(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=br(t).scope,i=r?s?.getPropagationContext().propagationSpanId||Kt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function Yf(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return Rs(e,n,r)}function aB(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return ys(e,n,r)}function $i(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===$f,attributes:s,...o}))}function Rn(t){return typeof t=="number"?sB(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?sB(t.getTime()):Ss()}function sB(t){return t>9999999999?t/1e3:t}function Y(t){if(Lae(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(vae(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:Rn(o),timestamp:Rn(i)||void 0,status:Yi(a),op:r[ee],origin:r[W],links:$i(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function vae(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Lae(t){return typeof t.getSpanJSON=="function"}function Cr(t){let{traceFlags:e}=t.spanContext();return e===$f}function Yi(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Xl="_sentryChildSpans",ZR="_sentryRootSpan";function Cc(t,e){let n=t[ZR]||t;nt(e,ZR,n),t[Xl]?t[Xl].add(e):nt(t,Xl,new Set([e]))}function Wf(t){let e=new Set;function n(r){if(!e.has(r)&&Cr(r)){e.add(r);let o=r[Xl]?Array.from(r[Xl]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[ZR]||t}function nr(){let t=cn(),e=Or(t);return e.getActiveSpan?e.getActiveSpan():Hi(he())}function Jl(){oB||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),oB=!0)}var cB=!1;function uB(){if(cB)return;function t(){let e=nr(),n=e&&je(e);if(n){let r="internal_error";C&&g.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",cB=!0,vG(t),LG(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function lB(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Zl(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(Dae(n)){if(xo(t.description,n))return C&&lB(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?xo(t.description,n.name):!0,o=n.op?t.op&&xo(t.op,n.op):!0;if(r&&o)return C&&lB(t),!0}return!1}function pB(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function Dae(t){return typeof t=="string"||t instanceof RegExp}var Pc="production";var dB="_frozenDsc";function zf(t,e){nt(t,dB,e)}function ey(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||Pc,release:n.release,public_key:r,trace_id:t,org_id:Hf(e)};return e.emit("createDsc",o),o}function Jr(t,e){let n=e.getPropagationContext();return n.dsc||ey(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[Nr]??o[qR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[dB];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&Uo(l);if(p)return a(p);let d=ey(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Cr(n)),d.sample_rand=s?.get("sentry.sample_rand")??br(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var Os=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:qf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Pr(t,e=100,n=1/0){try{return ty("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function ny(t,e=3,n=100*1024){let r=Pr(t,e);return Gae(r)>n?ny(t,e-1,n):r}function ty(t,e,n=1/0,r=1/0,o=Bae()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Uae(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return ty("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=wf(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=ty(f,m,c-1,r,o),d++}return i(e),p}function Uae(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Wl(e))return Lf(e);if(MR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${$l(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=wae(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function wae(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function kae(t){return~-encodeURI(t).split(/%..|./).length}function Gae(t){return kae(JSON.stringify(t))}function Bae(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function un(t,e=[]){return[t,e]}function oy(t,e){let[n,r]=t;return[n,[...r,e]]}function ep(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function sy(t,e){return ep(t,(n,r)=>e.includes(r))}function ry(t){let e=fs(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function tp(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[ry(r),s]:r.push(typeof s=="string"?ry(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
16
|
+
Error:`,o)}}var OR=null;function UG(t){let e="error";Ec(e,t),gc(e,lae)}function lae(){OR=J.onerror,J.onerror=function(t,e,n,r,o){return Sc("error",{column:r,error:o,line:n,msg:t,url:e}),OR?OR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var bR=null;function wG(t){let e="unhandledrejection";Ec(e,t),gc(e,pae)}function pae(){bR=J.onunhandledrejection,J.onunhandledrejection=function(t){return Sc("unhandledrejection",t),bR?bR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var kG=Object.prototype.toString;function Kr(t){switch(kG.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qr(t,Error)}}function kf(t,e){return kG.call(t)===`[object ${e}]`}function CR(t){return kf(t,"ErrorEvent")}function ms(t){return kf(t,"String")}function Ac(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yl(t){return t===null||Ac(t)||typeof t!="object"&&typeof t!="function"}function Mo(t){return kf(t,"Object")}function PR(t){return typeof Event<"u"&&Qr(t,Event)}function MR(t){return typeof Element<"u"&&Qr(t,Element)}function xR(t){return kf(t,"RegExp")}function vt(t){return!!(t?.then&&typeof t.then=="function")}function vR(t){return Mo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Qr(t,e){try{return t instanceof e}catch{return!1}}function Wl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var dae=J,_ae=80;function GG(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||_ae;for(;n&&s++<r&&(l=fae(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function fae(t,e){let n=t,r=[];if(!n?.tagName)return"";if(dae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ms(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function LR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&HG(o,r);try{t[e]=o}catch{C&&S.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&S.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function HG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function DR(t){return t.__sentry_original__}function Gf(t){if(Kr(t))return{message:t.message,name:t.name,stack:t.stack,...jG(t)};if(PR(t)){let e={type:t.type,target:BG(t.target),currentTarget:BG(t.currentTarget),...jG(t)};return typeof CustomEvent<"u"&&Qr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function BG(t){try{return MR(t)?GG(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function jG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function UR(t){let e=Object.keys(Gf(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var Rc;function Bi(t){if(Rc!==void 0)return Rc?Rc(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Rc=n[e],Rc(t)):(Rc=null,t())}function Rt(){return Bi(()=>Math.random())}function Zn(){return Bi(()=>Date.now())}function hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function wR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function kR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Wl(o)?n.push(Uf(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function xo(t,e,n=!1){return ms(t)?xR(e)?e.test(t):ms(e)?n?t===e:t.includes(e):!1:!1}function Ts(t,e=[],n=!1){return e.some(r=>xo(t,r,n))}function mae(){let t=J;return t.crypto||t.msCrypto}var GR;function hae(){return Rt()*16}function dt(t=mae()){try{if(t?.randomUUID)return Bi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return GR||(GR="10000000100040008000"+1e11),GR.replace(/[018]/g,e=>(e^(hae()&15)>>e/4).toString(16))}function FG(t){return t.exception?.values?.[0]}function Es(t){let{message:e,event_id:n}=t;if(e)return e;let r=FG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function jR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function yc(t,e){let n=FG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var Tae=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function BR(t){return parseInt(t||"",10)}function HR(t){let e=t.match(Tae)||[],n=BR(e[1]),r=BR(e[2]),o=BR(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function Bf(t){if(VG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function VG(t){try{return t.__sentry_captured__}catch{}}var $G=1e3;function vo(){return Zn()/$G}function Eae(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return vo;let e=t.timeOrigin;return()=>(e+Bi(()=>t.now()))/$G}var qG;function gs(){return(qG??(qG=Eae()))()}function YG(t){let e=gs(),n={sid:dt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>gae(n)};return t&&Lo(n,t),n}function Lo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||gs(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:dt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function WG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Lo(t,n)}function gae(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function Ss(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=Ss(r[o],e[o],n-1));return r}function Wt(){return dt()}function zt(){return dt().substring(16)}var FR="_sentrySpan";function ji(t,e){e?nt(t,FR,e):delete t[FR]}function Hi(t){return t[FR]}var Sae=100,An=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Wt(),sampleRand:Rt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,ji(e,Hi(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():Mo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,ji(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Wt(),sampleRand:Rt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:Sae;if(r<=0)return this;let o={timestamp:vo(),...e,message:e.message?hs(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Hi(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Ss(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||dt();if(!this._client)return C&&S.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||dt();if(!this._client)return C&&S.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||dt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&S.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function Ic(){return Ir("defaultCurrentScope",()=>new An)}function er(){return Ir("defaultIsolationScope",()=>new An)}var zG=t=>t instanceof Promise&&!t[KG],KG=Symbol("chained PromiseLike"),jf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return zG(r)&&zG(t)?r:Aae(t,r)},Aae=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[KG]:!0}),e};var VR=class{constructor(e,n){let r;e?r=e:r=new An;let o;n?o=n:o=new An,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return vt(r)?jf(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Nc(){let t=cn(),e=fs(t);return e.stack=e.stack||new VR(Ic(),er())}function Rae(t){return Nc().withScope(t)}function yae(t,e){let n=Nc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function QG(t){return Nc().withScope(()=>t(Nc().getIsolationScope()))}function XG(){return{withIsolationScope:QG,withScope:Rae,withSetScope:yae,withSetIsolationScope:(t,e)=>QG(e),getCurrentScope:()=>Nc().getScope(),getIsolationScope:()=>Nc().getIsolationScope()}}function qR(t){let e=cn(),n=fs(e);n.acs=t}function Nr(t){let e=fs(t);return e.acs?e.acs:XG()}var JG;function ZG(){return JG?.()}function $R(){return JG!==void 0}function he(){let t=cn();return Nr(t).getCurrentScope()}function ue(){let t=cn();return Nr(t).getIsolationScope()}function Hf(){return Ir("globalScope",()=>new An)}function Gn(...t){let e=cn(),n=Nr(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function zl(...t){let e=cn(),n=Nr(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return he().getClient()}function Fi(t){let e=ZG();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||zt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",Or="sentry.sample_rate",YR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var WR="sentry.measurement_unit",zR="sentry.measurement_value",tr="sentry.custom_span_name",Oc="sentry.profile_id",bc="sentry.exclusive_time",KR="cache.hit",QR="cache.key",XR="cache.item_size",JR="http.request.method",As="url.full";var ZR="gen_ai.conversation.id";function Do(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}var eB="_sentryScope",tB="_sentryIsolationScope";function Iae(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function Nae(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function Kl(t,e,n){t&&(nt(t,tB,Iae(n)),nt(t,eB,e))}function br(t){let e=t;return{scope:e[eB],isolationScope:Nae(e[tB])}}var Xr="sentry-";var rB=8192;function Uo(t){let e=qi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(Xr)){let i=o.slice(Xr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Vi(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Xr}${r}`]=o),n),{});return Ff(e)}function qi(t){if(!(!t||!ms(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=nB(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):nB(t)}function nB(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function Ff(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>rB?(C&&S.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var Oae=/^o(\d+)\./,bae=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Cae(t){return t==="http"||t==="https"}function Bn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function Pae(t){let e=bae.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return oB({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function oB(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Mae(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(S.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Cae(r)?e&&isNaN(parseInt(e,10))?(S.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(S.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(S.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function xae(t){return t.match(Oae)?.[1]}function Vf(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=xae(n)),r}function sB(t){let e=typeof t=="string"?Pae(t):oB(t);if(!(!e||!Mae(e)))return e}function jn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var qf=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function iB(t){if(!t)return;let e=t.match(qf);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Ql(t,e){let n=iB(t),r=Uo(e);if(!n?.traceId)return{traceId:Wt(),sampleRand:Rt()};let o=vae(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function Rs(t=Wt(),e=zt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t=Wt(),e=zt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function vae(t,e){let n=jn(e?.sample_rand);if(n!==void 0)return n;let r=jn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?Rt()*r:r+Rt()*(1-r):Rt()}function ey(t,e){let n=Vf(t);return e&&n&&e!==n?(S.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(S.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var Yf=0,Wf=1,aB=!1;function uB(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Is(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=br(t).scope,i=r?s?.getPropagationContext().propagationSpanId||zt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function zf(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return Rs(e,n,r)}function lB(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return ys(e,n,r)}function $i(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===Wf,attributes:s,...o}))}function Rn(t){return typeof t=="number"?cB(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?cB(t.getTime()):gs()}function cB(t){return t>9999999999?t/1e3:t}function Y(t){if(Uae(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(Dae(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:Rn(o),timestamp:Rn(i)||void 0,status:Yi(a),op:r[ee],origin:r[W],links:$i(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Dae(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Uae(t){return typeof t.getSpanJSON=="function"}function Cr(t){let{traceFlags:e}=t.spanContext();return e===Wf}function Yi(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Xl="_sentryChildSpans",ty="_sentryRootSpan";function Cc(t,e){let n=t[ty]||t;nt(e,ty,n),t[Xl]?t[Xl].add(e):nt(t,Xl,new Set([e]))}function Kf(t){let e=new Set;function n(r){if(!e.has(r)&&Cr(r)){e.add(r);let o=r[Xl]?Array.from(r[Xl]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[ty]||t}function nr(){let t=cn(),e=Nr(t);return e.getActiveSpan?e.getActiveSpan():Hi(he())}function Jl(){aB||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),aB=!0)}var pB=!1;function dB(){if(pB)return;function t(){let e=nr(),n=e&&je(e);if(n){let r="internal_error";C&&S.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",pB=!0,UG(t),wG(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function _B(t){S.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Zl(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(wae(n)){if(xo(t.description,n))return C&&_B(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?xo(t.description,n.name):!0,o=n.op?t.op&&xo(t.op,n.op):!0;if(r&&o)return C&&_B(t),!0}return!1}function fB(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function wae(t){return typeof t=="string"||t instanceof RegExp}var Pc="production";var mB="_frozenDsc";function Qf(t,e){nt(t,mB,e)}function ny(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||Pc,release:n.release,public_key:r,trace_id:t,org_id:Vf(e)};return e.emit("createDsc",o),o}function Jr(t,e){let n=e.getPropagationContext();return n.dsc||ny(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[Or]??o[YR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[mB];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&Uo(l);if(p)return a(p);let d=ny(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Cr(n)),d.sample_rand=s?.get("sentry.sample_rand")??br(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var Ns=class{constructor(e={}){this._traceId=e.traceId||Wt(),this._spanId=e.spanId||zt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Yf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Pr(t,e=100,n=1/0){try{return ry("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function oy(t,e=3,n=100*1024){let r=Pr(t,e);return jae(r)>n?oy(t,e-1,n):r}function ry(t,e,n=1/0,r=1/0,o=Hae()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=kae(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return ry("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=Gf(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=ry(f,m,c-1,r,o),d++}return i(e),p}function kae(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Wl(e))return Uf(e);if(vR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${$l(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=Gae(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Gae(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Bae(t){return~-encodeURI(t).split(/%..|./).length}function jae(t){return Bae(JSON.stringify(t))}function Hae(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function un(t,e=[]){return[t,e]}function iy(t,e){let[n,r]=t;return[n,[...r,e]]}function ep(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function ay(t,e){return ep(t,(n,r)=>e.includes(r))}function sy(t){let e=fs(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function tp(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[sy(r),s]:r.push(typeof s=="string"?sy(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
17
17
|
${JSON.stringify(i)}
|
|
18
|
-
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pr(a))}o(c)}}return typeof r=="string"?r:
|
|
18
|
+
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pr(a))}o(c)}}return typeof r=="string"?r:Fae(r)}function Fae(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function cy(t){return[{type:"span"},t]}function uy(t){let e=typeof t.data=="string"?sy(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var hB={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Vae(t){return t in hB}function Xf(t){return Vae(t)?hB[t]:t}function Jf(t){if(!t?.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function ly(t,e,n,r){let o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Bn(r)},...o&&{trace:o}}}function qae(t,e){if(!e)return t;let n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0},t}function TB(t,e,n,r){let o=Jf(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:Bn(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return un(s,[i])}function EB(t,e,n,r){let o=Jf(n),s=t.type&&t.type!=="replay_event"?t.type:"event";qae(t,n?.sdk);let i=ly(t,o,r,e);return delete t.sdkProcessingMetadata,un(i,[[{type:s},t]])}function gB(t,e){function n(f){return!!f.trace_id&&!!f.public_key}let r=Je(t[0]),o=e?.getDsn(),s=e?.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&o&&{dsn:Bn(o)}},{beforeSendSpan:a,ignoreSpans:c}=e?.getOptions()||{},l=c?.length?t.filter(f=>!Zl(Y(f),c)):t,p=t.length-l.length;p&&e?.recordDroppedEvent("before_send","span",p);let d=a?f=>{let m=Y(f),h=a(m);return h||(Jl(),m)}:Y,_=[];for(let f of l){let m=d(f);m&&_.push(cy(m))}return un(i,_)}function np(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Y(t),{spanId:o}=t.spanContext(),s=Cr(t),i=je(t),a=i===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!a){let{op:p,description:d}=Y(i);l.push(`root ID: ${i.spanContext().spanId}`),p&&l.push(`root op: ${p}`),d&&l.push(`root description: ${d}`)}S.log(`${c}
|
|
19
19
|
${l.join(`
|
|
20
|
-
`)}`)}function rp(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;g.log(i)}function Wi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[$R],s=r[YR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var TB=1e3,Mc=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt(),this._startTime=e.startTimestamp||Ss(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?$f:qf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Rn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=Rn(e),rp(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Yi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[Nc],exclusive_time:this._attributes[bc],measurements:Wi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:$i(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&g.log("[Tracing] Adding an event to span:",e);let o=EB(n)?n:r||Ss(),s=EB(n)?{}:n||{},i={name:e,time:Rn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?qae(hB([this],e)):(C&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(br(this).scope||he()).captureEvent(r)}_convertSpanToTransaction(){if(!SB(Y(this)))return;this._name||(C&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=br(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=Wf(this).filter(p=>p!==this&&!Vae(p)).map(p=>Y(p)).filter(SB),i=this._attributes[Ue];delete this._attributes[tr],s.forEach(p=>{delete p.data[tr]});let a={contexts:{trace:iB(this)},spans:s.length>TB?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,TB):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Wi(this._events);return c&&Object.keys(c).length&&(C&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function EB(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function SB(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Vae(t){return t instanceof Mc&&t.isStandaloneSpan()}function qae(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Mr(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return $ae(o,e,n,r)}function $ae(t,e,n,r){return Lt(t)?Gf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function op(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=jn(o);if(s===void 0)return C&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var Xf="__SENTRY_SUPPRESS_TRACING__";function xr(t,e){let n=sp();if(n.startSpan)return n.startSpan(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function It(t,e){let n=sp();if(n.startSpanManual)return n.startSpanManual(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function Jf(t){let e=sp();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=ly(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>Gn(t.scope,i):o!==void 0?i=>xc(o,i):i=>i())(()=>{let i=he(),a=py(i,o);return t.onlyIfParent&&!a?new Os:uy({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function xc(t,e){let n=sp();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(ji(r,t||void 0),e(r)))}function vc(t){let e=sp();return e.suppressTracing?e.suppressTracing(t):Gn(n=>{n.setSDKProcessingMetadata({[Xf]:!0});let r=t();return n.setSDKProcessingMetadata({[Xf]:void 0}),r})}function uy({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new Os;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};zf(i,a)}return i}let o=ue(),s;if(t&&!n)s=Yae(t,r,e),Cc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Cr(t);s=gB({traceId:a,parentSpanId:c,...e},r,l),zf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=gB({traceId:i,parentSpanId:c,...e},r,l),a&&zf(s,a)}return np(s),Kl(s,r,o),s}function ly(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Rn(t.startTime),delete r.startTime,r}return n}function sp(){let t=cn();return Or(t)}function gB(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[Xf]?[!1]:op(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:jn(l.dsc?.sample_rate)},l.sampleRand),f=new Mc({...t,attributes:{[Ue]:"custom",[Nr]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function Yae(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Xf]?!1:Cr(t),i=s?new Mc({...n,parentSpanId:r,traceId:o,sampled:s}):new Os({traceId:o});Cc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function py(t,e){if(e)return e;if(e===null)return;let n=Hi(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function AB(t){return t!==void 0?e=>xc(t,e):e=>e()}var dy=0,RB=1,yB=2;function wo(t){return new Zf(e=>{e(t)})}function Lc(t){return new Zf((e,n)=>{n(t)})}var Zf=class t{constructor(e){this._state=dy,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===dy)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===RB&&n[1](this._value),this._state===yB&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===dy){if(Lt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(RB,s)},o=s=>{n(yB,s)};try{e(r,o)}catch(s){o(s)}}};function IB(t,e,n,r=0){try{let o=_y(e,n,t,r);return Lt(o)?o:wo(o)}catch(o){return Lc(o)}}function _y(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),Lt(s)?s.then(i=>_y(i,e,n,r+1)):_y(s,e,n,r+1)}var zi,OB,NB,Ns;function bB(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(Ns&&r.length===OB&&o.length===NB)return Ns;OB=r.length,NB=o.length,Ns={},zi||(zi={});let s=(i,a)=>{for(let c of i){let l=a[c],p=zi?.[c];if(p&&Ns&&l)Ns[p[0]]=l,zi&&(zi[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&Ns&&zi){Ns[m]=l,zi[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),Ns}function PB(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;Wae(t,e),r&&Qae(t,r),Xae(t,n),zae(t,o),Kae(t,s)}function CB(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:h}=e;ip(t,"extra",n),ip(t,"tags",r),ip(t,"attributes",o),ip(t,"user",s),ip(t,"contexts",i),t.sdkProcessingMetadata=gs(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),h&&(t.span=h),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function ip(t,e,n){t[e]=gs(t[e],n,1)}function em(t,e){let n=Bf().getScopeData();return t&&CB(n,t.getScopeData()),e&&CB(n,e.getScopeData()),n}function Wae(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function zae(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Kae(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Qae(t,e){t.contexts={trace:Is(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Xae(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function MB(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||_t(),timestamp:e.timestamp||vo()},l=n.integrations||t.integrations.map(S=>S.name);Jae(c,t),tce(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Zae(c,t.stackParser);let p=rce(r,n.captureContext);n.mechanism&&yc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=em(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),PB(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?wo(c):IB(m,c,n)).then(S=>(S&&ece(S),typeof i=="number"&&i>0?nce(S,i,a):S))}function Jae(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||Pc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=hs(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=hs(a.value,s))})}function Zae(t,e){let n=bB(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function ece(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function tce(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function nce(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))},...t.user&&{user:Pr(t.user,e,n)},...t.contexts&&{contexts:Pr(t.contexts,e,n)},...t.extra&&{extra:Pr(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Pr(t.contexts.flags,3,n)),r}function rce(t,e){if(!e)return t;let n=t?t.clone():new An;return n.update(e),n}function xB(t){if(t)return oce(t)?{captureContext:t}:ice(t)?{captureContext:t}:t}function oce(t){return t instanceof An||typeof t=="function"}var sce=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function ice(t){return Object.keys(t).some(e=>sce.includes(e))}function te(t,e){return he().captureException(t,xB(e))}function tm(t,e){return he().captureEvent(t,e)}function nm(t,e){ue().setTag(t,e)}async function rm(t){let e=H();return e?e.flush(t):(C&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function om(t){let e=H();return e?e.close(t):(C&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function sm(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function im(t){let e=ue(),{user:n}=em(e,he()),{userAgent:r}=J.navigator||{},o=VG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Lo(s,{status:"exited"}),ap(),e.setSession(o),o}function ap(){let t=ue(),n=he().getSession()||t.getSession();n&&qG(n),ace(),t.setSession()}function ace(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var cce="7";function uce(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function lce(t){return`${uce(t)}${t.projectId}/envelope/`}function pce(t,e){let n={sentry_version:cce};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function vB(t,e,n){return e||`${lce(t)}?${pce(t,n)}`}var fy=[];function dce(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function my(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return dce(r)}function LB(t,e){let n={};return e.forEach(r=>{r&&Ty(t,r,n)}),n}function hy(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Ty(t,e,n){if(n[e.name]){C&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!fy.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),fy.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&g.log(`Integration installed: ${e.name}`)}function DB(t,e){return e?Gn(e,()=>{let n=nr(),r=n?Is(n):Fi(e);return[n?Je(n):Jr(t,e),r]}):[void 0,void 0]}function _ce(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function UB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[_ce(t)])}function Dc(t,e){let n=e??fce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=UB(n,r._metadata,r.tunnel,t.getDsn());wB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function fce(t){return wB().get(t)}function wB(){return Ir("clientToLogBufferMap",()=>new WeakMap)}function mce(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function kB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[mce(t)])}function GB(t,e){let n=e??hce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=kB(n,r._metadata,r.tunnel,t.getDsn());BB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function hce(t){return BB().get(t)}function BB(){return Ir("clientToMetricBufferMap",()=>new WeakMap)}function am(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var cp=Symbol.for("SentryBufferFullError");function Uc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return Lc(cp);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return wo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>am(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var Tce=60*1e3;function Ece(t,e=Zn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?Tce:r-e}function Sce(t,e){return t[e]||t.all||0}function jB(t,e,n=Zn()){return Sce(t,e)>n}function HB(t,{statusCode:e,headers:n},r=Zn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+Ece(i,r):e===429&&(o.all=r+60*1e3);return o}var up=64;function lp(t,e,n=Uc(t.bufferSize||up)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(ep(i,(d,_)=>{let f=Kf(_);jB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=un(i[0],a),l=d=>{if(sy(c,["client_report"])){C&&g.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}ep(c,(_,f)=>{t.recordDroppedEvent(d,Kf(f))})},p=()=>e({body:tp(c)}).then(d=>d.statusCode===413?(C&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&g.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=HB(r,d),d),d=>{throw l("network_error"),C&&g.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===cp)return C&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function FB(t,e,n){let r=[{type:"client_report"},{timestamp:n||vo(),discarded_events:t}];return un(e?{dsn:e}:{},[r])}function cm(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function VB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[Nc],exclusive_time:i?.[bc],measurements:t.measurements,is_segment:!0}}function qB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Nc]:t.profile_id},...t.exclusive_time&&{[bc]:t.exclusive_time}}}},measurements:t.measurements}}var $B="Not capturing exception because it's already been captured.",YB="Discarded session because of missing or non-string release",JB=Symbol.for("SentryInternalError"),ZB=Symbol.for("SentryDoNotSendEventError"),gce=5e3;function um(t){return{message:t,[JB]:!0}}function Ey(t){return{message:t,[ZB]:!0}}function WB(t){return!!t&&typeof t=="object"&&JB in t}function zB(t){return!!t&&typeof t=="object"&&ZB in t}function KB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=am(setTimeout(()=>{o(t)},gce)))}),t.on("flush",()=>{o(t)})}var lm=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Uc(e.transportOptions?.bufferSize??up),e.dsn?this._dsn=nB(e.dsn):C&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=vB(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&KB(this,"afterCaptureLog","flushLogs",Ice,Dc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&KB(this,"afterCaptureMetric","flushMetrics",yce,GB)}captureException(e,n,r){let o=_t();if(kf(e))return C&&g.log($B),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:_t(),...r},i=Ac(e)?e:String(e),a=Yl(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=_t();if(n?.originalException&&kf(n.originalException))return C&&g.log($B),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=QB(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Lo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Dc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];Ty(this,e,this._integrations),n||hy(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=mB(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=oy(r,ay(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=Pc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&g.warn(YB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&g.warn(YB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=fB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&g.error("Error while sending envelope:",n),{}}return C&&g.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=LB(this,e),hy(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Lo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),MB(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Fi(r)},...a.contexts};let c=Jr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=he(),o=ue()){return C&&Sy(e)&&g.log(`Captured error event \`${cm(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(zB(s)?g.log(s.message):WB(s)?g.warn(s.message):g.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=e1(e),c=Sy(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:jn(i);if(c&&typeof d=="number"&&yt()>d)return this.recordDroppedEvent("sample_rate","error"),Lc(Ey(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=QB(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),Ey("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let h=Rce(this,s,f,n);return Ace(h,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw Ey(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let T=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,S=f.spans?f.spans.length:0,R=T-S;R>0&&this.recordDroppedEvent("before_send","span",R)}let h=f.transaction_info;if(a&&h&&f.transaction!==e.transaction){let T="custom";f.transaction_info={...h,source:T}}return this.sendEvent(f,n),f}).then(null,f=>{throw zB(f)||WB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),um(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
21
|
-
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===cp&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&g.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&g.log("No outcomes to send");return}if(!this._dsn){C&&g.log("No dsn provided, will not send outcomes");return}C&&g.log("Sending outcomes:",e);let n=FB(e,this._options.tunnel&&Bn(this._dsn));this.sendEnvelope(n)}};function QB(t){return t==="replay_event"?"replay":t||"error"}function Ace(t,e){let n=`${e} must return \`null\` or a valid event.`;if(Lt(t))return t.then(r=>{if(!Mo(r)&&r!==null)throw um(n);return r},r=>{throw um(`${e} rejected with ${r}`)});if(!Mo(t)&&t!==null)throw um(n);return t}function Rce(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(Sy(c)&&o)return o(c,r);if(e1(c)){if(i||a){let l=VB(c);if(a?.length&&Zl(l,a))return null;if(i){let p=i(l);p?c=gs(n,qB(p)):Jl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&Zl(f,a)){pB(d,f);continue}if(i){let m=i(f);m?p.push(m):(Jl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function Sy(t){return t.type===void 0}function e1(t){return t.type==="transaction"}function yce(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+t1(t.attributes)}function Ice(t){let e=0;return t.message&&(e+=t.message.length*2),e+t1(t.attributes)}function t1(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*XB(n[0]):Yl(n)?e+=XB(n):e+=100}),e}function XB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function n1(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=Bn(o)),e&&(s.trace=e);let i=Oce(t);return un(s,[i])}function Oce(t){return[{type:"check_in"},t]}function r1(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function o1(t,e){return t(e.stack||"",1)}function Nce(t){return Kr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function bce(t){return Nce(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function gy(t,e){let n={type:e.name||e.constructor.name,value:bce(e)},r=o1(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Cce(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function Pce(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=LR(t);if(NR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=Mce(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Mce(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function xce(t,e,n,r){if(Kr(n))return[n,void 0];if(e.synthetic=!0,Mo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:ny(n,s)},a=Cce(n);if(a)return[a,i];let c=Pce(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function s1(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=xce(t,s,n,r),c={exception:{values:[gy(e,i)]}};return a&&(c.extra=a),GR(c,void 0,void 0),yc(c,s),{...c,event_id:r?.event_id}}function i1(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=o1(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},yc(s,{synthetic:!0}))}if(Ac(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var pp=class extends lm{constructor(e){uB(),r1(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=s1(this,this._options.stackParser,e,n);return r.level="error",wo(r)}eventFromMessage(e,n="info",r){return wo(i1(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return a1(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&a1(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:_t();if(!this._isEnabled())return C&&g.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,d]=DB(this,r);d&&(l.contexts={trace:d});let _=n1(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&g.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&g.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Uc(up)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function a1(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var Ay=new Set;function Ry(t){t.forEach(e=>{Ay.add(e),C&&g.log(`AI provider "${e}" wrapping will be skipped`)})}function Ki(t){return Ay.has(t)}function yy(){Ay.clear(),C&&g.log("Cleared AI provider skip registrations")}var vce=new Set(["false","f","n","no","off","0"]),Lce=new Set(["true","t","y","yes","on","1"]);function wc(t,e){let n=String(t).toLowerCase();return vce.has(n)?!1:Lce.has(n)?!0:e?.strict?null:!!t}var Dce="thismessage:/";function Iy(t){return"isRelative"in t}function dp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?Dce:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function c1(t){if(Iy(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Uce(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?c1(t):t.pathname:"/");return`${o} ${s}`}function Oy(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[QR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),Iy(t)||(s[As]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[Uce(t,e,r,o),s]}function bs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ko(t){return t.split(/[?#]/,1)[0]}function Cs(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function kc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Qi(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function Gc(t={}){let e=t.client||H();if(!sm()||!e)return{};let n=cn(),r=Or(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||he(),s=t.span||nr();if(!s&&VR())return{};let i=s?Yf(s):wce(o),a=s?Je(s):Jr(e,o),c=Vi(a);if(!Ff.test(i))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?aB(s):kce(o)),p}function wce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Rs(e,r,n)}function kce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return ys(e,r,n)}var u1="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Xi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&g.log(u1,t),r;let o=Ts(t,e);return n?.set(t,o),C&&!o&&g.log(u1,t),o}function Ny(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function _1(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function _p(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=Gce({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:f1(i),headers:_1(e),cookies:l,data:c}}function Gce({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var l1=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],Bce=["x-forwarded-","-user"];function pm(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,h=f!==-1?_.substring(f+1):"",T=m.toLowerCase();d1(r,i,T,h,e,n)}}else d1(r,i,"",s,e,n)})}catch{}return r}function p1(t){return t.replace(/-/g,"_")}function d1(t,e,n,r,o,s){let i=jce(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${p1(e)}${n?`.${p1(n)}`:""}`;t[a]=i}function jce(t,e,n){if(n?l1.some(o=>t.includes(o)):[...Bce,...l1].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function f1(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var Hce=100;function rr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=Hce}=n.getOptions();if(s<=0)return;let a={timestamp:vo(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var m1,Fce="FunctionToString",h1=new WeakMap,Vce=()=>({name:Fce,setupOnce(){m1=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=vR(this),n=h1.has(H())&&e!==void 0?e:this;return m1.apply(n,t)}}catch{}},setup(t){h1.set(t,!0)}}),dm=Vce;var qce=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],$ce="EventFilters",by=(t={})=>{let e;return{name:$ce,setup(n){let r=n.getOptions();e=T1(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=T1(t,s)}return Yce(n,e)?null:n}}},fm=(t={})=>({...by(t),name:"InboundFilters"});function T1(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:qce],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Yce(t,e){if(t.type){if(t.type==="transaction"&&zce(t,e.ignoreTransactions))return C&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
-
Event: ${Es(t)}`),!0}else{if(
|
|
23
|
-
Event: ${Es(t)}`),!0;if(
|
|
24
|
-
Event: ${Es(t)}`),!0;if(
|
|
20
|
+
`)}`)}function rp(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;S.log(i)}function Wi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[WR],s=r[zR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var SB=1e3,Mc=class{constructor(e={}){this._traceId=e.traceId||Wt(),this._spanId=e.spanId||zt(),this._startTime=e.startTimestamp||gs(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?Wf:Yf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Rn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=Rn(e),rp(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Yi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[Oc],exclusive_time:this._attributes[bc],measurements:Wi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:$i(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&S.log("[Tracing] Adding an event to span:",e);let o=AB(n)?n:r||gs(),s=AB(n)?{}:n||{},i={name:e,time:Rn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?Yae(gB([this],e)):(C&&S.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(br(this).scope||he()).captureEvent(r)}_convertSpanToTransaction(){if(!RB(Y(this)))return;this._name||(C&&S.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=br(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=Kf(this).filter(p=>p!==this&&!$ae(p)).map(p=>Y(p)).filter(RB),i=this._attributes[Ue];delete this._attributes[tr],s.forEach(p=>{delete p.data[tr]});let a={contexts:{trace:uB(this)},spans:s.length>SB?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,SB):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Wi(this._events);return c&&Object.keys(c).length&&(C&&S.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function AB(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function RB(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function $ae(t){return t instanceof Mc&&t.isStandaloneSpan()}function Yae(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Mr(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return Wae(o,e,n,r)}function Wae(t,e,n,r){return vt(t)?jf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function op(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=jn(o);if(s===void 0)return C&&S.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&S.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&S.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var Zf="__SENTRY_SUPPRESS_TRACING__";function xr(t,e){let n=sp();if(n.startSpan)return n.startSpan(t,e);let r=dy(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>IB(s)(()=>{let l=he(),p=_y(l,s),_=t.onlyIfParent&&!p?new Ns:py({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function yt(t,e){let n=sp();if(n.startSpanManual)return n.startSpanManual(t,e);let r=dy(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>IB(s)(()=>{let l=he(),p=_y(l,s),_=t.onlyIfParent&&!p?new Ns:py({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function em(t){let e=sp();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=dy(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>Gn(t.scope,i):o!==void 0?i=>xc(o,i):i=>i())(()=>{let i=he(),a=_y(i,o);return t.onlyIfParent&&!a?new Ns:py({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function xc(t,e){let n=sp();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(ji(r,t||void 0),e(r)))}function vc(t){let e=sp();return e.suppressTracing?e.suppressTracing(t):Gn(n=>{n.setSDKProcessingMetadata({[Zf]:!0});let r=t();return n.setSDKProcessingMetadata({[Zf]:void 0}),r})}function py({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new Ns;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};Qf(i,a)}return i}let o=ue(),s;if(t&&!n)s=zae(t,r,e),Cc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Cr(t);s=yB({traceId:a,parentSpanId:c,...e},r,l),Qf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=yB({traceId:i,parentSpanId:c,...e},r,l),a&&Qf(s,a)}return np(s),Kl(s,r,o),s}function dy(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Rn(t.startTime),delete r.startTime,r}return n}function sp(){let t=cn();return Nr(t)}function yB(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[Zf]?[!1]:op(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:jn(l.dsc?.sample_rate)},l.sampleRand),f=new Mc({...t,attributes:{[Ue]:"custom",[Or]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&S.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function zae(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Zf]?!1:Cr(t),i=s?new Mc({...n,parentSpanId:r,traceId:o,sampled:s}):new Ns({traceId:o});Cc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function _y(t,e){if(e)return e;if(e===null)return;let n=Hi(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function IB(t){return t!==void 0?e=>xc(t,e):e=>e()}var fy=0,NB=1,OB=2;function wo(t){return new tm(e=>{e(t)})}function Lc(t){return new tm((e,n)=>{n(t)})}var tm=class t{constructor(e){this._state=fy,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===fy)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===NB&&n[1](this._value),this._state===OB&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===fy){if(vt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(NB,s)},o=s=>{n(OB,s)};try{e(r,o)}catch(s){o(s)}}};function bB(t,e,n,r=0){try{let o=my(e,n,t,r);return vt(o)?o:wo(o)}catch(o){return Lc(o)}}function my(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&S.log(`Event processor "${o.id||"?"}" dropped event`),vt(s)?s.then(i=>my(i,e,n,r+1)):my(s,e,n,r+1)}var zi,CB,PB,Os;function MB(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(Os&&r.length===CB&&o.length===PB)return Os;CB=r.length,PB=o.length,Os={},zi||(zi={});let s=(i,a)=>{for(let c of i){let l=a[c],p=zi?.[c];if(p&&Os&&l)Os[p[0]]=l,zi&&(zi[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&Os&&zi){Os[m]=l,zi[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),Os}function vB(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;Kae(t,e),r&&Jae(t,r),Zae(t,n),Qae(t,o),Xae(t,s)}function xB(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:h}=e;ip(t,"extra",n),ip(t,"tags",r),ip(t,"attributes",o),ip(t,"user",s),ip(t,"contexts",i),t.sdkProcessingMetadata=Ss(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),h&&(t.span=h),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function ip(t,e,n){t[e]=Ss(t[e],n,1)}function nm(t,e){let n=Hf().getScopeData();return t&&xB(n,t.getScopeData()),e&&xB(n,e.getScopeData()),n}function Kae(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function Qae(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Xae(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Jae(t,e){t.contexts={trace:Is(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Zae(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function LB(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||dt(),timestamp:e.timestamp||vo()},l=n.integrations||t.integrations.map(g=>g.name);ece(c,t),rce(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&tce(c,t.stackParser);let p=sce(r,n.captureContext);n.mechanism&&yc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=nm(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),vB(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?wo(c):bB(m,c,n)).then(g=>(g&&nce(g),typeof i=="number"&&i>0?oce(g,i,a):g))}function ece(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||Pc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=hs(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=hs(a.value,s))})}function tce(t,e){let n=MB(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function nce(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function rce(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function oce(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))},...t.user&&{user:Pr(t.user,e,n)},...t.contexts&&{contexts:Pr(t.contexts,e,n)},...t.extra&&{extra:Pr(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Pr(t.contexts.flags,3,n)),r}function sce(t,e){if(!e)return t;let n=t?t.clone():new An;return n.update(e),n}function DB(t){if(t)return ice(t)?{captureContext:t}:cce(t)?{captureContext:t}:t}function ice(t){return t instanceof An||typeof t=="function"}var ace=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function cce(t){return Object.keys(t).some(e=>ace.includes(e))}function te(t,e){return he().captureException(t,DB(e))}function rm(t,e){return he().captureEvent(t,e)}function om(t,e){ue().setTag(t,e)}async function sm(t){let e=H();return e?e.flush(t):(C&&S.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function im(t){let e=H();return e?e.close(t):(C&&S.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function am(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function cm(t){let e=ue(),{user:n}=nm(e,he()),{userAgent:r}=J.navigator||{},o=YG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Lo(s,{status:"exited"}),ap(),e.setSession(o),o}function ap(){let t=ue(),n=he().getSession()||t.getSession();n&&WG(n),uce(),t.setSession()}function uce(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var lce="7";function pce(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function dce(t){return`${pce(t)}${t.projectId}/envelope/`}function _ce(t,e){let n={sentry_version:lce};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function UB(t,e,n){return e||`${dce(t)}?${_ce(t,n)}`}var hy=[];function fce(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function Ty(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return fce(r)}function wB(t,e){let n={};return e.forEach(r=>{r&&gy(t,r,n)}),n}function Ey(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function gy(t,e,n){if(n[e.name]){C&&S.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!hy.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),hy.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&S.log(`Integration installed: ${e.name}`)}function kB(t,e){return e?Gn(e,()=>{let n=nr(),r=n?Is(n):Fi(e);return[n?Je(n):Jr(t,e),r]}):[void 0,void 0]}function mce(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function GB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[mce(t)])}function Dc(t,e){let n=e??hce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=GB(n,r._metadata,r.tunnel,t.getDsn());BB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function hce(t){return BB().get(t)}function BB(){return Ir("clientToLogBufferMap",()=>new WeakMap)}function Tce(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function jB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[Tce(t)])}function HB(t,e){let n=e??Ece(t)??[];if(n.length===0)return;let r=t.getOptions(),o=jB(n,r._metadata,r.tunnel,t.getDsn());FB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function Ece(t){return FB().get(t)}function FB(){return Ir("clientToMetricBufferMap",()=>new WeakMap)}function um(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var cp=Symbol.for("SentryBufferFullError");function Uc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return Lc(cp);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return wo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>um(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var gce=60*1e3;function Sce(t,e=Zn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?gce:r-e}function Ace(t,e){return t[e]||t.all||0}function VB(t,e,n=Zn()){return Ace(t,e)>n}function qB(t,{statusCode:e,headers:n},r=Zn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+Sce(i,r):e===429&&(o.all=r+60*1e3);return o}var up=64;function lp(t,e,n=Uc(t.bufferSize||up)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(ep(i,(d,_)=>{let f=Xf(_);VB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=un(i[0],a),l=d=>{if(ay(c,["client_report"])){C&&S.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}ep(c,(_,f)=>{t.recordDroppedEvent(d,Xf(f))})},p=()=>e({body:tp(c)}).then(d=>d.statusCode===413?(C&&S.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&S.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=qB(r,d),d),d=>{throw l("network_error"),C&&S.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===cp)return C&&S.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function $B(t,e,n){let r=[{type:"client_report"},{timestamp:n||vo(),discarded_events:t}];return un(e?{dsn:e}:{},[r])}function lm(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function YB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[Oc],exclusive_time:i?.[bc],measurements:t.measurements,is_segment:!0}}function WB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Oc]:t.profile_id},...t.exclusive_time&&{[bc]:t.exclusive_time}}}},measurements:t.measurements}}var zB="Not capturing exception because it's already been captured.",KB="Discarded session because of missing or non-string release",t1=Symbol.for("SentryInternalError"),n1=Symbol.for("SentryDoNotSendEventError"),Rce=5e3;function pm(t){return{message:t,[t1]:!0}}function Sy(t){return{message:t,[n1]:!0}}function QB(t){return!!t&&typeof t=="object"&&t1 in t}function XB(t){return!!t&&typeof t=="object"&&n1 in t}function JB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=um(setTimeout(()=>{o(t)},Rce)))}),t.on("flush",()=>{o(t)})}var dm=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Uc(e.transportOptions?.bufferSize??up),e.dsn?this._dsn=sB(e.dsn):C&&S.warn("No DSN provided, client will not send events."),this._dsn){let r=UB(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&JB(this,"afterCaptureLog","flushLogs",Oce,Dc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&JB(this,"afterCaptureMetric","flushMetrics",Nce,HB)}captureException(e,n,r){let o=dt();if(Bf(e))return C&&S.log(zB),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:dt(),...r},i=Ac(e)?e:String(e),a=Yl(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=dt();if(n?.originalException&&Bf(n.originalException))return C&&S.log(zB),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=ZB(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Lo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Dc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];gy(this,e,this._integrations),n||Ey(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=EB(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=iy(r,uy(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=Pc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&S.warn(KB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&S.warn(KB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=TB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&S.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&S.error("Error while sending envelope:",n),{}}return C&&S.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=wB(this,e),Ey(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Lo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),LB(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Fi(r)},...a.contexts};let c=Jr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=he(),o=ue()){return C&&Ay(e)&&S.log(`Captured error event \`${lm(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(XB(s)?S.log(s.message):QB(s)?S.warn(s.message):S.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=r1(e),c=Ay(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:jn(i);if(c&&typeof d=="number"&&Rt()>d)return this.recordDroppedEvent("sample_rate","error"),Lc(Sy(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=ZB(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),Sy("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let h=Ice(this,s,f,n);return yce(h,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let g=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",g)}throw Sy(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let T=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,g=f.spans?f.spans.length:0,R=T-g;R>0&&this.recordDroppedEvent("before_send","span",R)}let h=f.transaction_info;if(a&&h&&f.transaction!==e.transaction){let T="custom";f.transaction_info={...h,source:T}}return this.sendEvent(f,n),f}).then(null,f=>{throw XB(f)||QB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),pm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
21
|
+
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===cp&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&S.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&S.log("No outcomes to send");return}if(!this._dsn){C&&S.log("No dsn provided, will not send outcomes");return}C&&S.log("Sending outcomes:",e);let n=$B(e,this._options.tunnel&&Bn(this._dsn));this.sendEnvelope(n)}};function ZB(t){return t==="replay_event"?"replay":t||"error"}function yce(t,e){let n=`${e} must return \`null\` or a valid event.`;if(vt(t))return t.then(r=>{if(!Mo(r)&&r!==null)throw pm(n);return r},r=>{throw pm(`${e} rejected with ${r}`)});if(!Mo(t)&&t!==null)throw pm(n);return t}function Ice(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(Ay(c)&&o)return o(c,r);if(r1(c)){if(i||a){let l=YB(c);if(a?.length&&Zl(l,a))return null;if(i){let p=i(l);p?c=Ss(n,WB(p)):Jl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&Zl(f,a)){fB(d,f);continue}if(i){let m=i(f);m?p.push(m):(Jl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function Ay(t){return t.type===void 0}function r1(t){return t.type==="transaction"}function Nce(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+o1(t.attributes)}function Oce(t){let e=0;return t.message&&(e+=t.message.length*2),e+o1(t.attributes)}function o1(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*e1(n[0]):Yl(n)?e+=e1(n):e+=100}),e}function e1(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function s1(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=Bn(o)),e&&(s.trace=e);let i=bce(t);return un(s,[i])}function bce(t){return[{type:"check_in"},t]}function i1(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function a1(t,e){return t(e.stack||"",1)}function Cce(t){return Kr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function Pce(t){return Cce(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function Ry(t,e){let n={type:e.name||e.constructor.name,value:Pce(e)},r=a1(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Mce(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function xce(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=UR(t);if(CR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=vce(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function vce(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Lce(t,e,n,r){if(Kr(n))return[n,void 0];if(e.synthetic=!0,Mo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:oy(n,s)},a=Mce(n);if(a)return[a,i];let c=xce(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function c1(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=Lce(t,s,n,r),c={exception:{values:[Ry(e,i)]}};return a&&(c.extra=a),jR(c,void 0,void 0),yc(c,s),{...c,event_id:r?.event_id}}function u1(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=a1(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},yc(s,{synthetic:!0}))}if(Ac(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var pp=class extends dm{constructor(e){dB(),i1(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=c1(this,this._options.stackParser,e,n);return r.level="error",wo(r)}eventFromMessage(e,n="info",r){return wo(u1(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return l1(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&l1(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:dt();if(!this._isEnabled())return C&&S.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,d]=kB(this,r);d&&(l.contexts={trace:d});let _=s1(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&S.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&S.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Uc(up)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function l1(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var yy=new Set;function Iy(t){t.forEach(e=>{yy.add(e),C&&S.log(`AI provider "${e}" wrapping will be skipped`)})}function Ki(t){return yy.has(t)}function Ny(){yy.clear(),C&&S.log("Cleared AI provider skip registrations")}var Dce=new Set(["false","f","n","no","off","0"]),Uce=new Set(["true","t","y","yes","on","1"]);function wc(t,e){let n=String(t).toLowerCase();return Dce.has(n)?!1:Uce.has(n)?!0:e?.strict?null:!!t}var wce="thismessage:/";function Oy(t){return"isRelative"in t}function dp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?wce:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function p1(t){if(Oy(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function kce(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?p1(t):t.pathname:"/");return`${o} ${s}`}function by(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[JR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),Oy(t)||(s[As]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[kce(t,e,r,o),s]}function bs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ko(t){return t.split(/[?#]/,1)[0]}function Cs(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function kc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Qi(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function Gc(t={}){let e=t.client||H();if(!am()||!e)return{};let n=cn(),r=Nr(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||he(),s=t.span||nr();if(!s&&$R())return{};let i=s?zf(s):Gce(o),a=s?Je(s):Jr(e,o),c=Vi(a);if(!qf.test(i))return S.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?lB(s):Bce(o)),p}function Gce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Rs(e,r,n)}function Bce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return ys(e,r,n)}var d1="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Xi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&S.log(d1,t),r;let o=Ts(t,e);return n?.set(t,o),C&&!o&&S.log(d1,t),o}function Cy(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function h1(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function _p(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=jce({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:T1(i),headers:h1(e),cookies:l,data:c}}function jce({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var _1=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],Hce=["x-forwarded-","-user"];function _m(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,h=f!==-1?_.substring(f+1):"",T=m.toLowerCase();m1(r,i,T,h,e,n)}}else m1(r,i,"",s,e,n)})}catch{}return r}function f1(t){return t.replace(/-/g,"_")}function m1(t,e,n,r,o,s){let i=Fce(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${f1(e)}${n?`.${f1(n)}`:""}`;t[a]=i}function Fce(t,e,n){if(n?_1.some(o=>t.includes(o)):[...Hce,..._1].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function T1(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var Vce=100;function rr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=Vce}=n.getOptions();if(s<=0)return;let a={timestamp:vo(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var E1,qce="FunctionToString",g1=new WeakMap,$ce=()=>({name:qce,setupOnce(){E1=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=DR(this),n=g1.has(H())&&e!==void 0?e:this;return E1.apply(n,t)}}catch{}},setup(t){g1.set(t,!0)}}),fm=$ce;var Yce=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Wce="EventFilters",Py=(t={})=>{let e;return{name:Wce,setup(n){let r=n.getOptions();e=S1(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=S1(t,s)}return zce(n,e)?null:n}}},hm=(t={})=>({...Py(t),name:"InboundFilters"});function S1(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Yce],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function zce(t,e){if(t.type){if(t.type==="transaction"&&Qce(t,e.ignoreTransactions))return C&&S.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
+
Event: ${Es(t)}`),!0}else{if(Kce(t,e.ignoreErrors))return C&&S.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
23
|
+
Event: ${Es(t)}`),!0;if(eue(t))return C&&S.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
24
|
+
Event: ${Es(t)}`),!0;if(Xce(t,e.denyUrls))return C&&S.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
25
25
|
Event: ${Es(t)}.
|
|
26
|
-
Url: ${
|
|
26
|
+
Url: ${mm(t)}`),!0;if(!Jce(t,e.allowUrls))return C&&S.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
27
27
|
Event: ${Es(t)}.
|
|
28
|
-
Url: ${_m(t)}`),!0}return!1}function Wce(t,e){return e?.length?cm(t).some(n=>Ts(n,e)):!1}function zce(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Ts(n,e):!1}function Kce(t,e){if(!e?.length)return!1;let n=_m(t);return n?Ts(n,e):!1}function Qce(t,e){if(!e?.length)return!0;let n=_m(t);return n?Ts(n,e):!0}function Xce(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function _m(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Xce(n):null}catch{return C&&g.error(`Cannot extract url for event ${Es(t)}`),null}}function Jce(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function g1(t,e,n,r,o,s){if(!o.exception?.values||!s||!Qr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=Cy(t,e,r,s.originalException,n,o.exception.values,i,0))}function Cy(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Qr(r[o],Error)){E1(i,a,r);let l=t(e,r[o]),p=c.length;S1(l,o,p,a),c=Cy(t,e,n,r[o],o,[l,...c],l,p)}return A1(r)&&r.errors.forEach((l,p)=>{if(Qr(l,Error)){E1(i,a,r);let d=t(e,l),_=c.length;S1(d,`errors[${p}]`,_,a),c=Cy(t,e,n,l,o,[d,...c],d,_)}}),c}function A1(t){return Array.isArray(t.errors)}function E1(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...A1(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function S1(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var Zce="cause",eue=5,tue="LinkedErrors",nue=(t={})=>{let e=t.limit||eue,n=t.key||Zce;return{name:tue,preprocessEvent(r,o,s){let i=s.getOptions();g1(gy,i.stackParser,n,e,r,o)}}},mm=nue;function R1(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var Py=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function y1(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return Py.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?rue(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&oue(s))||null}function rue(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function oue(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var sue={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},iue="RequestData",aue=(t={})=>{let e={...sue,...t.include};return{name:iue,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&cue(n,i,{ipAddress:a},c),n}}},hm=aue;function cue(t,e,n,r){if(t.request={...t.request,...uue(e,r)},r.ip){let o=e.headers&&y1(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function uue(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||Py.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?R1(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function I1(t){let e="console";Ec(e,t),Sc(e,lue)}function lue(){"console"in J&&ql.forEach(function(t){t in J.console&&xR(J.console,t,function(e){return Tc[t]=e,function(...n){gc("console",{args:n,level:t}),Tc[t]?.apply(J.console,n)}})})}function O1(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var pue=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function due(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=pue.exec(e);return n?n.slice(1):[]}function My(t){let e=due(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var _ue=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,Tm=Symbol("sentryPostgresConnectionContext"),xy=Symbol.for("sentry.instrumented.postgresjs"),fue=Symbol.for("sentry.query.from.instrumented.sql");function Ly(t,e){return!t||typeof t!="function"?(C&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):vy(t,{requireParentSpan:!0,...e})}function vy(t,e,n){if(t[xy])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&b1(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?mue(i,o,r,e):s==="begin"||s==="reserve"?hue(i,o,r,e):i}});return n?r[Tm]=n:Aue(t,r),t[xy]=!0,r[xy]=!0,r}function mue(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&b1(s,n,r),s}}function hue(t,e,n,r){return function(...o){let s=n[Tm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>vy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=vy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function b1(t,e,n){if(t.handle?.__sentryWrapped)return;t[fue]=!0;let r=t.handle,o=async function(...s){if(!Tue(n))return r.apply(this,s);let i=Eue(t.strings),a=Sue(i);return It({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[Tm]:void 0;if(gue(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&g.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{N1(c,a,f?.[0]?.command),c.end()}catch(m){C&&g.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),N1(c,a),c.end()}catch(m){C&&g.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function Tue(t){return nr()!==void 0||!t.requireParentSpan}function Eue(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function Sue(t){return t?t.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"}function gue(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function N1(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(_ue);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function Aue(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[Tm]=i}var Rue="Console",Em=(t={})=>{let e=new Set(t.levels||ql);return{name:Rue,setup(n){I1(({args:r,level:o})=>{H()!==n||!e.has(o)||yue(o,r)})}}};function yue(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:O1(t),message:C1(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${C1(r)}`:"Assertion failed",n.data.arguments=r}else return;rr(n,{input:e,level:t})}function C1(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):UR(t," ")}var Iue="ConversationId",Oue=()=>({name:Iue,setup(t){t.on("spanStart",e=>{let n=he().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(XR,o)})}}),Dy=Oue;var P1="gen_ai.prompt",Ps="gen_ai.system",He="gen_ai.request.model",Bc="gen_ai.request.stream",Ms="gen_ai.request.temperature",jc="gen_ai.request.max_tokens",xs="gen_ai.request.frequency_penalty",Hc="gen_ai.request.presence_penalty",vs="gen_ai.request.top_p",Sm="gen_ai.request.top_k",M1="gen_ai.request.encoding_format",x1="gen_ai.request.dimensions",yn="gen_ai.response.finish_reasons",ft="gen_ai.response.model",or="gen_ai.response.id",v1="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",ln="gen_ai.usage.total_tokens",Dt="gen_ai.operation.name",pn="sentry.sdk_meta.gen_ai.input.messages.original_length",Ut="gen_ai.input.messages",L1="gen_ai.output.messages",Hn="gen_ai.system_instructions",rt="gen_ai.response.text",Zr="gen_ai.request.available_tools",Ji="gen_ai.response.streaming",Ot="gen_ai.response.tool_calls",Uy="gen_ai.agent.name",D1="gen_ai.pipeline.name",fp="gen_ai.conversation.id",U1="gen_ai.usage.cache_creation_input_tokens",w1="gen_ai.usage.cache_read_input_tokens",wy="gen_ai.usage.input_tokens.cache_write",Ls="gen_ai.usage.input_tokens.cached",gm="gen_ai.invoke_agent",k1="gen_ai.generate_text",G1="gen_ai.stream_text",B1="gen_ai.generate_object",j1="gen_ai.stream_object",Fc="gen_ai.embeddings.input",H1="gen_ai.embeddings",F1="gen_ai.embeddings",V1="gen_ai.rerank",q1="gen_ai.execute_tool",Zi="gen_ai.tool.name",ky="gen_ai.tool.call.id",Gy="gen_ai.tool.type",Am="gen_ai.tool.input",Rm="gen_ai.tool.output",$1="gen_ai.tool.description",By="openai.response.id",jy="openai.response.model",Hy="openai.response.timestamp",Y1="openai.usage.completion_tokens",W1="openai.usage.prompt_tokens",Fy="anthropic.response.timestamp";var mp=new Map,Vy=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),qy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),z1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),K1=new Set(["ai.rerank.doRerank"]),Q1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ds(t){return!t||typeof t!="object"?!1:bue(t)||J1(t)||Nue(t)||Z1(t)||ej(t)||Cue(t)||Pue(t)||Mue(t)||xue(t)||vue(t)||Lue(t)||Due(t)}function Nue(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):X1(t):!1}function X1(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function bue(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ds(t.source)}function J1(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function Z1(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function ej(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function Cue(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function Pue(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function Mue(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function xue(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function vue(t){return"b64_json"in t}function Lue(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function Due(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var hp="[Blob substitute]",Uue=["image_url","data","content","b64_json","result","uri","image"];function ea(t){let e={...t};Ds(e.source)&&(e.source=ea(e.source)),J1(t)&&(e.inlineData={...t.inlineData,data:hp}),X1(t)&&(e.image_url={...t.image_url,url:hp}),Z1(t)&&(e.input_audio={...t.input_audio,data:hp}),ej(t)&&(e.file={...t.file,file_data:hp});for(let n of Uue)typeof e[n]=="string"&&(e[n]=hp);return e}var nj=2e4,ym=t=>new TextEncoder().encode(t).length,Yy=t=>ym(JSON.stringify(t));function Im(t,e){if(ym(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);ym(i)<=e?(o=i,n=s+1):r=s-1}return o}function wue(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function tj(t,e){return typeof t=="string"?e:{...t,text:e}}function kue(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function rj(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function oj(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function Gue(t,e){let n={...t,content:""},r=Yy(n),o=e-r;if(o<=0)return[];let s=Im(t.content,o);return[{...t,content:s}]}function Bue(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function jue(t,e){let{key:n,items:r}=Bue(t);if(n===null||r.length===0)return[];let o=r.map(c=>tj(c,"")),s=Yy({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=wue(c),p=ym(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=Im(l,i);d&&a.push(tj(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function Hue(t,e){if(!t)return[];if(typeof t=="string"){let n=Im(t,e);return n?[n]:[]}return typeof t!="object"?[]:kue(t)?Gue(t,e):rj(t)||oj(t)?jue(t,e):[]}function $y(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(rj(n)?r={...n,content:$y(n.content)}:"content"in n&&Ds(n.content)&&(r={...n,content:ea(n.content)}),oj(n)&&(r={...r??n,parts:$y(n.parts)}),Ds(r)?r=ea(r):Ds(n)&&(r=ea(n))),r??n})}function Fue(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=$y([r]),s=o[0];return Yy(s)<=n?o:Hue(s,n)}function Us(t){return Fue(t,nj)}function sj(t){return Im(t,nj)}function eo(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Vc(t,e){return t?`${t}.${e}`:e}function Tp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[ln]:s})}}function ta(t){if(typeof t=="string")return sj(t);if(Array.isArray(t)){let e=Us(t);return JSON.stringify(e)}return JSON.stringify(t)}function Fn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function Vue(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function qc(t,e,n){return Lt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return Vue(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var Om="operation.name",ij="ai.operationId",Nm="ai.prompt",aj="ai.schema",cj="ai.response.object",Wy="ai.values",zy="ai.response.text",Ky="ai.response.toolCalls",uj="ai.response.finishReason",na="ai.prompt.messages",$c="ai.prompt.tools",Ep="ai.model.id",lj="ai.response.providerMetadata",pj="ai.usage.cachedInputTokens",dj="ai.telemetry.functionId",_j="ai.usage.completionTokens",fj="ai.usage.promptTokens",mj="ai.usage.tokens",Qy="ai.toolCall.name",Xy="ai.toolCall.id",hj="ai.toolCall.args",Tj="ai.toolCall.result";function Sj(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function Jy(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function que(t){let e=new Map;for(let n of t){let r=n.data[Zr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function gj(t,e){let n=que(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[Zi];if(typeof o=="string"){let s=n.get(o);s&&(r.data[$1]=s)}}r.op==="gen_ai.invoke_agent"&&Jy(r,e)}}function Zy(t){return mp.get(t)}function eI(t){mp.delete(t)}function Aj(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function Ej(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function $ue(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...Ej(n)),s;if(Array.isArray(r))return s.push(...Ej(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function Rj(t,e){if(typeof e[Nm]=="string"&&!e[Ut]&&!e[na]){let n=e[Nm],r=$ue(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0,a=ta(s);t.setAttributes({[Nm]:a,[Ut]:a,[pn]:i})}}else if(typeof e[na]=="string")try{let n=JSON.parse(e[na]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=Fn(n);r&&t.setAttribute(Hn,r);let s=Array.isArray(o)?o.length:0,i=ta(o);t.setAttributes({[na]:i,[Ut]:i,[pn]:s})}}catch{}}function yj(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return gm;case"ai.generateText.doGenerate":return k1;case"ai.streamText.doStream":return G1;case"ai.generateObject.doGenerate":return B1;case"ai.streamObject.doStream":return j1;case"ai.embed.doEmbed":return H1;case"ai.embedMany.doEmbed":return F1;case"ai.rerank.doRerank":return V1;case"ai.toolCall":return q1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function Yue(t){return Vy.has(t)?"invoke_agent":qy.has(t)?"generate_content":z1.has(t)?"embeddings":K1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function Wue(t){let{data:e,description:n}=Y(t);if(n){if(e[Qy]&&e[Xy]&&n==="ai.toolCall"){Jue(t,e);return}!e[ij]&&!n.startsWith("ai.")||Zue(t,n,e)}}function zue(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)Xue(r),Sj(r,e);gj(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Jy(n,e)}return t}function Kue(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function Que(t){let e=t[zy],n=t[Ky],r=t[uj];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Ky]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:Kue(r)};t[L1]=JSON.stringify([s]),delete t[zy]}}function Xue(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),wt(e,_j,Ze),wt(e,fj,Pe),wt(e,pj,Ls),wt(e,"ai.usage.inputTokens",Pe),wt(e,"ai.usage.outputTokens",Ze),wt(e,mj,Pe),wt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Ls]=="number"&&(e[Pe]=e[Pe]+e[Ls]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[ln]=r+e[Pe]}if(e[$c]&&Array.isArray(e[$c])&&(e[$c]=Aj(e[$c])),e[Om]){let r=Yue(e[Om]);e[Dt]=r,delete e[Om]}if(wt(e,na,Ut),Que(e),wt(e,cj,"gen_ai.response.object"),wt(e,$c,"gen_ai.request.available_tools"),wt(e,hj,Am),wt(e,Tj,Rm),wt(e,aj,"gen_ai.request.schema"),wt(e,Ep,He),Array.isArray(e[Wy])){let r=e[Wy].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Fc]=r.length===1?r[0]:JSON.stringify(r)}ele(e);for(let r of Object.keys(e))r.startsWith("ai.")&&wt(e,r,`vercel.${r}`)}}function wt(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function Jue(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(Dt,"execute_tool"),wt(e,Qy,Zi),wt(e,Xy,ky);let n=e[ky];typeof n=="string"&&mp.set(n,t.spanContext()),e[Gy]||t.setAttribute(Gy,"function");let r=e[Zi];r&&t.updateName(`execute_tool ${r}`)}function Zue(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[dj];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),Rj(t,n),n[Ep]&&!n[ft]&&t.setAttribute(ft,n[Ep]),t.setAttribute("ai.streaming",e.includes("stream"));let s=yj(e);if(s&&t.setAttribute(ee,s),Vy.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[Ep];if(i){let a=qy.has(e)?"generate_content":Q1[e];a&&t.updateName(`${a} ${i}`)}}function bm(t){t.on("spanStart",Wue),t.addEventProcessor(Object.assign(zue,{id:"VercelAiEventProcessor"}))}function ele(t){let e=t[lj];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(vr(t,Ls,r.cachedPromptTokens),vr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),vr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),vr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||vr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;vr(t,Ls,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;vr(t,wy,s)}n.bedrock?.usage&&(vr(t,Ls,n.bedrock.usage.cacheReadInputTokens),vr(t,wy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(vr(t,Ls,n.deepseek.promptCacheHitTokens),vr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function vr(t,e,n){n!=null&&(t[e]=n)}var ws="OpenAI",Ij={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},tle=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Oj=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...tle];function Nj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function bj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function Cj(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function Pj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function Mj(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function xj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function vj(t,e,n){if(Cm(t,e.id,e.model,e.created),e.usage&&Sp(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[yn]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Lj(t,e,n){if(Cm(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[yn]:JSON.stringify([e.status])}),e.usage&&Sp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Dj(t,e){t.setAttributes({[jy]:e.model,[ft]:e.model}),e.usage&&Sp(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function Uj(t,e){let{id:n,created_at:r}=e;t.setAttributes({[By]:n,[or]:n,[fp]:n}),r&&t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function Sp(t,e,n,r){e!==void 0&&t.setAttributes({[W1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[Y1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[ln]:r})}function Cm(t,e,n,r){t.setAttributes({[By]:e,[or]:e}),t.setAttributes({[jy]:n,[ft]:n}),t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function nle(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function wj(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ms]=t.temperature),"top_p"in t&&(e[vs]=t.top_p),"frequency_penalty"in t&&(e[xs]=t.frequency_penalty),"presence_penalty"in t&&(e[Hc]=t.presence_penalty),"stream"in t&&(e[Bc]=t.stream),"encoding_format"in t&&(e[M1]=t.encoding_format),"dimensions"in t&&(e[x1]=t.dimensions);let n=nle(t);return n&&(e[fp]=n),e}function rle(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function ole(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&rle(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function sle(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!Oj.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*kj(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)xj(o)?ole(o,r,n):Mj(o)&&sle(o,r,n,e),yield o}finally{Cm(e,r.responseId,r.responseModel,r.responseTimestamp),Sp(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[Ot]:JSON.stringify(s)}),e.end()}}function ile(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&g.error("Failed to serialize OpenAI tools:",s);return}}function ale(t,e){let n={[Ps]:"openai",[Dt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=ile(r);o&&(n[Zr]=o),Object.assign(n,wj(r))}else n[He]="unknown";return n}function cle(t,e,n){if(!e||typeof e!="object")return;let r=e;if(Nj(r)){if(vj(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else bj(r)?(Lj(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):Cj(r)?Dj(t,r):Pj(r)&&Uj(t,r)}function Gj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Fc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=ta(s);t.setAttribute(Ut,i),Array.isArray(s)?t.setAttribute(pn,s.length):t.setAttribute(pn,1)}function ule(t,e,n,r,o){return function(...i){let a=n.operation,c=ale(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let h,T=It(_,S=>(h=t.apply(r,i),o.recordInputs&&p&&Gj(S,p,a),(async()=>{try{let R=await h;return kj(R,S,o.recordOutputs??!1)}catch(R){throw S.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),S.end(),R}})()));return qc(h,T,"auto.ai.openai")}let f,m=xr(_,h=>(f=t.apply(r,i),o.recordInputs&&p&&Gj(h,p,a),f.then(T=>(cle(h,T,o.recordOutputs),T),T=>{throw te(T,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),T})));return qc(f,m,"auto.ai.openai")}}function Bj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=Ij[i];return typeof s=="function"&&a?ule(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Bj(s,i,n):s}})}function Pm(t,e){return Bj(t,"",eo(e))}var ks="Anthropic_AI",jj={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function Hj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=Fn(e);n&&t.setAttributes({[Hn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Ut]:ta(r),[pn]:o})}var lle={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function tI(t){return t&&lle[t]||"internal_error"}function Fj(t,e){e.error&&(t.setStatus({code:2,message:tI(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Vj(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function ple(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:tI(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function dle(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function _le(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function fle(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function mle(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function qj(t,e,n,r){!(t&&typeof t=="object")||ple(t,r)||(dle(t,e),_le(t,e),fle(t,e,n),mle(t,e))}function hle(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[or]:t.responseId}),t.responseModel&&e.setAttributes({[ft]:t.responseModel}),Tp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),t.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(t.toolCalls)}),e.end())}async function*$j(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)qj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[or]:r.responseId}),r.responseModel&&e.setAttributes({[ft]:r.responseModel}),Tp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(r.toolCalls)}),e.end()}}function Yj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{qj(o,r,n,e)}),t.on("message",()=>{hle(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function Tle(t,e,n){let r={[Ps]:"anthropic",[Dt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Zr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ms]=o.temperature),"top_p"in o&&(r[vs]=o.top_p),"stream"in o&&(r[Bc]=o.stream),"top_k"in o&&(r[Sm]=o.top_k),"frequency_penalty"in o&&(r[xs]=o.frequency_penalty),"max_tokens"in o&&(r[jc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function nI(t,e){let n=Vj(e);Hj(t,n),"prompt"in e&&t.setAttributes({[P1]:JSON.stringify(e.prompt)})}function Ele(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[Ot]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function Sle(t,e){"id"in e&&"model"in e&&(t.setAttributes({[or]:e.id,[ft]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[Fy]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[Fy]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&Tp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function gle(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){Fj(t,e);return}n&&Ele(t,e),Sle(t,e)}}function Wj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function Ale(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=It(_,h=>(f=t.apply(n,r),c.recordInputs&&a&&nI(h,a),(async()=>{try{let T=await f;return $j(T,h,c.recordOutputs??!1)}catch(T){return Wj(T,h,i)}})()));return qc(f,m,"auto.ai.anthropic")}else return It(_,f=>{try{c.recordInputs&&a&&nI(f,a);let m=e.apply(n,r);return Yj(m,f,c.recordOutputs??!1)}catch(m){return Wj(m,f,i)}})}function Rle(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=Tle(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return Ale(t,s,r,a,l,c,e,d,o,_,f);let m,h=xr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},T=>(m=s.apply(r,a),o.recordInputs&&d&&nI(T,d),m.then(S=>(gle(T,S,o.recordOutputs),S),S=>{throw te(S,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),S})));return qc(m,h,"auto.ai.anthropic")}})}function zj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=jj[i];return typeof s=="function"&&a?Rle(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?zj(s,i,n):s}})}function Mm(t,e){return zj(t,"",eo(e))}var Gs="Google_GenAI",Kj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},Qj="google_genai",rI="chats.create",Xj="chat";function yle(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function Ile(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function Ole(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function Nle(t,e,n,r){!t||yle(t,r)||(Ile(t,e),Ole(t,e,n))}async function*Jj(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)Nle(o,r,n,e),yield o}finally{let o={[Ji]:!0};r.responseId&&(o[or]=r.responseId),r.responseModel&&(o[ft]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[ln]=r.totalTokens),r.finishReasons.length&&(o[yn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[Ot]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function Yc(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>Yc(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function Zj(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function ble(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ms]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[vs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[Sm]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[jc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[xs]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[Hc]=t.presencePenalty),e}function Cle(t,e,n){let r={[Ps]:Qj,[Dt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=Zj(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,ble(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Zr]=JSON.stringify(s)}}}else r[He]=Zj({},n);return r}function eH(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Fc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...Yc(e.config.systemInstruction,"system")),"history"in e&&r.push(...Yc(e.history,"user")),"contents"in e&&r.push(...Yc(e.contents,"user")),"message"in e&&r.push(...Yc(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[pn]:i,[Ut]:JSON.stringify(Us(s))})}}function Ple(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(ft,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[ln]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[Ot]:JSON.stringify(r)})}}}function tH(t,e,n,r,o){let s=e===rI,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=Cle(p,d,r),f=_[He]??"unknown";return n.streaming?It({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&eH(m,d,i);let h=await a.apply(r,l);return Jj(h,m,!!o.recordOutputs)}catch(h){throw m.setStatus({code:2,message:"internal_error"}),te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),h}}):xr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&eH(m,d,i),Mr(()=>a.apply(r,l),h=>{te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},h=>{!s&&!i&&Ple(m,h,o.recordOutputs)})))}})}function oI(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Vc(e,String(o)),c=Kj[a];if(typeof i=="function"&&c){if(a===rI){let l=tH(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?oI(_,Xj,n):_}}return tH(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?oI(i,a,n):i}})}function xm(t,e){return oI(t,"",eo(e))}var vm="LangChain",ra="auto.ai.langchain",nH={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var sr=(t,e,n)=>{n!=null&&(t[e]=n)},Vn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Go(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Wc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ds(n)?ea(n):n);return JSON.stringify(e)}catch{return String(t)}return Go(t)}function gp(t){let e=t.toLowerCase();return nH[e]??e}function rH(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function sI(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function Ap(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:gp(o),content:Wc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?rH(s):"user";return{role:gp(i),content:Wc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:gp(o),content:Wc(e.content)}}if(e.role)return{role:gp(String(e.role)),content:Wc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:gp(rH(r)),content:Wc(e.content)}:{role:"user",content:Wc(e.content)}})}function Mle(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Vn(r,Ms,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Vn(r,jc,i);let a=e?.top_p??o?.top_p;Vn(r,vs,a);let c=e?.frequency_penalty;Vn(r,xs,c);let l=e?.presence_penalty;return Vn(r,Hc,l),e&&"stream"in e&&sr(r,Bc,!!e.stream),r}function oH(t,e,n,r,o){return{[Ps]:Go(t??"langchain"),[Dt]:"chat",[He]:Go(e),[W]:ra,...Mle(n,r,o)}}function sH(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){sr(a,pn,e.length);let c=e.map(l=>({role:"user",content:l}));sr(a,Ut,Go(c))}return a}function iH(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=Ap(e.flat()),{systemInstructions:l,filteredMessages:p}=Fn(c);l&&sr(a,Hn,l);let d=Array.isArray(p)?p.length:0;sr(a,pn,d);let _=Us(p);sr(a,Ut,Go(_))}return a}function xle(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&sr(e,Ot,Go(n))}function vle(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Vn(e,Pe,n.promptTokens),Vn(e,Ze,n.completionTokens),Vn(e,ln,n.totalTokens);else if(r){Vn(e,Pe,r.input_tokens),Vn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Vn(e,ln,i),r.cache_creation_input_tokens!==void 0&&Vn(e,U1,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Vn(e,w1,r.cache_read_input_tokens)}}function aH(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&sr(n,yn,Go(l)),xle(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&sr(n,rt,Go(p))}}vle(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&sr(n,ft,i);let a=r?.id??s?.id;a&&sr(n,or,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&sr(n,v1,Go(c)),n}function Lm(t={}){let{recordInputs:e,recordOutputs:n}=eo(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(i,a,c,l,p,d,_,f){let m=sI(d),h=sH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=sI(d),h=iH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=aH(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",h={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(h["langchain.chain.inputs"]=JSON.stringify(a)),It({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...h,[ee]:"gen_ai.invoke_agent"}},T=>(r.set(c,T),T))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:ra,[Zi]:p};e&&(d[Am]=a),It({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[Rm]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.tool_error_handler`}})},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}var Dm="LangGraph",iI="auto.ai.langgraph";function Lle(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function Dle(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function Ule(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(ft,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(yn,[r.finish_reason])}}function cH(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function uH(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=Lle(i);a&&t.setAttribute(Ot,JSON.stringify(a));let c=Ap(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=Dle(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,Ule(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(ln,d)}function aI(t,e){return new Proxy(t,{apply(n,r,o){return xr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:iI,[ee]:"gen_ai.create_agent",[Dt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(Uy,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=wle(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function wle(t,e,n,r){return new Proxy(t,{apply(o,s,i){return xr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:iI,[ee]:gm,[Dt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(D1,c),a.setAttribute(Uy,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(fp,d);let _=cH(e);_&&a.setAttribute(Zr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,h=i.length>0?i[0]?.messages??[]:[];if(h&&f){let S=Ap(h),{systemInstructions:R,filteredMessages:I}=Fn(S);R&&a.setAttribute(Hn,R);let x=Us(I),F=Array.isArray(I)?I.length:0;a.setAttributes({[Ut]:JSON.stringify(x),[pn]:F})}let T=await Reflect.apply(o,s,i);return m&&uH(a,h??null,T),T}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function Um(t,e){return t.compile=aI(t.compile,eo(e)),t}function Rp(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function yp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function pH(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function dH(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){a=l.slice(0,h),c=l.slice(h+1);let T=a.indexOf(".Module");T>0&&(l=l.slice(T+1),a=a.slice(0,T))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||xf,l=p?`${p}.${d}`:d);let _=MG(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?kle(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:lH(i[3]),colno:lH(i[4]),in_app:pH(_||"",f)}}if(o.match(e))return{filename:o}}}function cI(t){return[90,dH(t)]}function lH(t){return parseInt(t||"",10)||void 0}function kle(t){try{return decodeURI(t)}catch{return}}var In=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var uI=K(ne(),1),Ip={};function w(t,e,n){return n?ipe(t,e,n):spe(t,e)}function spe(t,e){return Object.assign(n=>{let r=Ip[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return Ip[t]=o,(0,uI.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function ipe(t,e,n){return Object.assign(r=>{let o=n(r),s=Ip[t];if(s)return s.setConfig(o),s;let i=new e(o);return Ip[t]=i,(0,uI.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Op(t){let e=!1,n=[];if(!ape(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function ape(t){return typeof t._wrap=="function"}b();import{subscribe as cpe}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var wm="@sentry/instrumentation-http";function _H(t,e,n,r){let o=0,s=[];re&&g.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&g.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(h,T,S)=>{try{let R=S[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&g.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,T,S)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&g.error(r,"Error building captured request body",c)}})}catch(c){re&&g.error(r,"Error patching request to capture body",c)}}var fH=Un("sentry_http_server_instrumented"),pI="Http.Server",lI=new Map,mH=new WeakSet;function hH(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var upe=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:pI,setupOnce(){cpe("http.server.request.start",r=>{lpe(r.server,e)})},afterAllSetup(n){re&&n.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}},Np=upe;function lpe(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(mH.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(fH)||!p)return a.apply(c,l);re&&g.log(pI,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=_p(_),h=_.ip||_.socket?.remoteAddress,T=_.url||"/";n!=="none"&&!e?.(T,_)&&_H(_,d,n,pI),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:h});let S=(_.method||"GET").toUpperCase(),R=ko(T),I=`${S} ${R}`;return d.setTransactionName(I),r&&p&&ppe(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),zl(d,()=>{let x={traceId:zt(),sampleRand:yt(),propagationSpanId:Kt()};he().setPropagationContext({...x}),d.setPropagationContext({...x});let F=Ar.extract(P.active(),m.headers).setValue(fH,!0);return P.with(F,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});mH.add(i),t.emit=i}function ppe(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&g.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=lI.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&g.log("Opened new request session aggregate.");let l={[i]:c};lI.set(t,l);let p=()=>{clearTimeout(_),d(),lI.delete(t);let f=Object.entries(l).map(([m,h])=>({started:m,exited:h.exited,errored:h.errored,crashed:h.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&g.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&g.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var Bo=K(Te(),1);le();import{errorMonitor as dpe}from"node:events";var TH="Http.ServerSpans",_pe=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:TH,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;hH(_,h=>{if(hpe(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&g.log(TH,"Skipping span creation for incoming request",_.url),h();let T=d.url||_.url||"/",S=dp(T),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],F=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,on=T.startsWith("https")?"https":"http",Io=d.method||_.method?.toUpperCase()||"GET",ss=S?S.pathname:ko(T),Ii=`${Io} ${ss}`,Et=ve.startSpan(Ii,{kind:Ne.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":fpe(_)||void 0,"http.url":T,"http.method":d.method,"http.target":S?`${S.pathname}${S.search}`:ss,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":on,"http.flavor":F,"net.transport":F?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...Tpe(_),...pm(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(Et,_),i?.(Et,f),a?.(Et,_,f),o?.(Et,_,f);let Ya={type:Bo.RPCType.HTTP,span:Et};return P.with((0,Bo.setRPCMetadata)(X.setSpan(P.active(),Et),Ya),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Wa=!1;function DC(o_){if(Wa)return;Wa=!0;let UC=gpe(_,f);Et.setAttributes(UC),Et.setStatus(o_),Et.end();let wC=UC["http.route"];wC&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${wC}`)}return f.on("close",()=>{DC(Do(f.statusCode))}),f.on(dpe,()=>{let o_=Do(f.statusCode);DC(o_.code===2?o_:{code:2})}),h()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&Ape(l,r))return re&&g.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},bp=_pe;function fpe(t){return t.headers["next-router-prefetch"]==="1"}function mpe(t){let e=ko(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function hpe(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,Bo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&mpe(r)||n?.(r,t))}function Tpe(t){let e=Epe(t.headers);return e==null?{}:Spe(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function Epe(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function Spe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function gpe(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[bo]:r,[Mi]:r,"http.status_text":o?.toUpperCase()},i=(0,Bo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[Zg]=a,s[eA]=c,s[Jg]=l,s["net.peer.port"]=p}if(s[Mi]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===Bo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[Co]=a}return s}function Ape(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var AH=K(Te(),1),Pp=K(ne(),1);le();import{subscribe as dI,unsubscribe as _I}from"node:diagnostics_channel";import{errorMonitor as gH}from"node:events";function Cp(t,e){if(!t)return e;let n=qi(t),r=qi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(Xr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(Xr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return jf(a)}var zc="@sentry/instrumentation-http";function EH(t,e){let n=Rpe(t),r=e?.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function km(t,e){let n=Gm(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&g.log(zc,"Added sentry-trace header to outgoing request")}catch(p){re&&g.error(zc,"Failed to add sentry-trace header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&g.log(zc,"Added traceparent header to outgoing request")}catch(p){re&&g.error(zc,"Failed to add traceparent header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=Cp(p,a);if(d)try{t.setHeader("baggage",d),re&&g.log(zc,"Added baggage header to outgoing request")}catch(_){re&&g.error(zc,"Failed to add baggage header to outgoing request:",Kr(_)?_.message:"Unknown error")}}}}function Rpe(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=bs(n.toString()),o={url:Cs(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function SH(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function Gm(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var oa=class extends Pp.InstrumentationBase{constructor(e={}){super(wm,pe,e),this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,dI("http.client.response.finish",n),dI("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&dI("http.client.request.created",o)),a),i=()=>{_I("http.client.response.finish",n),_I("http.client.request.error",r),_I("http.client.request.created",o)};return[new Pp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new Pp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=ype(e),s=Jf({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=Ipe(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:Do(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(gH,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(gH,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&g.log(wm,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&EH(e,n)}_onOutgoingRequestCreated(e){re&&g.log(wm,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{km(e,this._propagationDecisionMap)})}else o&&km(e,this._propagationDecisionMap)}else o&&km(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,AH.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=SH(e),o=Gm(e);return n(o,r)}};function ype(t){let e=Gm(t),[n,r]=Oy(dp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[RA]:o,[cs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function Ipe(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[bo]:e,[hA]:r,"http.flavor":r,[TA]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...Ope(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[fA]=a,i[mA]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function Ope(t){let e=Npe(t.headers);return e==null?{}:bpe(t.headers)?{[nA]:e}:{[rA]:e}}function Npe(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function bpe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var RH="Http",Cpe=w(`${RH}.sentry`,t=>new oa(t)),yH=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=Np(e),s=bp(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:RH,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),Cpe(r)},processEvent(l){return s.processEvent(l)}}};b();var NH=K(Te(),1),bH=K(ne(),1);import*as Kc from"diagnostics_channel";var Lr=BR(process.versions.node),jo=Lr.major,Mp=Lr.minor;var fI="sentry-trace",Bm="baggage",Ppe="traceparent";function IH(t,e){let n=jm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:Mpe(t.headers);if(mI(l,fI),mI(l,Bm),o&&mI(l,Ppe),!(hI(l,fI)!==-1)){i&&l.push(fI,i),c&&hI(l,"traceparent")===-1&&l.push("traceparent",c);let d=hI(l,Bm);if(a&&d===-1)l.push(Bm,a);else if(a){let _=l[d+1],f=Cp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=xpe(l))}function Mpe(t){let e=t.split(`\r
|
|
29
|
-
`),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{
|
|
28
|
+
Url: ${mm(t)}`),!0}return!1}function Kce(t,e){return e?.length?lm(t).some(n=>Ts(n,e)):!1}function Qce(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Ts(n,e):!1}function Xce(t,e){if(!e?.length)return!1;let n=mm(t);return n?Ts(n,e):!1}function Jce(t,e){if(!e?.length)return!0;let n=mm(t);return n?Ts(n,e):!0}function Zce(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function mm(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Zce(n):null}catch{return C&&S.error(`Cannot extract url for event ${Es(t)}`),null}}function eue(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function y1(t,e,n,r,o,s){if(!o.exception?.values||!s||!Qr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=My(t,e,r,s.originalException,n,o.exception.values,i,0))}function My(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Qr(r[o],Error)){A1(i,a,r);let l=t(e,r[o]),p=c.length;R1(l,o,p,a),c=My(t,e,n,r[o],o,[l,...c],l,p)}return I1(r)&&r.errors.forEach((l,p)=>{if(Qr(l,Error)){A1(i,a,r);let d=t(e,l),_=c.length;R1(d,`errors[${p}]`,_,a),c=My(t,e,n,l,o,[d,...c],d,_)}}),c}function I1(t){return Array.isArray(t.errors)}function A1(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...I1(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function R1(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var tue="cause",nue=5,rue="LinkedErrors",oue=(t={})=>{let e=t.limit||nue,n=t.key||tue;return{name:rue,preprocessEvent(r,o,s){let i=s.getOptions();y1(Ry,i.stackParser,n,e,r,o)}}},Tm=oue;function N1(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var xy=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function O1(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return xy.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?sue(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&iue(s))||null}function sue(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function iue(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var aue={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},cue="RequestData",uue=(t={})=>{let e={...aue,...t.include};return{name:cue,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&lue(n,i,{ipAddress:a},c),n}}},Em=uue;function lue(t,e,n,r){if(t.request={...t.request,...pue(e,r)},r.ip){let o=e.headers&&O1(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function pue(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||xy.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?N1(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function b1(t){let e="console";Ec(e,t),gc(e,due)}function due(){"console"in J&&ql.forEach(function(t){t in J.console&&LR(J.console,t,function(e){return Tc[t]=e,function(...n){Sc("console",{args:n,level:t}),Tc[t]?.apply(J.console,n)}})})}function C1(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var _ue=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function fue(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=_ue.exec(e);return n?n.slice(1):[]}function vy(t){let e=fue(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var mue=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,gm=Symbol("sentryPostgresConnectionContext"),Ly=Symbol.for("sentry.instrumented.postgresjs"),hue=Symbol.for("sentry.query.from.instrumented.sql");function Uy(t,e){return!t||typeof t!="function"?(C&&S.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):Dy(t,{requireParentSpan:!0,...e})}function Dy(t,e,n){if(t[Ly])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&M1(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?Tue(i,o,r,e):s==="begin"||s==="reserve"?Eue(i,o,r,e):i}});return n?r[gm]=n:yue(t,r),t[Ly]=!0,r[Ly]=!0,r}function Tue(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&M1(s,n,r),s}}function Eue(t,e,n,r){return function(...o){let s=n[gm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>Dy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=Dy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function M1(t,e,n){if(t.handle?.__sentryWrapped)return;t[hue]=!0;let r=t.handle,o=async function(...s){if(!gue(n))return r.apply(this,s);let i=Sue(t.strings),a=Aue(i);return yt({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[gm]:void 0;if(Rue(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&S.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{P1(c,a,f?.[0]?.command),c.end()}catch(m){C&&S.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),P1(c,a),c.end()}catch(m){C&&S.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function gue(t){return nr()!==void 0||!t.requireParentSpan}function Sue(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function Aue(t){return t?t.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"}function Rue(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function P1(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(mue);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function yue(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[gm]=i}var Iue="Console",Sm=(t={})=>{let e=new Set(t.levels||ql);return{name:Iue,setup(n){b1(({args:r,level:o})=>{H()!==n||!e.has(o)||Nue(o,r)})}}};function Nue(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:C1(t),message:x1(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${x1(r)}`:"Assertion failed",n.data.arguments=r}else return;rr(n,{input:e,level:t})}function x1(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):kR(t," ")}var Oue="ConversationId",bue=()=>({name:Oue,setup(t){t.on("spanStart",e=>{let n=he().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(ZR,o)})}}),wy=bue;var v1="gen_ai.prompt",Ps="gen_ai.system",He="gen_ai.request.model",Bc="gen_ai.request.stream",Ms="gen_ai.request.temperature",jc="gen_ai.request.max_tokens",xs="gen_ai.request.frequency_penalty",Hc="gen_ai.request.presence_penalty",vs="gen_ai.request.top_p",Am="gen_ai.request.top_k",L1="gen_ai.request.encoding_format",D1="gen_ai.request.dimensions",yn="gen_ai.response.finish_reasons",_t="gen_ai.response.model",or="gen_ai.response.id",U1="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",ln="gen_ai.usage.total_tokens",Lt="gen_ai.operation.name",pn="sentry.sdk_meta.gen_ai.input.messages.original_length",Dt="gen_ai.input.messages",w1="gen_ai.output.messages",Hn="gen_ai.system_instructions",rt="gen_ai.response.text",Zr="gen_ai.request.available_tools",Ji="gen_ai.response.streaming",It="gen_ai.response.tool_calls",ky="gen_ai.agent.name",k1="gen_ai.pipeline.name",fp="gen_ai.conversation.id",G1="gen_ai.usage.cache_creation_input_tokens",B1="gen_ai.usage.cache_read_input_tokens",Gy="gen_ai.usage.input_tokens.cache_write",Ls="gen_ai.usage.input_tokens.cached",Rm="gen_ai.invoke_agent",j1="gen_ai.generate_text",H1="gen_ai.stream_text",F1="gen_ai.generate_object",V1="gen_ai.stream_object",Fc="gen_ai.embeddings.input",q1="gen_ai.embeddings",$1="gen_ai.embeddings",Y1="gen_ai.rerank",W1="gen_ai.execute_tool",Zi="gen_ai.tool.name",By="gen_ai.tool.call.id",jy="gen_ai.tool.type",ym="gen_ai.tool.input",Im="gen_ai.tool.output",z1="gen_ai.tool.description",Hy="openai.response.id",Fy="openai.response.model",Vy="openai.response.timestamp",K1="openai.usage.completion_tokens",Q1="openai.usage.prompt_tokens",qy="anthropic.response.timestamp";var mp=new Map,$y=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),Yy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),X1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),J1=new Set(["ai.rerank.doRerank"]),Z1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ds(t){return!t||typeof t!="object"?!1:Pue(t)||tj(t)||Cue(t)||nj(t)||rj(t)||Mue(t)||xue(t)||vue(t)||Lue(t)||Due(t)||Uue(t)||wue(t)}function Cue(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):ej(t):!1}function ej(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function Pue(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ds(t.source)}function tj(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function nj(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function rj(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function Mue(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function xue(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function vue(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function Lue(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function Due(t){return"b64_json"in t}function Uue(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function wue(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var hp="[Blob substitute]",kue=["image_url","data","content","b64_json","result","uri","image"];function ea(t){let e={...t};Ds(e.source)&&(e.source=ea(e.source)),tj(t)&&(e.inlineData={...t.inlineData,data:hp}),ej(t)&&(e.image_url={...t.image_url,url:hp}),nj(t)&&(e.input_audio={...t.input_audio,data:hp}),rj(t)&&(e.file={...t.file,file_data:hp});for(let n of kue)typeof e[n]=="string"&&(e[n]=hp);return e}var sj=2e4,Nm=t=>new TextEncoder().encode(t).length,zy=t=>Nm(JSON.stringify(t));function Om(t,e){if(Nm(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);Nm(i)<=e?(o=i,n=s+1):r=s-1}return o}function Gue(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function oj(t,e){return typeof t=="string"?e:{...t,text:e}}function Bue(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function ij(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function aj(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function jue(t,e){let n={...t,content:""},r=zy(n),o=e-r;if(o<=0)return[];let s=Om(t.content,o);return[{...t,content:s}]}function Hue(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function Fue(t,e){let{key:n,items:r}=Hue(t);if(n===null||r.length===0)return[];let o=r.map(c=>oj(c,"")),s=zy({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=Gue(c),p=Nm(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=Om(l,i);d&&a.push(oj(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function Vue(t,e){if(!t)return[];if(typeof t=="string"){let n=Om(t,e);return n?[n]:[]}return typeof t!="object"?[]:Bue(t)?jue(t,e):ij(t)||aj(t)?Fue(t,e):[]}function Wy(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(ij(n)?r={...n,content:Wy(n.content)}:"content"in n&&Ds(n.content)&&(r={...n,content:ea(n.content)}),aj(n)&&(r={...r??n,parts:Wy(n.parts)}),Ds(r)?r=ea(r):Ds(n)&&(r=ea(n))),r??n})}function que(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=Wy([r]),s=o[0];return zy(s)<=n?o:Vue(s,n)}function Us(t){return que(t,sj)}function cj(t){return Om(t,sj)}function eo(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Vc(t,e){return t?`${t}.${e}`:e}function Tp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[ln]:s})}}function ta(t){if(typeof t=="string")return cj(t);if(Array.isArray(t)){let e=Us(t);return JSON.stringify(e)}return JSON.stringify(t)}function Fn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function $ue(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function qc(t,e,n){return vt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return $ue(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var bm="operation.name",uj="ai.operationId",Cm="ai.prompt",lj="ai.schema",pj="ai.response.object",Ky="ai.values",Qy="ai.response.text",Xy="ai.response.toolCalls",dj="ai.response.finishReason",na="ai.prompt.messages",$c="ai.prompt.tools",Ep="ai.model.id",_j="ai.response.providerMetadata",fj="ai.usage.cachedInputTokens",mj="ai.telemetry.functionId",hj="ai.usage.completionTokens",Tj="ai.usage.promptTokens",Ej="ai.usage.tokens",Jy="ai.toolCall.name",Zy="ai.toolCall.id",gj="ai.toolCall.args",Sj="ai.toolCall.result";function Rj(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function eI(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function Yue(t){let e=new Map;for(let n of t){let r=n.data[Zr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function yj(t,e){let n=Yue(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[Zi];if(typeof o=="string"){let s=n.get(o);s&&(r.data[z1]=s)}}r.op==="gen_ai.invoke_agent"&&eI(r,e)}}function tI(t){return mp.get(t)}function nI(t){mp.delete(t)}function Ij(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function Aj(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function Wue(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...Aj(n)),s;if(Array.isArray(r))return s.push(...Aj(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function Nj(t,e){if(typeof e[Cm]=="string"&&!e[Dt]&&!e[na]){let n=e[Cm],r=Wue(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0,a=ta(s);t.setAttributes({[Cm]:a,[Dt]:a,[pn]:i})}}else if(typeof e[na]=="string")try{let n=JSON.parse(e[na]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=Fn(n);r&&t.setAttribute(Hn,r);let s=Array.isArray(o)?o.length:0,i=ta(o);t.setAttributes({[na]:i,[Dt]:i,[pn]:s})}}catch{}}function Oj(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return Rm;case"ai.generateText.doGenerate":return j1;case"ai.streamText.doStream":return H1;case"ai.generateObject.doGenerate":return F1;case"ai.streamObject.doStream":return V1;case"ai.embed.doEmbed":return q1;case"ai.embedMany.doEmbed":return $1;case"ai.rerank.doRerank":return Y1;case"ai.toolCall":return W1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function zue(t){return $y.has(t)?"invoke_agent":Yy.has(t)?"generate_content":X1.has(t)?"embeddings":J1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function Kue(t){let{data:e,description:n}=Y(t);if(n){if(e[Jy]&&e[Zy]&&n==="ai.toolCall"){ele(t,e);return}!e[uj]&&!n.startsWith("ai.")||tle(t,n,e)}}function Que(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)Zue(r),Rj(r,e);yj(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&eI(n,e)}return t}function Xue(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function Jue(t){let e=t[Qy],n=t[Xy],r=t[dj];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Xy]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:Xue(r)};t[w1]=JSON.stringify([s]),delete t[Qy]}}function Zue(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),Ut(e,hj,Ze),Ut(e,Tj,Pe),Ut(e,fj,Ls),Ut(e,"ai.usage.inputTokens",Pe),Ut(e,"ai.usage.outputTokens",Ze),Ut(e,Ej,Pe),Ut(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Ls]=="number"&&(e[Pe]=e[Pe]+e[Ls]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[ln]=r+e[Pe]}if(e[$c]&&Array.isArray(e[$c])&&(e[$c]=Ij(e[$c])),e[bm]){let r=zue(e[bm]);e[Lt]=r,delete e[bm]}if(Ut(e,na,Dt),Jue(e),Ut(e,pj,"gen_ai.response.object"),Ut(e,$c,"gen_ai.request.available_tools"),Ut(e,gj,ym),Ut(e,Sj,Im),Ut(e,lj,"gen_ai.request.schema"),Ut(e,Ep,He),Array.isArray(e[Ky])){let r=e[Ky].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Fc]=r.length===1?r[0]:JSON.stringify(r)}nle(e);for(let r of Object.keys(e))r.startsWith("ai.")&&Ut(e,r,`vercel.${r}`)}}function Ut(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function ele(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(Lt,"execute_tool"),Ut(e,Jy,Zi),Ut(e,Zy,By);let n=e[By];typeof n=="string"&&mp.set(n,t.spanContext()),e[jy]||t.setAttribute(jy,"function");let r=e[Zi];r&&t.updateName(`execute_tool ${r}`)}function tle(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[mj];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),Nj(t,n),n[Ep]&&!n[_t]&&t.setAttribute(_t,n[Ep]),t.setAttribute("ai.streaming",e.includes("stream"));let s=Oj(e);if(s&&t.setAttribute(ee,s),$y.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[Ep];if(i){let a=Yy.has(e)?"generate_content":Z1[e];a&&t.updateName(`${a} ${i}`)}}function Pm(t){t.on("spanStart",Kue),t.addEventProcessor(Object.assign(Que,{id:"VercelAiEventProcessor"}))}function nle(t){let e=t[_j];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(vr(t,Ls,r.cachedPromptTokens),vr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),vr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),vr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||vr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;vr(t,Ls,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;vr(t,Gy,s)}n.bedrock?.usage&&(vr(t,Ls,n.bedrock.usage.cacheReadInputTokens),vr(t,Gy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(vr(t,Ls,n.deepseek.promptCacheHitTokens),vr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function vr(t,e,n){n!=null&&(t[e]=n)}var ws="OpenAI",bj={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},rle=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Cj=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...rle];function Pj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function Mj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function xj(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function vj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function Lj(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function Dj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function Uj(t,e,n){if(Mm(t,e.id,e.model,e.created),e.usage&&gp(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[yn]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[It]:JSON.stringify(o)})}}}function wj(t,e,n){if(Mm(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[yn]:JSON.stringify([e.status])}),e.usage&&gp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[It]:JSON.stringify(o)})}}}function kj(t,e){t.setAttributes({[Fy]:e.model,[_t]:e.model}),e.usage&&gp(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function Gj(t,e){let{id:n,created_at:r}=e;t.setAttributes({[Hy]:n,[or]:n,[fp]:n}),r&&t.setAttributes({[Vy]:new Date(r*1e3).toISOString()})}function gp(t,e,n,r){e!==void 0&&t.setAttributes({[Q1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[K1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[ln]:r})}function Mm(t,e,n,r){t.setAttributes({[Hy]:e,[or]:e}),t.setAttributes({[Fy]:n,[_t]:n}),t.setAttributes({[Vy]:new Date(r*1e3).toISOString()})}function ole(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function Bj(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ms]=t.temperature),"top_p"in t&&(e[vs]=t.top_p),"frequency_penalty"in t&&(e[xs]=t.frequency_penalty),"presence_penalty"in t&&(e[Hc]=t.presence_penalty),"stream"in t&&(e[Bc]=t.stream),"encoding_format"in t&&(e[L1]=t.encoding_format),"dimensions"in t&&(e[D1]=t.dimensions);let n=ole(t);return n&&(e[fp]=n),e}function sle(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function ile(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&sle(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function ale(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!Cj.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*jj(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)Dj(o)?ile(o,r,n):Lj(o)&&ale(o,r,n,e),yield o}finally{Mm(e,r.responseId,r.responseModel,r.responseTimestamp),gp(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[It]:JSON.stringify(s)}),e.end()}}function cle(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&S.error("Failed to serialize OpenAI tools:",s);return}}function ule(t,e){let n={[Ps]:"openai",[Lt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=cle(r);o&&(n[Zr]=o),Object.assign(n,Bj(r))}else n[He]="unknown";return n}function lle(t,e,n){if(!e||typeof e!="object")return;let r=e;if(Pj(r)){if(Uj(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else Mj(r)?(wj(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):xj(r)?kj(t,r):vj(r)&&Gj(t,r)}function Hj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Fc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=ta(s);t.setAttribute(Dt,i),Array.isArray(s)?t.setAttribute(pn,s.length):t.setAttribute(pn,1)}function ple(t,e,n,r,o){return function(...i){let a=n.operation,c=ule(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let h,T=yt(_,g=>(h=t.apply(r,i),o.recordInputs&&p&&Hj(g,p,a),(async()=>{try{let R=await h;return jj(R,g,o.recordOutputs??!1)}catch(R){throw g.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),g.end(),R}})()));return qc(h,T,"auto.ai.openai")}let f,m=xr(_,h=>(f=t.apply(r,i),o.recordInputs&&p&&Hj(h,p,a),f.then(T=>(lle(h,T,o.recordOutputs),T),T=>{throw te(T,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),T})));return qc(f,m,"auto.ai.openai")}}function Fj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=bj[i];return typeof s=="function"&&a?ple(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Fj(s,i,n):s}})}function xm(t,e){return Fj(t,"",eo(e))}var ks="Anthropic_AI",Vj={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function qj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=Fn(e);n&&t.setAttributes({[Hn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Dt]:ta(r),[pn]:o})}var dle={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function rI(t){return t&&dle[t]||"internal_error"}function $j(t,e){e.error&&(t.setStatus({code:2,message:rI(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Yj(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function _le(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:rI(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function fle(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function mle(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function hle(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function Tle(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function Wj(t,e,n,r){!(t&&typeof t=="object")||_le(t,r)||(fle(t,e),mle(t,e),hle(t,e,n),Tle(t,e))}function Ele(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[or]:t.responseId}),t.responseModel&&e.setAttributes({[_t]:t.responseModel}),Tp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),t.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[It]:JSON.stringify(t.toolCalls)}),e.end())}async function*zj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)Wj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[or]:r.responseId}),r.responseModel&&e.setAttributes({[_t]:r.responseModel}),Tp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[It]:JSON.stringify(r.toolCalls)}),e.end()}}function Kj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{Wj(o,r,n,e)}),t.on("message",()=>{Ele(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function gle(t,e,n){let r={[Ps]:"anthropic",[Lt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Zr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ms]=o.temperature),"top_p"in o&&(r[vs]=o.top_p),"stream"in o&&(r[Bc]=o.stream),"top_k"in o&&(r[Am]=o.top_k),"frequency_penalty"in o&&(r[xs]=o.frequency_penalty),"max_tokens"in o&&(r[jc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function oI(t,e){let n=Yj(e);qj(t,n),"prompt"in e&&t.setAttributes({[v1]:JSON.stringify(e.prompt)})}function Sle(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[It]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function Ale(t,e){"id"in e&&"model"in e&&(t.setAttributes({[or]:e.id,[_t]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[qy]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[qy]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&Tp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function Rle(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){$j(t,e);return}n&&Sle(t,e),Ale(t,e)}}function Qj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function yle(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=yt(_,h=>(f=t.apply(n,r),c.recordInputs&&a&&oI(h,a),(async()=>{try{let T=await f;return zj(T,h,c.recordOutputs??!1)}catch(T){return Qj(T,h,i)}})()));return qc(f,m,"auto.ai.anthropic")}else return yt(_,f=>{try{c.recordInputs&&a&&oI(f,a);let m=e.apply(n,r);return Kj(m,f,c.recordOutputs??!1)}catch(m){return Qj(m,f,i)}})}function Ile(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=gle(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return yle(t,s,r,a,l,c,e,d,o,_,f);let m,h=xr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},T=>(m=s.apply(r,a),o.recordInputs&&d&&oI(T,d),m.then(g=>(Rle(T,g,o.recordOutputs),g),g=>{throw te(g,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),g})));return qc(m,h,"auto.ai.anthropic")}})}function Xj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=Vj[i];return typeof s=="function"&&a?Ile(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Xj(s,i,n):s}})}function vm(t,e){return Xj(t,"",eo(e))}var Gs="Google_GenAI",Jj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},Zj="google_genai",sI="chats.create",eH="chat";function Nle(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function Ole(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function ble(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function Cle(t,e,n,r){!t||Nle(t,r)||(Ole(t,e),ble(t,e,n))}async function*tH(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)Cle(o,r,n,e),yield o}finally{let o={[Ji]:!0};r.responseId&&(o[or]=r.responseId),r.responseModel&&(o[_t]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[ln]=r.totalTokens),r.finishReasons.length&&(o[yn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[It]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function Yc(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>Yc(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function nH(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function Ple(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ms]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[vs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[Am]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[jc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[xs]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[Hc]=t.presencePenalty),e}function Mle(t,e,n){let r={[Ps]:Zj,[Lt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=nH(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,Ple(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Zr]=JSON.stringify(s)}}}else r[He]=nH({},n);return r}function rH(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Fc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...Yc(e.config.systemInstruction,"system")),"history"in e&&r.push(...Yc(e.history,"user")),"contents"in e&&r.push(...Yc(e.contents,"user")),"message"in e&&r.push(...Yc(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[pn]:i,[Dt]:JSON.stringify(Us(s))})}}function xle(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(_t,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[ln]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[It]:JSON.stringify(r)})}}}function oH(t,e,n,r,o){let s=e===sI,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=Mle(p,d,r),f=_[He]??"unknown";return n.streaming?yt({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&rH(m,d,i);let h=await a.apply(r,l);return tH(h,m,!!o.recordOutputs)}catch(h){throw m.setStatus({code:2,message:"internal_error"}),te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),h}}):xr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&rH(m,d,i),Mr(()=>a.apply(r,l),h=>{te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},h=>{!s&&!i&&xle(m,h,o.recordOutputs)})))}})}function iI(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Vc(e,String(o)),c=Jj[a];if(typeof i=="function"&&c){if(a===sI){let l=oH(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?iI(_,eH,n):_}}return oH(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?iI(i,a,n):i}})}function Lm(t,e){return iI(t,"",eo(e))}var Dm="LangChain",ra="auto.ai.langchain",sH={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var sr=(t,e,n)=>{n!=null&&(t[e]=n)},Vn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Go(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Wc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ds(n)?ea(n):n);return JSON.stringify(e)}catch{return String(t)}return Go(t)}function Sp(t){let e=t.toLowerCase();return sH[e]??e}function iH(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function aI(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function Ap(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:Sp(o),content:Wc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?iH(s):"user";return{role:Sp(i),content:Wc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:Sp(o),content:Wc(e.content)}}if(e.role)return{role:Sp(String(e.role)),content:Wc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:Sp(iH(r)),content:Wc(e.content)}:{role:"user",content:Wc(e.content)}})}function vle(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Vn(r,Ms,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Vn(r,jc,i);let a=e?.top_p??o?.top_p;Vn(r,vs,a);let c=e?.frequency_penalty;Vn(r,xs,c);let l=e?.presence_penalty;return Vn(r,Hc,l),e&&"stream"in e&&sr(r,Bc,!!e.stream),r}function aH(t,e,n,r,o){return{[Ps]:Go(t??"langchain"),[Lt]:"chat",[He]:Go(e),[W]:ra,...vle(n,r,o)}}function cH(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=aH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){sr(a,pn,e.length);let c=e.map(l=>({role:"user",content:l}));sr(a,Dt,Go(c))}return a}function uH(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=aH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=Ap(e.flat()),{systemInstructions:l,filteredMessages:p}=Fn(c);l&&sr(a,Hn,l);let d=Array.isArray(p)?p.length:0;sr(a,pn,d);let _=Us(p);sr(a,Dt,Go(_))}return a}function Lle(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&sr(e,It,Go(n))}function Dle(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Vn(e,Pe,n.promptTokens),Vn(e,Ze,n.completionTokens),Vn(e,ln,n.totalTokens);else if(r){Vn(e,Pe,r.input_tokens),Vn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Vn(e,ln,i),r.cache_creation_input_tokens!==void 0&&Vn(e,G1,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Vn(e,B1,r.cache_read_input_tokens)}}function lH(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&sr(n,yn,Go(l)),Lle(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&sr(n,rt,Go(p))}}Dle(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&sr(n,_t,i);let a=r?.id??s?.id;a&&sr(n,or,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&sr(n,U1,Go(c)),n}function Um(t={}){let{recordInputs:e,recordOutputs:n}=eo(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(i,a,c,l,p,d,_,f){let m=aI(d),h=cH(i,a,e,m,_),T=h[He],g=h[Lt];yt({name:`${g} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=aI(d),h=uH(i,a,e,m,_),T=h[He],g=h[Lt];yt({name:`${g} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=lH(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",h={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(h["langchain.chain.inputs"]=JSON.stringify(a)),yt({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...h,[ee]:"gen_ai.invoke_agent"}},T=>(r.set(c,T),T))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:ra,[Zi]:p};e&&(d[ym]=a),yt({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[Im]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.tool_error_handler`}})},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}var wm="LangGraph",cI="auto.ai.langgraph";function Ule(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function wle(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function kle(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(_t,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(yn,[r.finish_reason])}}function pH(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function dH(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=Ule(i);a&&t.setAttribute(It,JSON.stringify(a));let c=Ap(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=wle(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,kle(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(ln,d)}function uI(t,e){return new Proxy(t,{apply(n,r,o){return xr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:cI,[ee]:"gen_ai.create_agent",[Lt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(ky,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=Gle(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function Gle(t,e,n,r){return new Proxy(t,{apply(o,s,i){return xr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:cI,[ee]:Rm,[Lt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(k1,c),a.setAttribute(ky,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(fp,d);let _=pH(e);_&&a.setAttribute(Zr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,h=i.length>0?i[0]?.messages??[]:[];if(h&&f){let g=Ap(h),{systemInstructions:R,filteredMessages:I}=Fn(g);R&&a.setAttribute(Hn,R);let x=Us(I),F=Array.isArray(I)?I.length:0;a.setAttributes({[Dt]:JSON.stringify(x),[pn]:F})}let T=await Reflect.apply(o,s,i);return m&&dH(a,h??null,T),T}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function km(t,e){return t.compile=uI(t.compile,eo(e)),t}function Rp(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function yp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function fH(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function mH(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){a=l.slice(0,h),c=l.slice(h+1);let T=a.indexOf(".Module");T>0&&(l=l.slice(T+1),a=a.slice(0,T))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||Lf,l=p?`${p}.${d}`:d);let _=LG(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?Ble(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:_H(i[3]),colno:_H(i[4]),in_app:fH(_||"",f)}}if(o.match(e))return{filename:o}}}function lI(t){return[90,mH(t)]}function _H(t){return parseInt(t||"",10)||void 0}function Ble(t){try{return decodeURI(t)}catch{return}}var In=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var pI=K(ne(),1),Ip={};function w(t,e,n){return n?cpe(t,e,n):ape(t,e)}function ape(t,e){return Object.assign(n=>{let r=Ip[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return Ip[t]=o,(0,pI.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function cpe(t,e,n){return Object.assign(r=>{let o=n(r),s=Ip[t];if(s)return s.setConfig(o),s;let i=new e(o);return Ip[t]=i,(0,pI.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Np(t){let e=!1,n=[];if(!upe(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function upe(t){return typeof t._wrap=="function"}b();import{subscribe as lpe}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Gm="@sentry/instrumentation-http";function hH(t,e,n,r){let o=0,s=[];re&&S.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&S.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(h,T,g)=>{try{let R=g[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&S.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&S.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,T,g)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&S.error(r,"Error building captured request body",c)}})}catch(c){re&&S.error(r,"Error patching request to capture body",c)}}var TH=Un("sentry_http_server_instrumented"),_I="Http.Server",dI=new Map,EH=new WeakSet;function gH(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var ppe=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:_I,setupOnce(){lpe("http.server.request.start",r=>{dpe(r.server,e)})},afterAllSetup(n){re&&n.getIntegrationByName("Http")&&S.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}},Op=ppe;function dpe(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(EH.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(TH)||!p)return a.apply(c,l);re&&S.log(_I,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=_p(_),h=_.ip||_.socket?.remoteAddress,T=_.url||"/";n!=="none"&&!e?.(T,_)&&hH(_,d,n,_I),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:h});let g=(_.method||"GET").toUpperCase(),R=ko(T),I=`${g} ${R}`;return d.setTransactionName(I),r&&p&&_pe(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),zl(d,()=>{let x={traceId:Wt(),sampleRand:Rt(),propagationSpanId:zt()};he().setPropagationContext({...x}),d.setPropagationContext({...x});let F=Ar.extract(P.active(),m.headers).setValue(TH,!0);return P.with(F,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});EH.add(i),t.emit=i}function _pe(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&S.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=dI.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&S.log("Opened new request session aggregate.");let l={[i]:c};dI.set(t,l);let p=()=>{clearTimeout(_),d(),dI.delete(t);let f=Object.entries(l).map(([m,h])=>({started:m,exited:h.exited,errored:h.errored,crashed:h.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&S.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&S.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var Bo=K(Te(),1);le();import{errorMonitor as fpe}from"node:events";var SH="Http.ServerSpans",mpe=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:SH,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;gH(_,h=>{if(Epe(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&S.log(SH,"Skipping span creation for incoming request",_.url),h();let T=d.url||_.url||"/",g=dp(T),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],F=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,on=T.startsWith("https")?"https":"http",Io=d.method||_.method?.toUpperCase()||"GET",ss=g?g.pathname:ko(T),Ii=`${Io} ${ss}`,Tt=ve.startSpan(Ii,{kind:Oe.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":hpe(_)||void 0,"http.url":T,"http.method":d.method,"http.target":g?`${g.pathname}${g.search}`:ss,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":on,"http.flavor":F,"net.transport":F?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...gpe(_),..._m(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(Tt,_),i?.(Tt,f),a?.(Tt,_,f),o?.(Tt,_,f);let Ya={type:Bo.RPCType.HTTP,span:Tt};return P.with((0,Bo.setRPCMetadata)(X.setSpan(P.active(),Tt),Ya),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Wa=!1;function kC(i_){if(Wa)return;Wa=!0;let GC=Rpe(_,f);Tt.setAttributes(GC),Tt.setStatus(i_),Tt.end();let BC=GC["http.route"];BC&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${BC}`)}return f.on("close",()=>{kC(Do(f.statusCode))}),f.on(fpe,()=>{let i_=Do(f.statusCode);kC(i_.code===2?i_:{code:2})}),h()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&ype(l,r))return re&&S.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&S.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||S.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},bp=mpe;function hpe(t){return t.headers["next-router-prefetch"]==="1"}function Tpe(t){let e=ko(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function Epe(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,Bo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&Tpe(r)||n?.(r,t))}function gpe(t){let e=Spe(t.headers);return e==null?{}:Ape(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function Spe(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function Ape(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function Rpe(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[bo]:r,[Mi]:r,"http.status_text":o?.toUpperCase()},i=(0,Bo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[tA]=a,s[nA]=c,s[eA]=l,s["net.peer.port"]=p}if(s[Mi]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===Bo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[Co]=a}return s}function ype(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var IH=K(Te(),1),Pp=K(ne(),1);le();import{subscribe as fI,unsubscribe as mI}from"node:diagnostics_channel";import{errorMonitor as yH}from"node:events";function Cp(t,e){if(!t)return e;let n=qi(t),r=qi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(Xr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(Xr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return Ff(a)}var zc="@sentry/instrumentation-http";function AH(t,e){let n=Ipe(t),r=e?.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Bm(t,e){let n=jm(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&S.log(zc,"Added sentry-trace header to outgoing request")}catch(p){re&&S.error(zc,"Failed to add sentry-trace header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&S.log(zc,"Added traceparent header to outgoing request")}catch(p){re&&S.error(zc,"Failed to add traceparent header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=Cp(p,a);if(d)try{t.setHeader("baggage",d),re&&S.log(zc,"Added baggage header to outgoing request")}catch(_){re&&S.error(zc,"Failed to add baggage header to outgoing request:",Kr(_)?_.message:"Unknown error")}}}}function Ipe(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=bs(n.toString()),o={url:Cs(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function RH(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function jm(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var oa=class extends Pp.InstrumentationBase{constructor(e={}){super(Gm,pe,e),this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,fI("http.client.response.finish",n),fI("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&fI("http.client.request.created",o)),a),i=()=>{mI("http.client.response.finish",n),mI("http.client.request.error",r),mI("http.client.request.created",o)};return[new Pp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new Pp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=Npe(e),s=em({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=Ope(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:Do(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(yH,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(yH,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&S.log(Gm,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&AH(e,n)}_onOutgoingRequestCreated(e){re&&S.log(Gm,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{Bm(e,this._propagationDecisionMap)})}else o&&Bm(e,this._propagationDecisionMap)}else o&&Bm(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,IH.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=RH(e),o=jm(e);return n(o,r)}};function Npe(t){let e=jm(t),[n,r]=by(dp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[IA]:o,[cs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function Ope(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[bo]:e,[EA]:r,"http.flavor":r,[gA]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...bpe(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[hA]=a,i[TA]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function bpe(t){let e=Cpe(t.headers);return e==null?{}:Ppe(t.headers)?{[oA]:e}:{[sA]:e}}function Cpe(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function Ppe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var NH="Http",Mpe=w(`${NH}.sentry`,t=>new oa(t)),OH=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=Op(e),s=bp(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:NH,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),Mpe(r)},processEvent(l){return s.processEvent(l)}}};b();var PH=K(Te(),1),MH=K(ne(),1);import*as Kc from"diagnostics_channel";var Lr=HR(process.versions.node),jo=Lr.major,Mp=Lr.minor;var hI="sentry-trace",Hm="baggage",xpe="traceparent";function bH(t,e){let n=Fm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:vpe(t.headers);if(TI(l,hI),TI(l,Hm),o&&TI(l,xpe),!(EI(l,hI)!==-1)){i&&l.push(hI,i),c&&EI(l,"traceparent")===-1&&l.push("traceparent",c);let d=EI(l,Hm);if(a&&d===-1)l.push(Hm,a);else if(a){let _=l[d+1],f=Cp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=Lpe(l))}function vpe(t){let e=t.split(`\r
|
|
29
|
+
`),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{S.warn(`Failed to convert string request header to array header: ${r}`)}return n}function Lpe(t){let e=[];for(let n=0;n<t.length;n+=2){let r=t[n],o=t[n+1];!r||o==null||e.push(`${r}: ${o}`)}return e.length?e.join(`\r
|
|
30
30
|
`).concat(`\r
|
|
31
|
-
`):""}function mI(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Bm&&o){let s=Cp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function hI(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function OH(t,e){let n=vpe(t),r=e.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function vpe(t){try{let e=jm(t.origin,t.path),n=bs(e),r={url:Cs(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function jm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var sa=class extends bH.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&IH(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&OH(e,n)}_subscribeToChannel(e,n){let r=jo>18||jo===18&&Mp>=19,o;if(r)Kc.subscribe?.(e,n),o=()=>Kc.unsubscribe?.(e,n);else{let s=Kc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,NH.isTracingSuppressed)(P.active()))return!0;let n=jm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var Lpe="NodeFetch",Dpe=w(`${Lpe}.sentry`,sa,t=>t),Upe=(t={})=>({name:"NodeFetch",setupOnce(){Dpe(t)}}),CH=Upe;var lV=K(xH(),1);le();b();b();var dn=K(Te(),1),Bs=K(iO(),1),mO="sentry.parentIsRemote",cu="sentry.graphql.operation";function hO(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function TO(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function y_e(t){return typeof t.kind=="number"}function I_e(t){return!!t.status}function DF(t){return!!t.name}function O_e(t){if(!TO(t))return{};let e=t.attributes[cs]||t.attributes[ec],n={url:e,"http.method":t.attributes[vi]||t.attributes[Cl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=bs(e);n.url=Cs(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function N_e(t){return y_e(t)?t.kind:Ne.INTERNAL}var wh="sentry-trace",aO="baggage",EO="sentry.dsc",SO="sentry.sampled_not_recording",UF="sentry.url",b_e="sentry.sample_rand",C_e="sentry.sample_rate",gO=Un("sentry_scopes"),cO=Un("sentry_fork_isolation_scope"),uO=Un("sentry_fork_set_scope"),lO=Un("sentry_fork_set_isolation_scope"),wF="_scopeContext";function uu(t){return t.getValue(gO)}function kF(t,e){return t.setValue(gO,e)}function P_e(t,e){nt(t,wF,e)}function Bp(t){return t[wF]}function au(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(SO)==="1":!1;if(e===Vt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(EO):void 0,s=o?Uo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function GF(t,e,n){let r=e[vi]||e[Cl];if(r)return x_e({attributes:e,name:t,kind:n},r);let o=e[xi]||e[Kg],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return M_e({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[iA])return{...Gp(t,e,"route"),op:"rpc"};if(e[sA])return{...Gp(t,e,i),op:"message"};let l=e[Xg];return l?{...Gp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function BF(t){let e=TO(t)?t.attributes:{},n=DF(t)?t.name:"<unknown>",r=N_e(t);return GF(n,e,r)}function M_e({attributes:t,name:e}){let n=t[tr];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Qg];return{op:"db",description:r?r.toString():e,source:"task"}}function x_e({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Ne.CLIENT:o.push("client");break;case Ne.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=L_e(n,e);if(!s)return{...Gp(t,n),op:o.join(".")};let p=n[cu],d=`${r} ${s}`,_=p?`${d} (${v_e(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let h=e===Ne.CLIENT||e===Ne.SERVER,S=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[tr],x=!R&&I==null&&(h||!S),{description:F,source:B}=x?{description:_,source:f}:Gp(t,n);return{op:o.join("."),description:F,source:B,data:m}}function v_e(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}function L_e(t,e){let n=t[tA],r=t[ec]||t[cs],o=t[Co],s=typeof r=="string"?bs(r):void 0,i=s?Cs(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Ne.SERVER&&typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function Gp(t,e,n="custom"){let r=e[Ue]||n,o=e[tr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function jF(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=DF(n)?BF(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=au(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function HF(){return X.getActiveSpan()}var js=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function FF({dsc:t,sampled:e}){let n=t?Vi(t):void 0,r=new dn.TraceState,o=n?r.set(EO,n):r;return e===!1?o.set(SO,"1"):o}var VF=new Set;function qF(){return Array.from(VF)}function jh(t){VF.add(t)}var kh=class extends dn.W3CBaggagePropagator{constructor(){super(),jh("SentryPropagator"),this._urlMatchesTargetsMap=new In(100)}inject(e,n,r){if((0,dn.isTracingSuppressed)(e)){js&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&k_e(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Xi(s,i,this._urlMatchesTargetsMap)){js&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=U_e(n),l=w_e(n),p=Ar.getBaggage(e)||Ar.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=$F(e);if(c){let h=qi(c);h&&Object.entries(h).forEach(([T,S])=>{!l&&T.startsWith(Xr)||(p=p.setEntry(T,{value:S}))})}!l&&d&&(p=Object.entries(d).reduce((h,[T,S])=>S?h.setEntry(`${Xr}${T}`,{value:S}):h,p)),!l&&_&&_!==bi&&(r.set(n,wh,Rs(_,f,m)),a&&r.set(n,"traceparent",ys(_,f,m))),super.inject(Ar.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,wh),s=r.get(n,aO),i=o?Array.isArray(o)?o[0]:o:void 0;return WF(YF(e,{sentryTrace:i,baggage:s}))}fields(){return[wh,aO,"traceparent"]}};function $F(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:au(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:au(a)}}let r=e.scope||uu(t)?.scope||he(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Jr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function YF(t,{sentryTrace:e,baggage:n}){let r=Ql(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=Uo(n);if(!s||c&&!JR(c,l?.org_id))return t;let p=G_e({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function D_e(t,e,n){let r=WF(YF(t,e));return P.with(r,n)}function WF(t){let e=uu(t),n={scope:e?e.scope:he().clone(),isolationScope:e?e.isolationScope:ue()};return kF(t,n)}function U_e(t){try{let e=t[aO];return Array.isArray(e)?e.join(","):e}catch{return}}function w_e(t){try{return t[wh]}catch{return}}function k_e(t){let e=Y(t).data,n=e[ec]||e[cs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(UF);if(r)return r}function G_e({spanId:t,traceId:e,sampled:n,dsc:r}){let o=FF({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Vt.SAMPLED:Vt.NONE,traceState:o}}function zF(t,e,n){let r=QF(),{name:o,parentSpan:s}=t;return tV(s)(()=>{let a=ZF(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,dn.suppressTracing)(a):a,p=XF(t);if(!Xe()){let d=(0,dn.isTracingSuppressed)(l)?l:(0,dn.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(pO(_),P.with(a,()=>Mr(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(pO(d),Mr(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function B_e(t,e){return zF(t,e,!0)}function j_e(t,e){return zF(t,n=>e(n,()=>n.end()),!1)}function H_e(t){let e=QF(),{name:n,parentSpan:r}=t;return tV(r)(()=>{let s=ZF(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,dn.suppressTracing)(s):s,c=XF(t);Xe()||(a=(0,dn.isTracingSuppressed)(a)?a:(0,dn.suppressTracing)(a));let l=e.startSpan(n,c,a);return pO(l),l})}function KF(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(he()))}function QF(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function XF(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?JF(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function JF(t){return t<9999999999?t*1e3:t}function pO(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?JF(n):n)}function ZF(t,e){let n=F_e(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=au(r.spanContext()),c=je(r),l=Je(c),p=FF({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Vt.SAMPLED:Vt.NONE,traceState:p};return X.setSpanContext(o,d)}function F_e(t){if(t){let e=Bp(t);if(e)return e}return P.active()}function V_e(t,e){return D_e(P.active(),t,e)}function q_e(t){let e=zt(),n=Kt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Vt.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(he().setPropagationContext({traceId:e,sampleRand:yt()}),t()))}function eV(t,e){let n=Bp(e),r=n&&X.getSpan(n),o=r?Is(r):Fi(e);return[r?Je(r):Jr(t,e),o]}function tV(t){return t!==void 0?e=>KF(t,e):e=>e()}function $_e(t){let e=(0,dn.suppressTracing)(P.active());return P.with(e,t)}function nV(t){t.on("preprocessEvent",e=>{let n=HF();if(!n||e.type==="transaction")return;e.contexts={trace:Is(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function Y_e({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Bp(e))??P.active();if(t){let{scope:p}=br(t);o=p&&Bp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=$F(o,{scope:e,client:n}),l={"sentry-trace":Rs(s,i,a),baggage:Vi(c)};return r&&(l.traceparent=ys(s,i,a)),l}function rV(){function t(){let a=P.active(),c=uu(a);return c||{scope:Ic(),isolationScope:er()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Bp(a)||P.active();return P.with(l.setValue(uO,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(cO,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(lO,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}FR({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:B_e,startSpanManual:j_e,startInactiveSpan:H_e,getActiveSpan:HF,suppressTracing:$_e,getTraceData:Y_e,continueTrace:V_e,startNewTrace:q_e,withActiveSpan:KF})}function oV(t){class e extends t{constructor(...r){super(...r),jh("SentryContextManager")}with(r,o,s,...i){let a=uu(r),c=a?.scope||he(),l=a?.isolationScope||ue(),p=r.getValue(cO)===!0,d=r.getValue(uO),_=r.getValue(lO),f=d||c.clone(),m=_||(p?l.clone():l),S=kF(r,{scope:f,isolationScope:m}).deleteValue(cO).deleteValue(uO).deleteValue(lO);return P_e(f,S),super.with(S,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:gO}}}return e}function W_e(t){let e=new Map;for(let n of t)z_e(e,n);return Array.from(e,function([n,r]){return r})}function sV(t){return t.attributes[mO]===!0?void 0:hO(t)}function z_e(t,e){let n=e.spanContext().spanId,r=sV(e);if(!r){dO(t,{id:n,span:e,children:[]});return}let o=K_e(t,r),s=dO(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function K_e(t,e){let n=t.get(e);return n||dO(t,{id:e,children:[]})}function dO(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var iV={1:"cancelled",2:"unknown_error",3:"invalid_argument",4:"deadline_exceeded",5:"not_found",6:"already_exists",7:"permission_denied",8:"resource_exhausted",9:"failed_precondition",10:"aborted",11:"out_of_range",12:"unimplemented",13:"internal_error",14:"unavailable",15:"data_loss",16:"unauthenticated"},Q_e=t=>Object.values(iV).includes(t);function aV(t){let e=TO(t)?t.attributes:{},n=I_e(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=xF(e);if(o)return o}return n.message&&Q_e(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=xF(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function xF(t){let e=t[bo]||t[Mi],n=t[aA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return Do(r);if(typeof n=="string")return{code:2,message:iV[n]||"unknown_error"}}var vF=1e3,LF=300,_O=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||LF,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Zn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Ny(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Zn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&js&&g.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=sV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;js&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Zn()+LF*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=W_e(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=J_e(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)fO(p,c,r);a.spans=c.length>vF?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,vF):c;let l=Wi(i.events);l&&(a.measurements=l),tm(a)}return r}_flushSentSpanCache(){let e=Zn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function X_e(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function J_e(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=cV(t),i=br(t),a=t.attributes[Nr],c={[Ue]:s,[Nr]:a,[ee]:e,[W]:o,...r,...uV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=hO(t),f=aV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:Yi(f),links:$i(l)},h=c[bo],T=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Rn(t.startTime),timestamp:Rn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function fO(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{fO(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=hO(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:h="manual"}=cV(r),T={[W]:h,[ee]:_,...uV(c),...m},S=aV(r),R={span_id:s,trace_id:i,data:T,description:f,parent_span_id:a,start_timestamp:Rn(l),timestamp:Rn(p)||void 0,status:Yi(S),op:_,origin:h,measurements:Wi(r.events),links:$i(d)};e.push(R),t.children.forEach(I=>{fO(I,e,n)})}function cV(t){let{op:e,source:n,origin:r}=X_e(t),{op:o,description:s,source:i,data:a}=BF(t),c=e||o,l=n||i,p={...a,...Z_e(t)};return{op:c,description:s,source:l,origin:r,data:p}}function uV(t){let e={...t};return delete e[Nr],delete e[mO],delete e[tr],e}function Z_e(t){let e=t.attributes,n={};t.kind!==Ne.INTERNAL&&(n["otel.kind"]=Ne[t.kind]);let r=e[Mi];r&&(n[bo]=r);let o=O_e(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function efe(t,e){let n=X.getSpan(e),r=uu(e);n&&!n.spanContext().isRemote&&Cc(n,t),n?.spanContext().isRemote&&t.setAttribute(mO,!0),e===za&&(r={scope:Ic(),isolationScope:er()}),r&&Kl(t,r.scope,r.isolationScope),np(t),H()?.emit("spanStart",t)}function tfe(t){rp(t),H()?.emit("spanEnd",t)}var Gh=class{constructor(e){jh("SentrySpanProcessor"),this._exporter=new _O(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){efe(e,n)}onEnd(e){tfe(e),this._exporter.export(e)}},Bh=class{constructor(e){this._client=e,jh("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=ofe(e),l=c?.spanContext();if(!Xe(a))return iu({decision:void 0,context:e,spanAttributes:s});let p=s[Cl]||s[vi];if(o===Ne.CLIENT&&p&&(!c||l?.isRemote))return iu({decision:void 0,context:e,spanAttributes:s});let d=c?nfe(c,n,r):void 0;if(!(!c||l?.isRemote))return iu({decision:d?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:h}=GF(r,s,o),T={...m,...s};h&&(T[ee]=h);let S={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:f,parentSampled:d,parentContext:l},S),!S.decision)return iu({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=uu(e)??{},I=l?.traceState?l.traceState.get(EO):void 0,x=I?Uo(I):void 0,F=jn(x?.sample_rand)??yt(),[B,se,ve]=op(a,{name:f,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:jn(x?.sample_rate)},F),on=`${p}`.toUpperCase();return on==="OPTIONS"||on==="HEAD"?(js&&g.log(`[Tracing] Not sampling span because HTTP method is '${on}' for ${r}`),iu({decision:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(js&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...iu({decision:B?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[Nr]:ve?se:void 0}})}toString(){return"SentrySampler"}};function nfe(t,e,n){let r=t.spanContext();if(No(r)&&r.traceId===e){if(r.isRemote){let s=au(t.spanContext());return js&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=au(r);return js&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function iu({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=rfe(e,n);return o!==void 0&&(s=s.set(C_e,`${o}`)),r!==void 0&&(s=s.set(b_e,`${r}`)),t==null?{decision:Bs.SamplingDecision.NOT_RECORD,traceState:s}:t===Bs.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(SO,"1")}:{decision:t,traceState:s}}function rfe(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new dn.TraceState,s=e[ec]||e[cs];return s&&typeof s=="string"&&(o=o.set(UF,s)),o}function ofe(t){let e=X.getSpan(t);return e&&No(e.spanContext())?e:void 0}var AO=oV(lV.AsyncLocalStorageContextManager);b();function RO(){wn.disable(),wn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},dt.DEBUG)}import*as yO from"node:diagnostics_channel";var sfe="ChildProcess",pV=(t={})=>({name:sfe,setup(){yO.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&ife(e.process,t)}),yO.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&afe(e.worker,t)})}});function ife(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&rr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,rr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function afe(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as cfe}from"node:child_process";import{readFile as ufe,readdir as lfe}from"node:fs";import*as bt from"node:os";import{join as pfe}from"node:path";import{promisify as _V}from"node:util";var dfe=_V(ufe),_fe=_V(lfe),ffe="Context",mfe=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=hfe(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await Tfe()),n.app&&(s.app=Sfe()),n.device&&(s.device=gfe(n.device)),n.culture){let i=Efe();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Nfe()),s}return{name:ffe,processEvent(s){return r(s)}}},fV=mfe;function hfe(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=bt.freemem()),t}async function Tfe(){let t=bt.platform();switch(t){case"darwin":return Ife();case"linux":return Ofe();default:return{name:Afe[t]||t,version:bt.release()}}}function Efe(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function Sfe(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function gfe(t){let e={},n;try{n=bt.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=bt.arch(),(t===!0||t.memory)&&(e.memory_size=bt.totalmem(),e.free_memory=bt.freemem()),t===!0||t.cpu){let r=bt.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var Afe={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},Rfe=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],yfe={alpine:t=>t,arch:t=>ao(/distrib_release=(.*)/,t),centos:t=>ao(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>ao(/release (..)/,t),mint:t=>ao(/distrib_release=(.*)/,t),red:t=>ao(/release ([^ ]+)/,t),suse:t=>ao(/VERSION = (.*)\n/,t),ubuntu:t=>ao(/distrib_release=(.*)/,t)};function ao(t,e){let n=t.exec(e);return n?n[1]:void 0}async function Ife(){let t={kernel_version:bt.release(),name:"Mac OS X",version:`10.${Number(bt.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{cfe("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=ao(/^ProductName:\s+(.*)$/m,e),t.version=ao(/^ProductVersion:\s+(.*)$/m,e),t.build=ao(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function dV(t){return t.split(" ")[0].toLowerCase()}async function Ofe(){let t={kernel_version:bt.release(),name:"Linux"};try{let e=await _fe("/etc"),n=Rfe.find(a=>e.includes(a.name));if(!n)return t;let r=pfe("/etc",n.name),o=(await dfe(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(dV(a))>=0)||s[0];let i=dV(t.name);t.version=yfe[i]?.(o)}catch{}return t}function Nfe(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as bfe}from"node:fs";import{createInterface as Cfe}from"node:readline";var IO=new In(10),TV=new In(20),Pfe=7,Mfe="ContextLines",xfe=1e3,vfe=1e4;function Lfe(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function Dfe(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function Ufe(t){return t.lineno!==void 0&&t.lineno>vfe||t.colno!==void 0&&t.colno>xfe}function wfe(t,e){let n=IO.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function kfe(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=hV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=hV(i,e)),n++}return s}function Gfe(t,e,n){return new Promise((r,o)=>{let s=bfe(t),i=Cfe({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){TV.set(t,1),re&&g.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=DR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let h=e[l];if(h===void 0){i.close(),i.removeAllListeners();return}d=h[0],_=h[1]}})})}async function Bfe(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||Dfe(c)||Ufe(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(TV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=kfe(i,e);if(a.every(l=>wfe(s,l)))continue;let c=Lfe(IO,s,{});o.push(Gfe(s,a,c))}if(await Promise.all(o).catch(()=>{re&&g.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&jfe(s.stacktrace.frames,e,IO);return t}function jfe(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;Hfe(r.lineno,r,e,o)}}function mV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Hfe(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&g.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=EV(t,n);s<t;s++){let i=r[s];if(i===void 0){mV(e),re&&g.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){mV(e),re&&g.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=SV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function EV(t,e){return Math.max(1,t-e)}function SV(t,e){return t+e}function hV(t,e){return[EV(t,e),SV(t,e)]}var Ffe=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Pfe;return{name:Mfe,processEvent(n){return Bfe(n,e)}}},gV=Ffe;import{Worker as Vfe}from"node:worker_threads";var Hh;async function Fh(){if(Hh===void 0)try{Hh=!!(await import("node:inspector")).url()}catch{Hh=!1}return Hh}var jp="__SENTRY_ERROR_LOCAL_VARIABLES__";function RV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function AV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function Vh(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||AV(t)&&AV(e)}var qfe="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function yV(...t){g.log("[LocalVariables]",...t)}var IV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!Vh(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&jp in i.originalException&&Array.isArray(i.originalException[jp])){for(let a of s.exception?.values||[])e(a,i.originalException[jp]);i.originalException[jp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new Vfe(new URL(`data:application/javascript;base64,${qfe}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{yV("Worker error",a)}),i.once("exit",a=>{yV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await Fh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:g.isEnabled()};r().then(()=>{try{o(a)}catch(c){g.error("Failed to start worker",c)}},c=>{g.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function OV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function $fe(t,e){if(e!==void 0)return OV(t(e,1))}function NV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var OO=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=NV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},Yfe="LocalVariables",Wfe=(t={},e)=>{let n=new In(20),r,o=!1;function s(l){let p=OV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,h=d[f],T=_[m];if(!T||!h)break;h.vars===void 0||T.in_app===!1&&t.includeOutOfAppFrames!==!0||!Vh(T.function,h.function)||(T.vars=h.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(jo<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Fh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await OO.create(e),f=(h,{params:{reason:T,data:S,callFrames:R}},I)=>{if(T!=="exception"&&T!=="promiseRejection"){I();return}r?.();let x=$fe(h,S.description);if(x==null){I();return}let{add:F,next:B}=NV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:on,this:Io}=R[se],ss=ve.find(Et=>Et.type==="local"),Ii=Io.className==="global"||!Io.className?on:`${Io.className}.${on}`;if(ss?.object.objectId===void 0)F(Et=>{Et[se]={function:Ii},B(Et)});else{let Et=ss.object.objectId;F(Ya=>_.getLocalVariables(Et,Wa=>{Ya[se]={function:Ii,vars:Wa},B(Ya)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((h,T)=>f(p.stackParser,h,T),m),m){let h=t.maxExceptionsPerSecond||50;r=RV(h,()=>{g.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},T=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${T} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){g.log("The `LocalVariables` integration failed to start.",_)}}return{name:Yfe,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},bV=Wfe;var CV=(t={})=>Lr.major<19?bV(t):IV(t);import{existsSync as zfe,readFileSync as vV}from"node:fs";import{dirname as Kfe,join as LV}from"node:path";function Hp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var PV;function MV(){return Hp()?!1:jo>=21||jo===20&&Mp>=6||jo===18&&Mp>=19?!0:(PV||(PV=!0,Qe(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}var NO,Qfe="Modules",Xfe=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,Jfe=()=>({name:Qfe,processEvent(t){return t.modules={...t.modules,...xV()},t},getModules:xV}),DV=Jfe;function Zfe(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function eme(){return{...Xfe,...rme(),...Hp()?tme():{}}}function tme(){let t=U.main?.paths||[],e=Zfe(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=Kfe(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=LV(a,"package.json");if(r.add(a),!zfe(c))return i();try{let l=JSON.parse(vV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function xV(){return NO||(NO=eme()),NO}function nme(){try{let t=LV(process.cwd(),"package.json");return JSON.parse(vV(t,"utf8"))}catch{return{}}}function rme(){let t=nme();return{...t.dependencies,...t.devDependencies}}import{isMainThread as sme}from"worker_threads";var ome=2e3;function Fp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:ome;e.close(r).then(o=>{o||re&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&g.error(o)})}var ime="OnUncaughtException",UV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:ime,setup(n){sme&&global.process.on("uncaughtException",ame(n,e))}}};function ame(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Fp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Fp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var cme="OnUnhandledRejection",ume=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],lme=(t={})=>{let e={mode:t.mode??"warn",ignore:[...ume,...t.ignore??[]]};return{name:cme,setup(n){global.process.on("unhandledRejection",fme(n,e))}}},wV=lme;function pme(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function dme(t,e){let n=t.name===void 0||xo(e.name,t.name,!0),r=t.message===void 0||xo(e.message,t.message);return n&&r}function _me(t,e){let n=pme(e);return t.some(r=>dme(r,n))}function fme(t,e){return function(r,o){if(H()!==t||_me(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>xc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),mme(r,e.mode)}}function mme(t,e){let n="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Fp(t))}var hme="ProcessSession",kV=()=>({name:hme,setupOnce(){im(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&ap()})}});import*as GV from"node:http";var bO="Spotlight",Tme=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:bO,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Eme(n,e)}}},BV=Tme;function Eme(t,e){let n=Sme(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=tp(o);vc(()=>{let i=GV.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function Sme(t){try{return new URL(`${t}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as jV from"node:util";var gme="NodeSystemError";function Ame(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:jV.getSystemErrorMap().has(t.errno)}var HV=(t={})=>({name:gme,processEvent:(e,n,r)=>{if(!Ame(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as yme from"node:http";import*as Ime from"node:https";import{Readable as Ome}from"node:stream";import{createGzip as Nme}from"node:zlib";import*as Vo from"node:net";import*as PO from"node:tls";import*as CO from"node:http";var co=Symbol("AgentBaseInternalState"),qh=class extends CO.Agent{constructor(e){super(e),this[co]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
32
|
-
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof
|
|
31
|
+
`):""}function TI(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Hm&&o){let s=Cp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function EI(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function CH(t,e){let n=Dpe(t),r=e.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Dpe(t){try{let e=Fm(t.origin,t.path),n=bs(e),r={url:Cs(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function Fm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var sa=class extends MH.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&bH(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&CH(e,n)}_subscribeToChannel(e,n){let r=jo>18||jo===18&&Mp>=19,o;if(r)Kc.subscribe?.(e,n),o=()=>Kc.unsubscribe?.(e,n);else{let s=Kc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,PH.isTracingSuppressed)(P.active()))return!0;let n=Fm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var Upe="NodeFetch",wpe=w(`${Upe}.sentry`,sa,t=>t),kpe=(t={})=>({name:"NodeFetch",setupOnce(){wpe(t)}}),xH=kpe;var _V=K(DH(),1);le();b();b();var dn=K(Te(),1),Bs=K(cN(),1),TN="sentry.parentIsRemote",cu="sentry.graphql.operation";function EN(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function gN(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function N_e(t){return typeof t.kind=="number"}function O_e(t){return!!t.status}function kF(t){return!!t.name}function b_e(t){if(!gN(t))return{};let e=t.attributes[cs]||t.attributes[ec],n={url:e,"http.method":t.attributes[vi]||t.attributes[Cl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=bs(e);n.url=Cs(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function C_e(t){return N_e(t)?t.kind:Oe.INTERNAL}var Gh="sentry-trace",uN="baggage",SN="sentry.dsc",AN="sentry.sampled_not_recording",GF="sentry.url",P_e="sentry.sample_rand",M_e="sentry.sample_rate",RN=Un("sentry_scopes"),lN=Un("sentry_fork_isolation_scope"),pN=Un("sentry_fork_set_scope"),dN=Un("sentry_fork_set_isolation_scope"),BF="_scopeContext";function uu(t){return t.getValue(RN)}function jF(t,e){return t.setValue(RN,e)}function x_e(t,e){nt(t,BF,e)}function Bp(t){return t[BF]}function au(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(AN)==="1":!1;if(e===Ft.SAMPLED)return!0;if(r)return!1;let o=n?n.get(SN):void 0,s=o?Uo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function HF(t,e,n){let r=e[vi]||e[Cl];if(r)return L_e({attributes:e,name:t,kind:n},r);let o=e[xi]||e[XS],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return v_e({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[cA])return{...Gp(t,e,"route"),op:"rpc"};if(e[aA])return{...Gp(t,e,i),op:"message"};let l=e[ZS];return l?{...Gp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function FF(t){let e=gN(t)?t.attributes:{},n=kF(t)?t.name:"<unknown>",r=C_e(t);return HF(n,e,r)}function v_e({attributes:t,name:e}){let n=t[tr];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[JS];return{op:"db",description:r?r.toString():e,source:"task"}}function L_e({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Oe.CLIENT:o.push("client");break;case Oe.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=U_e(n,e);if(!s)return{...Gp(t,n),op:o.join(".")};let p=n[cu],d=`${r} ${s}`,_=p?`${d} (${D_e(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let h=e===Oe.CLIENT||e===Oe.SERVER,g=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[tr],x=!R&&I==null&&(h||!g),{description:F,source:B}=x?{description:_,source:f}:Gp(t,n);return{op:o.join("."),description:F,source:B,data:m}}function D_e(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}function U_e(t,e){let n=t[rA],r=t[ec]||t[cs],o=t[Co],s=typeof r=="string"?bs(r):void 0,i=s?Cs(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Oe.SERVER&&typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function Gp(t,e,n="custom"){let r=e[Ue]||n,o=e[tr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function VF(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=kF(n)?FF(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=au(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function qF(){return X.getActiveSpan()}var js=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function $F({dsc:t,sampled:e}){let n=t?Vi(t):void 0,r=new dn.TraceState,o=n?r.set(SN,n):r;return e===!1?o.set(AN,"1"):o}var YF=new Set;function WF(){return Array.from(YF)}function Fh(t){YF.add(t)}var Bh=class extends dn.W3CBaggagePropagator{constructor(){super(),Fh("SentryPropagator"),this._urlMatchesTargetsMap=new In(100)}inject(e,n,r){if((0,dn.isTracingSuppressed)(e)){js&&S.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&B_e(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Xi(s,i,this._urlMatchesTargetsMap)){js&&S.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=k_e(n),l=G_e(n),p=Ar.getBaggage(e)||Ar.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=zF(e);if(c){let h=qi(c);h&&Object.entries(h).forEach(([T,g])=>{!l&&T.startsWith(Xr)||(p=p.setEntry(T,{value:g}))})}!l&&d&&(p=Object.entries(d).reduce((h,[T,g])=>g?h.setEntry(`${Xr}${T}`,{value:g}):h,p)),!l&&_&&_!==bi&&(r.set(n,Gh,Rs(_,f,m)),a&&r.set(n,"traceparent",ys(_,f,m))),super.inject(Ar.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,Gh),s=r.get(n,uN),i=o?Array.isArray(o)?o[0]:o:void 0;return QF(KF(e,{sentryTrace:i,baggage:s}))}fields(){return[Gh,uN,"traceparent"]}};function zF(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:au(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:au(a)}}let r=e.scope||uu(t)?.scope||he(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Jr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function KF(t,{sentryTrace:e,baggage:n}){let r=Ql(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=Uo(n);if(!s||c&&!ey(c,l?.org_id))return t;let p=j_e({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function w_e(t,e,n){let r=QF(KF(t,e));return P.with(r,n)}function QF(t){let e=uu(t),n={scope:e?e.scope:he().clone(),isolationScope:e?e.isolationScope:ue()};return jF(t,n)}function k_e(t){try{let e=t[uN];return Array.isArray(e)?e.join(","):e}catch{return}}function G_e(t){try{return t[Gh]}catch{return}}function B_e(t){let e=Y(t).data,n=e[ec]||e[cs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(GF);if(r)return r}function j_e({spanId:t,traceId:e,sampled:n,dsc:r}){let o=$F({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Ft.SAMPLED:Ft.NONE,traceState:o}}function XF(t,e,n){let r=ZF(),{name:o,parentSpan:s}=t;return oV(s)(()=>{let a=nV(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,dn.suppressTracing)(a):a,p=eV(t);if(!Xe()){let d=(0,dn.isTracingSuppressed)(l)?l:(0,dn.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(_N(_),P.with(a,()=>Mr(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(_N(d),Mr(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function H_e(t,e){return XF(t,e,!0)}function F_e(t,e){return XF(t,n=>e(n,()=>n.end()),!1)}function V_e(t){let e=ZF(),{name:n,parentSpan:r}=t;return oV(r)(()=>{let s=nV(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,dn.suppressTracing)(s):s,c=eV(t);Xe()||(a=(0,dn.isTracingSuppressed)(a)?a:(0,dn.suppressTracing)(a));let l=e.startSpan(n,c,a);return _N(l),l})}function JF(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(he()))}function ZF(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function eV(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?tV(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function tV(t){return t<9999999999?t*1e3:t}function _N(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?tV(n):n)}function nV(t,e){let n=q_e(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=au(r.spanContext()),c=je(r),l=Je(c),p=$F({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Ft.SAMPLED:Ft.NONE,traceState:p};return X.setSpanContext(o,d)}function q_e(t){if(t){let e=Bp(t);if(e)return e}return P.active()}function $_e(t,e){return w_e(P.active(),t,e)}function Y_e(t){let e=Wt(),n=zt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Ft.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(he().setPropagationContext({traceId:e,sampleRand:Rt()}),t()))}function rV(t,e){let n=Bp(e),r=n&&X.getSpan(n),o=r?Is(r):Fi(e);return[r?Je(r):Jr(t,e),o]}function oV(t){return t!==void 0?e=>JF(t,e):e=>e()}function W_e(t){let e=(0,dn.suppressTracing)(P.active());return P.with(e,t)}function sV(t){t.on("preprocessEvent",e=>{let n=qF();if(!n||e.type==="transaction")return;e.contexts={trace:Is(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function z_e({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Bp(e))??P.active();if(t){let{scope:p}=br(t);o=p&&Bp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=zF(o,{scope:e,client:n}),l={"sentry-trace":Rs(s,i,a),baggage:Vi(c)};return r&&(l.traceparent=ys(s,i,a)),l}function iV(){function t(){let a=P.active(),c=uu(a);return c||{scope:Ic(),isolationScope:er()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Bp(a)||P.active();return P.with(l.setValue(pN,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(lN,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(dN,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}qR({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:H_e,startSpanManual:F_e,startInactiveSpan:V_e,getActiveSpan:qF,suppressTracing:W_e,getTraceData:z_e,continueTrace:$_e,startNewTrace:Y_e,withActiveSpan:JF})}function aV(t){class e extends t{constructor(...r){super(...r),Fh("SentryContextManager")}with(r,o,s,...i){let a=uu(r),c=a?.scope||he(),l=a?.isolationScope||ue(),p=r.getValue(lN)===!0,d=r.getValue(pN),_=r.getValue(dN),f=d||c.clone(),m=_||(p?l.clone():l),g=jF(r,{scope:f,isolationScope:m}).deleteValue(lN).deleteValue(pN).deleteValue(dN);return x_e(f,g),super.with(g,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:RN}}}return e}function K_e(t){let e=new Map;for(let n of t)Q_e(e,n);return Array.from(e,function([n,r]){return r})}function cV(t){return t.attributes[TN]===!0?void 0:EN(t)}function Q_e(t,e){let n=e.spanContext().spanId,r=cV(e);if(!r){fN(t,{id:n,span:e,children:[]});return}let o=X_e(t,r),s=fN(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function X_e(t,e){let n=t.get(e);return n||fN(t,{id:e,children:[]})}function fN(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var uV={1:"cancelled",2:"unknown_error",3:"invalid_argument",4:"deadline_exceeded",5:"not_found",6:"already_exists",7:"permission_denied",8:"resource_exhausted",9:"failed_precondition",10:"aborted",11:"out_of_range",12:"unimplemented",13:"internal_error",14:"unavailable",15:"data_loss",16:"unauthenticated"},J_e=t=>Object.values(uV).includes(t);function lV(t){let e=gN(t)?t.attributes:{},n=O_e(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=DF(e);if(o)return o}return n.message&&J_e(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=DF(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function DF(t){let e=t[bo]||t[Mi],n=t[uA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return Do(r);if(typeof n=="string")return{code:2,message:uV[n]||"unknown_error"}}var UF=1e3,wF=300,mN=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||wF,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Zn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Cy(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Zn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&js&&S.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=cV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;js&&S.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Zn()+wF*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=K_e(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=efe(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)hN(p,c,r);a.spans=c.length>UF?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,UF):c;let l=Wi(i.events);l&&(a.measurements=l),rm(a)}return r}_flushSentSpanCache(){let e=Zn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function Z_e(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function efe(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=pV(t),i=br(t),a=t.attributes[Or],c={[Ue]:s,[Or]:a,[ee]:e,[W]:o,...r,...dV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=EN(t),f=lV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:Yi(f),links:$i(l)},h=c[bo],T=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Rn(t.startTime),timestamp:Rn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function hN(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{hN(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=EN(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:h="manual"}=pV(r),T={[W]:h,[ee]:_,...dV(c),...m},g=lV(r),R={span_id:s,trace_id:i,data:T,description:f,parent_span_id:a,start_timestamp:Rn(l),timestamp:Rn(p)||void 0,status:Yi(g),op:_,origin:h,measurements:Wi(r.events),links:$i(d)};e.push(R),t.children.forEach(I=>{hN(I,e,n)})}function pV(t){let{op:e,source:n,origin:r}=Z_e(t),{op:o,description:s,source:i,data:a}=FF(t),c=e||o,l=n||i,p={...a,...tfe(t)};return{op:c,description:s,source:l,origin:r,data:p}}function dV(t){let e={...t};return delete e[Or],delete e[TN],delete e[tr],e}function tfe(t){let e=t.attributes,n={};t.kind!==Oe.INTERNAL&&(n["otel.kind"]=Oe[t.kind]);let r=e[Mi];r&&(n[bo]=r);let o=b_e(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function nfe(t,e){let n=X.getSpan(e),r=uu(e);n&&!n.spanContext().isRemote&&Cc(n,t),n?.spanContext().isRemote&&t.setAttribute(TN,!0),e===za&&(r={scope:Ic(),isolationScope:er()}),r&&Kl(t,r.scope,r.isolationScope),np(t),H()?.emit("spanStart",t)}function rfe(t){rp(t),H()?.emit("spanEnd",t)}var jh=class{constructor(e){Fh("SentrySpanProcessor"),this._exporter=new mN(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){nfe(e,n)}onEnd(e){rfe(e),this._exporter.export(e)}},Hh=class{constructor(e){this._client=e,Fh("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=ife(e),l=c?.spanContext();if(!Xe(a))return iu({decision:void 0,context:e,spanAttributes:s});let p=s[Cl]||s[vi];if(o===Oe.CLIENT&&p&&(!c||l?.isRemote))return iu({decision:void 0,context:e,spanAttributes:s});let d=c?ofe(c,n,r):void 0;if(!(!c||l?.isRemote))return iu({decision:d?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:h}=HF(r,s,o),T={...m,...s};h&&(T[ee]=h);let g={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:f,parentSampled:d,parentContext:l},g),!g.decision)return iu({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=uu(e)??{},I=l?.traceState?l.traceState.get(SN):void 0,x=I?Uo(I):void 0,F=jn(x?.sample_rand)??Rt(),[B,se,ve]=op(a,{name:f,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:jn(x?.sample_rate)},F),on=`${p}`.toUpperCase();return on==="OPTIONS"||on==="HEAD"?(js&&S.log(`[Tracing] Not sampling span because HTTP method is '${on}' for ${r}`),iu({decision:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(js&&S.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...iu({decision:B?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[Or]:ve?se:void 0}})}toString(){return"SentrySampler"}};function ofe(t,e,n){let r=t.spanContext();if(Oo(r)&&r.traceId===e){if(r.isRemote){let s=au(t.spanContext());return js&&S.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=au(r);return js&&S.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function iu({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=sfe(e,n);return o!==void 0&&(s=s.set(M_e,`${o}`)),r!==void 0&&(s=s.set(P_e,`${r}`)),t==null?{decision:Bs.SamplingDecision.NOT_RECORD,traceState:s}:t===Bs.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(AN,"1")}:{decision:t,traceState:s}}function sfe(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new dn.TraceState,s=e[ec]||e[cs];return s&&typeof s=="string"&&(o=o.set(GF,s)),o}function ife(t){let e=X.getSpan(t);return e&&Oo(e.spanContext())?e:void 0}var yN=aV(_V.AsyncLocalStorageContextManager);b();function IN(){wn.disable(),wn.setLogger({error:S.error,warn:S.warn,info:S.log,debug:S.log,verbose:S.log},pt.DEBUG)}import*as NN from"node:diagnostics_channel";var afe="ChildProcess",fV=(t={})=>({name:afe,setup(){NN.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&cfe(e.process,t)}),NN.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&ufe(e.worker,t)})}});function cfe(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&rr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,rr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function ufe(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as lfe}from"node:child_process";import{readFile as pfe,readdir as dfe}from"node:fs";import*as Ot from"node:os";import{join as _fe}from"node:path";import{promisify as hV}from"node:util";var ffe=hV(pfe),mfe=hV(dfe),hfe="Context",Tfe=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=Efe(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await gfe()),n.app&&(s.app=Afe()),n.device&&(s.device=Rfe(n.device)),n.culture){let i=Sfe();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Cfe()),s}return{name:hfe,processEvent(s){return r(s)}}},TV=Tfe;function Efe(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=Ot.freemem()),t}async function gfe(){let t=Ot.platform();switch(t){case"darwin":return Ofe();case"linux":return bfe();default:return{name:yfe[t]||t,version:Ot.release()}}}function Sfe(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function Afe(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function Rfe(t){let e={},n;try{n=Ot.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=Ot.arch(),(t===!0||t.memory)&&(e.memory_size=Ot.totalmem(),e.free_memory=Ot.freemem()),t===!0||t.cpu){let r=Ot.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var yfe={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},Ife=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],Nfe={alpine:t=>t,arch:t=>ao(/distrib_release=(.*)/,t),centos:t=>ao(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>ao(/release (..)/,t),mint:t=>ao(/distrib_release=(.*)/,t),red:t=>ao(/release ([^ ]+)/,t),suse:t=>ao(/VERSION = (.*)\n/,t),ubuntu:t=>ao(/distrib_release=(.*)/,t)};function ao(t,e){let n=t.exec(e);return n?n[1]:void 0}async function Ofe(){let t={kernel_version:Ot.release(),name:"Mac OS X",version:`10.${Number(Ot.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{lfe("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=ao(/^ProductName:\s+(.*)$/m,e),t.version=ao(/^ProductVersion:\s+(.*)$/m,e),t.build=ao(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function mV(t){return t.split(" ")[0].toLowerCase()}async function bfe(){let t={kernel_version:Ot.release(),name:"Linux"};try{let e=await mfe("/etc"),n=Ife.find(a=>e.includes(a.name));if(!n)return t;let r=_fe("/etc",n.name),o=(await ffe(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(mV(a))>=0)||s[0];let i=mV(t.name);t.version=Nfe[i]?.(o)}catch{}return t}function Cfe(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as Pfe}from"node:fs";import{createInterface as Mfe}from"node:readline";var ON=new In(10),SV=new In(20),xfe=7,vfe="ContextLines",Lfe=1e3,Dfe=1e4;function Ufe(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function wfe(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function kfe(t){return t.lineno!==void 0&&t.lineno>Dfe||t.colno!==void 0&&t.colno>Lfe}function Gfe(t,e){let n=ON.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function Bfe(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=gV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=gV(i,e)),n++}return s}function jfe(t,e,n){return new Promise((r,o)=>{let s=Pfe(t),i=Mfe({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){SV.set(t,1),re&&S.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=wR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let h=e[l];if(h===void 0){i.close(),i.removeAllListeners();return}d=h[0],_=h[1]}})})}async function Hfe(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||wfe(c)||kfe(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(SV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=Bfe(i,e);if(a.every(l=>Gfe(s,l)))continue;let c=Ufe(ON,s,{});o.push(jfe(s,a,c))}if(await Promise.all(o).catch(()=>{re&&S.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&Ffe(s.stacktrace.frames,e,ON);return t}function Ffe(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;Vfe(r.lineno,r,e,o)}}function EV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Vfe(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&S.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=AV(t,n);s<t;s++){let i=r[s];if(i===void 0){EV(e),re&&S.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){EV(e),re&&S.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=RV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function AV(t,e){return Math.max(1,t-e)}function RV(t,e){return t+e}function gV(t,e){return[AV(t,e),RV(t,e)]}var qfe=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:xfe;return{name:vfe,processEvent(n){return Hfe(n,e)}}},yV=qfe;import{Worker as $fe}from"node:worker_threads";var Vh;async function qh(){if(Vh===void 0)try{Vh=!!(await import("node:inspector")).url()}catch{Vh=!1}return Vh}var jp="__SENTRY_ERROR_LOCAL_VARIABLES__";function NV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function IV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function $h(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||IV(t)&&IV(e)}var Yfe="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function OV(...t){S.log("[LocalVariables]",...t)}var bV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!$h(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&jp in i.originalException&&Array.isArray(i.originalException[jp])){for(let a of s.exception?.values||[])e(a,i.originalException[jp]);i.originalException[jp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new $fe(new URL(`data:application/javascript;base64,${Yfe}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{OV("Worker error",a)}),i.once("exit",a=>{OV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await qh()){S.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:S.isEnabled()};r().then(()=>{try{o(a)}catch(c){S.error("Failed to start worker",c)}},c=>{S.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function CV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function Wfe(t,e){if(e!==void 0)return CV(t(e,1))}function PV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var bN=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=PV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},zfe="LocalVariables",Kfe=(t={},e)=>{let n=new In(20),r,o=!1;function s(l){let p=CV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,h=d[f],T=_[m];if(!T||!h)break;h.vars===void 0||T.in_app===!1&&t.includeOutOfAppFrames!==!0||!$h(T.function,h.function)||(T.vars=h.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(jo<18){S.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await qh()){S.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await bN.create(e),f=(h,{params:{reason:T,data:g,callFrames:R}},I)=>{if(T!=="exception"&&T!=="promiseRejection"){I();return}r?.();let x=Wfe(h,g.description);if(x==null){I();return}let{add:F,next:B}=PV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:on,this:Io}=R[se],ss=ve.find(Tt=>Tt.type==="local"),Ii=Io.className==="global"||!Io.className?on:`${Io.className}.${on}`;if(ss?.object.objectId===void 0)F(Tt=>{Tt[se]={function:Ii},B(Tt)});else{let Tt=ss.object.objectId;F(Ya=>_.getLocalVariables(Tt,Wa=>{Ya[se]={function:Ii,vars:Wa},B(Ya)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((h,T)=>f(p.stackParser,h,T),m),m){let h=t.maxExceptionsPerSecond||50;r=NV(h,()=>{S.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},T=>{S.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${T} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){S.log("The `LocalVariables` integration failed to start.",_)}}return{name:zfe,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},MV=Kfe;var xV=(t={})=>Lr.major<19?MV(t):bV(t);import{existsSync as Qfe,readFileSync as UV}from"node:fs";import{dirname as Xfe,join as wV}from"node:path";function Hp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var vV;function LV(){return Hp()?!1:jo>=21||jo===20&&Mp>=6||jo===18&&Mp>=19?!0:(vV||(vV=!0,Qe(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}var CN,Jfe="Modules",Zfe=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,eme=()=>({name:Jfe,processEvent(t){return t.modules={...t.modules,...DV()},t},getModules:DV}),kV=eme;function tme(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function nme(){return{...Zfe,...sme(),...Hp()?rme():{}}}function rme(){let t=U.main?.paths||[],e=tme(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=Xfe(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=wV(a,"package.json");if(r.add(a),!Qfe(c))return i();try{let l=JSON.parse(UV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function DV(){return CN||(CN=nme()),CN}function ome(){try{let t=wV(process.cwd(),"package.json");return JSON.parse(UV(t,"utf8"))}catch{return{}}}function sme(){let t=ome();return{...t.dependencies,...t.devDependencies}}import{isMainThread as ame}from"worker_threads";var ime=2e3;function Fp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&S.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:ime;e.close(r).then(o=>{o||re&&S.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&S.error(o)})}var cme="OnUncaughtException",GV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:cme,setup(n){ame&&global.process.on("uncaughtException",ume(n,e))}}};function ume(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Fp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&S.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Fp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var lme="OnUnhandledRejection",pme=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],dme=(t={})=>{let e={mode:t.mode??"warn",ignore:[...pme,...t.ignore??[]]};return{name:lme,setup(n){global.process.on("unhandledRejection",hme(n,e))}}},BV=dme;function _me(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function fme(t,e){let n=t.name===void 0||xo(e.name,t.name,!0),r=t.message===void 0||xo(e.message,t.message);return n&&r}function mme(t,e){let n=_me(e);return t.some(r=>fme(r,n))}function hme(t,e){return function(r,o){if(H()!==t||mme(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>xc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),Tme(r,e.mode)}}function Tme(t,e){let n="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Fp(t))}var Eme="ProcessSession",jV=()=>({name:Eme,setupOnce(){cm(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&ap()})}});import*as HV from"node:http";var PN="Spotlight",gme=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:PN,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&S.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Sme(n,e)}}},FV=gme;function Sme(t,e){let n=Ame(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){S.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=tp(o);vc(()=>{let i=HV.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,S.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function Ame(t){try{return new URL(`${t}`)}catch{S.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as VV from"node:util";var Rme="NodeSystemError";function yme(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:VV.getSystemErrorMap().has(t.errno)}var qV=(t={})=>({name:Rme,processEvent:(e,n,r)=>{if(!yme(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as Nme from"node:http";import*as Ome from"node:https";import{Readable as bme}from"node:stream";import{createGzip as Cme}from"node:zlib";import*as Vo from"node:net";import*as xN from"node:tls";import*as MN from"node:http";var co=Symbol("AgentBaseInternalState"),Yh=class extends MN.Agent{constructor(e){super(e),this[co]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
32
|
+
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof MN.Agent)return s.addRequest(e,o);this[co].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[co].currentSocket;if(this[co].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[co].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[co]&&(this[co].defaultPort=e)}get protocol(){return this[co].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[co]&&(this[co].protocol=e)}};function Wh(...t){S.log("[https-proxy-agent:parse-proxy-response]",...t)}function $V(t){return new Promise((e,n)=>{let r=0,o=[];function s(){let p=t.read();p?l(p):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),Wh("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function c(p){i(),Wh("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let d=Buffer.concat(o,r),_=d.indexOf(`\r
|
|
33
33
|
\r
|
|
34
|
-
`);if(_===-1){
|
|
35
|
-
`),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),
|
|
34
|
+
`);if(_===-1){Wh("have not received end of HTTP headers yet..."),s();return}let f=d.subarray(0,_).toString("ascii").split(`\r
|
|
35
|
+
`),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),g=h.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let F=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[F];typeof se=="string"?R[F]=[se,B]:Array.isArray(se)?se.push(B):R[F]=B}Wh("got proxy server response: %o %o",m,R),i(),e({connect:{statusCode:T,statusText:g,headers:R},buffered:d})}t.on("error",c),t.on("end",a),s()})}function Vp(...t){S.log("[https-proxy-agent]",...t)}var qp=class extends Yh{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Vp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?YV(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Vp("Creating `tls.Socket`: %o",this.connectOpts);let _=this.connectOpts.servername||this.connectOpts.host;o=xN.connect({...this.connectOpts,servername:_&&Vo.isIP(_)?void 0:_})}else Vp("Creating `net.Socket`: %o",this.connectOpts),o=Vo.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=Vo.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
|
|
36
36
|
`;if(r.username||r.password){let _=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(_).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let _ of Object.keys(s))a+=`${_}: ${s[_]}\r
|
|
37
|
-
`;let c
|
|
38
|
-
`);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Rme),n.secureEndpoint){Vp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Vp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};qp.__initStatic();function Rme(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var bme=1024*32;function Cme(t){return new Ome({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),lp(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Pme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ime:yme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new qp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=Mme(t,t.httpModule??o,i);return lp(t,a)}function Pme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function Mme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{vc(()=>{let _=Cme(l.body),f={...t.headers};l.body.length>bme&&(f["content-encoding"]="gzip",_=_.pipe(Nme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=wc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as xme,sep as vme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=vme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=xme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=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,n=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,r=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 e||n||r||t}var KV=vf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as Lme,isMainThread as Dme}from"worker_threads";var Ume=6e4,Yh=class extends pp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Qi(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${Dme?"main":`worker-${Lme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Dc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??Ume).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Wh(){return[fm(),dm(),mm(),hm(),HV(),Dy(),Em(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return wme(t,Wh)}function wme(t={},e){let n=kme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Qi(n,"node-core");let o=new Yh(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${Hp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),jme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||g.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 kme(t,e){let n=Gme(t.release),r=$V(t.spotlight),o=Bme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:wc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function Gme(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function Bme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function jme(){if(wc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Ql(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function $p(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",zh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Hme=w(`${LO}.sentry`,t=>new oa(t)),Fme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function Vme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&zh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Np(r),i=bp(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=Vme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:zh||!l,createSpansForOutgoingRequests:zh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=$p(_);if(f.startsWith("data:")){let m=kc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Hme(p),l){let d=qme(t);Fme(d)}},processEvent(c){return i.processEvent(c)}}};function qme(t={}){return{disableOutgoingRequestInstrumentation:zh,ignoreOutgoingRequestHook:n=>{let r=$p(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=$p(r);if(o.startsWith("data:")){let s=kc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",Wme=w(uq,cq.UndiciInstrumentation,t=>Xme(t)),zme=w(`${uq}.sentry`,sa,t=>t),Kme=(t={})=>({name:"NodeFetch",setupOnce(){Qme(t,H()?.getOptions())&&Wme(t),zme(t)}}),lq=Kme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Qme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function Xme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=kc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function _he(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function fhe(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>_he(t),spanNameHook:(t,e)=>fhe(t,e)})),mhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=mhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var wT=K(Te(),1),fa=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(cd||(cd={}));var ud;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(ud||(ud={}));b();var ld=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ld]||[];return s.push(o),Object.defineProperty(t,ld,{enumerable:!1,configurable:!0,value:s}),o}function DT(t,e){let n=t[ld]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ld])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var dSe="0.1.0",_Se="@sentry/instrumentation-fastify-v3",W$="anonymous",fSe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),UT=class extends fa.InstrumentationBase{constructor(e={}){super(_Se,dSe,e)}init(){return[new fa.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,wT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===wT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${ud.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:cd.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){DT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||DT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!fSe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),mSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,fa.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),DT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${ud.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:cd.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,fa.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function mSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var kT="Fastify",X$=w(`${kT}.v3`,()=>new UT);function hSe(){let t=H();if(t)return t.getIntegrationByName(kT)}function K$(t,e,n,r){let o=hSe()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${kT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(ESe(),r&&SSe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),TSe=({shouldHandleError:t})=>{let e;return{name:kT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>TSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function ESe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function SSe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[cu]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(cu,p)):typeof p=="string"?c.setAttribute(cu,[p,d]):c.setAttribute(cu,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${jSe(p)})`)}}}}),BSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=BSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function jSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),FSe=()=>({name:BY,setupOnce(){jY()}}),HY=FSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),qSe=()=>({name:KY,setupOnce(){QY()}}),XY=qSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:KSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function KSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(QSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(JSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function QSe(t){return typeof t=="object"&&t!==null&&!XSe(t)}function XSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function JSe(t){return Array.isArray(t)}var ZSe=()=>({name:aW,setupOnce(){cW()}}),uW=ZSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),cge=()=>({name:AW,setupOnce(){RW()}}),yW=cge;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),Ege=()=>({name:vW,setupOnce(){LW()}}),DW=Ege;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),Lge=()=>({name:VW,setupOnce(){qW()}}),$W=Lge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Jge=["get","set","setex"],JN=["get","mget"],Zge=["set","setex"];function Id(t,e){return t.includes(e.toLowerCase())}function ZN(t){return Id(JN,t)?"cache.get":Id(Zge,t)?"cache.put":void 0}function eAe(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return Id(Jge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(eAe(r,n))return!0;return!1}function hz(t){let e=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(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var gE="Redis",Od={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Od.cachePrefixes||!mz(e,o,Od.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),Id(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Od.maxCacheKeyLength?hs(l,Od.maxCacheKeyLength):l)},tAe=w(`${gE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),nAe=w(`${gE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{tAe(),nAe()},{id:gE}),rAe=(t={})=>({name:gE,setupOnce(){Od=t,gz()}}),Az=rAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),EAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=EAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],SAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,gAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(yp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(tc,r);return}let o=n?.match(SAe);o?.[1]&&e.setAttribute(tc,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.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(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[gAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[xi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},AAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=AAe;b();b();var zE=K(bK(),1);b();var FRe={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"}},VRe=FRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${VRe}_PRISMA_INSTRUMENTATION`,Wu=globalThis;function qRe(){let t=Wu[xb];return t?.helper?t.helper:Wu[Mb]?.helper}function $Re(t){let e={helper:t};Wu[xb]=e,Wu[Mb]=e}function YRe(){delete Wu[xb],delete Wu[Mb]}var WRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",zRe="00-10-10-00";function KRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var QRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:zRe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!WRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:KRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return XRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function XRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={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},PK=vK.version,JRe=vK.name,ZRe="@prisma/client",LK=class extends zE.InstrumentationBase{tracerProvider;constructor(t={}){super(JRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new zE.InstrumentationNodeModuleDefinition(ZRe,[PK])]}enable(){let t=this._config;$Re(new QRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){YRe()}isEnabled(){return qRe()!==void 0}};var DK="Prisma";function eye(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();eye(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=tye(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function tye(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var nye=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){nye(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),mye=()=>({name:WK,setupOnce(){zK()}}),KK=mye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Bd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var JE=K(ne(),1);var hye="@sentry/instrumentation-hono",Tye="0.0.1",XE=class extends JE.InstrumentationBase{constructor(e={}){super(hye,Tye,e)}init(){return[new JE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Bd.MIDDLEWARE:Bd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function Eye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[vi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new XE({responseHook:t=>{Eye(t)}})),Sye=()=>({name:QK,setupOnce(){XK()}}),JK=Sye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Cye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=Cye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),Gye=()=>({name:y2,setupOnce(){I2()}}),O2=Gye;var U2=K(D2(),1);var Vye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),qye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Op(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";Vye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=qye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),Yye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Op(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=Yye;var n4=K(t4(),1);var r4="Amqplib",rIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(rIe)),oIe=()=>({name:r4,setupOnce(){o4()}}),s4=oIe;var qd="VercelAI";var mS=K(ne(),1);var sIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function iIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function aIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(cIe(e.content),uIe(e.content))}function cIe(t){for(let e of t){if(!iIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function uIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function lIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var fS=class t extends mS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new mS.InstrumentationNodeModuleDefinition("ai",sIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(qd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=lIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{aIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(qd,()=>new fS({}));function pIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var dIe=(t={})=>{let e;return{name:qd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??pIe(n)?bm(n):e?.callWhenPatched(()=>bm(n))}}},c4=dIe;var TS=K(ne(),1);var _Ie=[">=4.0.0 <7"],hS=class extends TS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new TS.InstrumentationNodeModuleDefinition("openai",_Ie,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(Ki(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Pm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new hS(t)),fIe=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=fIe;var SS=K(ne(),1);var mIe=[">=0.19.2 <1.0.0"],ES=class extends SS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new SS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",mIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ki(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new ES(t)),hIe=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=hIe;var il=K(ne(),1);var _4=[">=0.10.0 <2"],gS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new il.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(Ki(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return xm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return yp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new gS(t)),TIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=TIe;var _i=K(ne(),1);var AS=[">=0.1.0 <2.0.0"];function EIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function SIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=EIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var RS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,AS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,AS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",AS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",AS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=Lm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=SIe(l,n))}}};var h4=w(vm,t=>new RS(t)),gIe=(t={})=>({name:vm,setupOnce(){h4(t)}}),T4=gIe;var al=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],yS=class extends al.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new al.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new al.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Um(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Dm,t=>new yS(t)),AIe=(t={})=>({name:Dm,setupOnce(){S4(t)}}),g4=AIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@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"];for(let p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",RIe(r,o)),e(t,"getDocs",IIe(r,o)),e(t,"setDoc",OIe(r,o)),e(t,"deleteDoc",yIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function RIe(t,e){return function(r){return function(o,s){let i=OS(t,"addDoc",o);return e(i),IS(i,()=>r(o,s))}}}function yIe(t,e){return function(r){return function(o){let s=OS(t,"deleteDoc",o.parent||o);return e(s),IS(s,()=>r(o))}}}function IIe(t,e){return function(r){return function(o){let s=OS(t,"getDocs",o);return e(s),IS(s,()=>r(o))}}}function OIe(t,e){return function(r){return function(o,s,i){let a=OS(t,"setDoc",o.parent||o);return e(a),IS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function IS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function OS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return bIe(r,n),r.setAttribute(tc,e),r}function NIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function bIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[xi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=NIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("firebase-functions",e);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:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>CIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function CIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},PIe=[">=3.0.0 <5"],MIe=[">=6.0.0 <7"],NS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,PIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,MIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",xIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await rm(2e3))}}},M4=w(P4,()=>new NS(xIe)),vIe=()=>({name:P4,setupOnce(){M4()}}),x4=vIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var bS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=LIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function LIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Bh(t),resource:(0,bS.defaultResource)().merge((0,bS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new Gh({timeout:DIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new kh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function DIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Wh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return UIe(t,w4)}function UIe(t={},e){Qi(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var wIe="prod",G4="0.1.14",kIe=`@tanagram/lore/${G4}`;function xt(){return wIe}function fi(){return G4}function B4(){return kIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:fi(),sendDefaultPii:!0});nm("service_name","lore-cli");import{realpathSync as Txe}from"node:fs";import{fileURLToPath as Exe,pathToFileURL as k9}from"node:url";var GIe=/\d/,BIe=["-","_","/","."];function jIe(t=""){if(!GIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??BIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=jIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function HIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function FIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function VIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>HIe(e?.normalize?n.toLowerCase():n)).join(""):""}function $d(t,e){return FIe(VIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as qIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
39
|
-
`)}function Kn(t){return typeof t=="function"?t():t}var
|
|
40
|
-
`)}function eC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${H4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function V4(t,e){let n=e?xS("(Required)"):"",r=t.default===void 0?"":xS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{execFile as EOe}from"node:child_process";import tn from"node:fs/promises";import SOe from"node:os";import So from"node:path";import{promisify as gOe}from"node:util";import Y4 from"node:os";import Na from"node:path";function Zo(){let t=xt()==="dev"?".lore-dev":".lore";return Na.join(Y4.homedir(),t)}function US(){return Na.join(Zo(),"log.txt")}function tC(){return Na.join(Zo(),"sync_state.json")}function wS(){return Na.join(Zo(),"status.json")}function Yd(){return Na.join(Zo(),"install_source.json")}function Wd(){return Na.join(Zo(),"bin","lore")}function zd(){let t=xt();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function Kd(){return Na.join(Y4.homedir(),"Library","LaunchAgents",`${zd()}.plist`)}import cl from"node:fs/promises";import GS from"node:os";import en from"node:path";function mi(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}import z4 from"node:fs";var W4=null;function JIe(){let t=Zo();W4!==t&&(z4.mkdirSync(t,{recursive:!0}),W4=t)}function ZIe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function eOe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
|
|
41
|
-
`;let o=Object.entries(n).map(([s,i])=>`${s}=${
|
|
37
|
+
`;let c=$V(o);o.write(`${a}\r
|
|
38
|
+
`);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Ime),n.secureEndpoint){Vp("Upgrading socket connection to TLS");let _=n.servername||n.host;return xN.connect({...YV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Vp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};qp.__initStatic();function Ime(t){t.resume()}function YV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Pme=1024*32;function Mme(t){return new bme({read(){this.push(t),this.push(null)}})}function WV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),lp(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=xme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ome:Nme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new qp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=vme(t,t.httpModule??o,i);return lp(t,a)}function xme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function vme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{vc(()=>{let _=Mme(l.body),f={...t.headers};l.body.length>Pme&&(f["content-encoding"]="gzip",_=_.pipe(Cme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let g=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":g,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function zV(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=wc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as Lme,sep as Dme}from"node:path";function KV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function QV(t=process.argv[1]?vy(process.argv[1]):process.cwd(),e=Dme==="\\"){let n=e?KV(t):t;return r=>{if(!r)return;let o=e?KV(r):r,{dir:s,base:i,ext:a}=Lme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function XV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=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,n=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,r=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 e||n||r||t}var JV=Df(lI(QV()));b();var eq=K(ne(),1);import*as ZV from"node:os";import{threadId as Ume,isMainThread as wme}from"worker_threads";var kme=6e4,zh=class extends pp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||ZV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,eq.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Qi(r,"node"),S.log(`Initializing Sentry: process: ${process.pid}, thread: ${wme?"main":`worker-${Ume}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Dc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&S.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??kme).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){Ny(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?rV(this,e):[void 0,void 0]}};var tq=K(lR(),1);import*as nq from"module";function vN(){if(LV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,tq.createAddHookMessageChannel)();nq.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){S.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Kh(){return[hm(),fm(),Tm(),Em(),qV(),wy(),Sm(),OH(),xH(),GV(),BV(),yV(),xV(),TV(),fV(),jV(),kV()]}function LN(t={}){return Gme(t,Kh)}function Gme(t={},e){let n=Bme(t,e);n.debug===!0&&(re?S.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&vN(),iV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===PN)&&n.integrations.push(FV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Qi(n,"node-core");let o=new zh(n);return he().setClient(o),o.init(),S.log(`SDK initialized from ${Hp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),Fme(),VF(o),sV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function DN(){if(!re)return;let t=WF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||S.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||S.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 Bme(t,e){let n=jme(t.release),r=zV(t.spotlight),o=Hme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??WV,stackParser:NR(t.stackParser||JV),release:n,tracesSampleRate:o,spotlight:r,debug:wc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:Ty({defaultIntegrations:a,integrations:i})}}function jme(t){if(t!==void 0)return t;let e=XV();if(e!==void 0)return e}function Hme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function Fme(){if(wc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Ql(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function $p(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var UN="Http",rq="@opentelemetry_sentry-patched/instrumentation-http",Qh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Vme=w(`${UN}.sentry`,t=>new oa(t)),qme=w(UN,t=>{let e=new oq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:rq}),e.instrumentationName=rq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function $me(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&Qh)}var sq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Op(r),i=bp(o),a=e&&!n;return{name:UN,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=$me(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:Qh||!l,createSpansForOutgoingRequests:Qh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=$p(_);if(f.startsWith("data:")){let m=kc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Vme(p),l){let d=Yme(t);qme(d)}},processEvent(c){return i.processEvent(c)}}};function Yme(t={}){return{disableOutgoingRequestInstrumentation:Qh,ignoreOutgoingRequestHook:n=>{let r=$p(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=$p(r);if(o.startsWith("data:")){let s=kc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var pq=K(uq(),1);var dq="NodeFetch",Kme=w(dq,pq.UndiciInstrumentation,t=>Zme(t)),Qme=w(`${dq}.sentry`,sa,t=>t),Xme=(t={})=>({name:"NodeFetch",setupOnce(){Jme(t,H()?.getOptions())&&Kme(t),Qme(t)}}),_q=Xme;function lq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Jme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function Zme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=lq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=lq(n.origin,n.path);if(r.startsWith("data:")){let o=kc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Iq=K(yq(),1);var ft=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Nq="Express";function mhe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function hhe(t,e){if(ue()===er())return ft&&S.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var Oq=w(Nq,()=>new Iq.ExpressInstrumentation({requestHook:t=>mhe(t),spanNameHook:(t,e)=>hhe(t,e)})),The=()=>({name:Nq,setupOnce(){Oq()}}),bq=The;var Z$=K(W$(),1);import*as IO from"node:diagnostics_channel";b();var GT=K(Te(),1),fa=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(cd||(cd={}));var ud;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(ud||(ud={}));b();var ld=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function yO(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ld]||[];return s.push(o),Object.defineProperty(t,ld,{enumerable:!1,configurable:!0,value:s}),o}function wT(t,e){let n=t[ld]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ld])}function K$(t,e,n){let r,o;try{o=t(),z$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!z$(o)&&(e(r,o),r))throw r;return o}}function z$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var fge="0.1.0",mge="@sentry/instrumentation-fastify-v3",Q$="anonymous",hge=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),kT=class extends fa.InstrumentationBase{constructor(e={}){super(mge,fge,e)}init(){return[new fa.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,GT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===GT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||Q$,c=`${ud.MIDDLEWARE} - ${a}`,l=i[1],p=yO(l,s.tracer,c,{[$o.FASTIFY_TYPE]:cd.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){wT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>K$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||wT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!hge.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),Tge(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,fa.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),wT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${ud.REQUEST_HANDLER} - ${c||this.pluginName||Q$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:cd.REQUEST_HANDLER,[iA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=yO(o,e.tracer,l,p);X$(d);let{requestHook:_}=e.getConfig();return _&&(0,fa.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function Tge(){let t=H();t&&t.on("spanStart",e=>{X$(e)})}function X$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var BT="Fastify",eY=w(`${BT}.v3`,()=>new kT);function Ege(){let t=H();if(t)return t.getIntegrationByName(BT)}function J$(t,e,n,r){let o=Ege()?.getShouldHandleError()||rY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){ft&&S.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var tY=w(`${BT}.v5`,()=>{let t=new Z$.FastifyOtelInstrumentation,e=t.plugin();return IO.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?ft&&S.error("Failed to setup Fastify instrumentation",o):(Sge(),r&&Age(r))})}),IO.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;J$.call(J$,r,o,s,"diagnostics-channel")}),t}),gge=({shouldHandleError:t})=>{let e;return{name:BT,setupOnce(){e=t||rY,eY(),tY()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},nY=(t={})=>gge(t);function rY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function oY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function Sge(){let t=H();t&&t.on("spanStart",e=>{oY(e)})}function Age(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&oY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var NY=K(IY(),1);var OY="Graphql",bY=w(OY,NY.GraphQLInstrumentation,t=>{let e=PY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[cu]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(cu,p)):typeof p=="string"?c.setAttribute(cu,[p,d]):c.setAttribute(cu,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${Fge(p)})`)}}}}),Hge=(t={})=>({name:OY,setupOnce(){bY(PY(t))}}),CY=Hge;function PY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Fge(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var HY=K(jY(),1);var FY="Kafka",VY=w(FY,()=>new HY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),qge=()=>({name:FY,setupOnce(){VY()}}),qY=qge;var XY=K(QY(),1);var JY="LruMemoizer",ZY=w(JY,()=>new XY.LruMemoizerInstrumentation),Yge=()=>({name:JY,setupOnce(){ZY()}}),eW=Yge;var uW=K(cW(),1);var lW="Mongo",pW=w(lW,()=>new uW.MongoDBInstrumentation({dbStatementSerializer:Xge,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function Xge(t){let e=LO(t);return JSON.stringify(e)}function LO(t){if(Array.isArray(t))return t.map(e=>LO(e));if(Jge(t)){let e={};return Object.entries(t).map(([n,r])=>[n,LO(r)]).reduce((n,r)=>(eSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function Jge(t){return typeof t=="object"&&t!==null&&!Zge(t)}function Zge(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function eSe(t){return Array.isArray(t)}var tSe=()=>({name:lW,setupOnce(){pW()}}),dW=tSe;var yW=K(RW(),1);var IW="Mongoose",NW=w(IW,()=>new yW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),lSe=()=>({name:IW,setupOnce(){NW()}}),OW=lSe;var DW=K(LW(),1);var UW="Mysql",wW=w(UW,()=>new DW.MySQLInstrumentation({})),SSe=()=>({name:UW,setupOnce(){wW()}}),kW=SSe;var $W=K(qW(),1);var YW="Mysql2",WW=w(YW,()=>new $W.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),USe=()=>({name:YW,setupOnce(){WW()}}),zW=USe;var Sz=K(nz(),1),Az=K(mz(),1);var eAe=["get","set","setex"],eb=["get","mget"],tAe=["set","setex"];function Id(t,e){return t.includes(e.toLowerCase())}function tb(t){return Id(eb,t)?"cache.get":Id(tAe,t)?"cache.put":void 0}function nAe(t,e){return e.some(n=>t.startsWith(n))}function Tz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?hz(o.map(s=>n(s))):["<unknown>"],r=e[0];return Id(eAe,t)&&r!=null?n(r):hz(e.map(o=>n(o)))}catch{return}}function Ez(t,e,n){if(!tb(t))return!1;for(let r of e)if(nAe(r,n))return!0;return!1}function gz(t){let e=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(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function hz(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var RE="Redis",Nd={},Rz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=Tz(e,n),s=tb(e);if(!o||!s||!Nd.cachePrefixes||!Ez(e,o,Nd.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=gz(r);c&&t.setAttribute(XR,c),Id(eb,e)&&c!==void 0&&t.setAttribute(KR,c>0),t.setAttributes({[ee]:s,[QR]:o});let l=o.join(", ");t.updateName(Nd.maxCacheKeyLength?hs(l,Nd.maxCacheKeyLength):l)},rAe=w(`${RE}.IORedis`,()=>new Sz.IORedisInstrumentation({responseHook:Rz})),oAe=w(`${RE}.Redis`,()=>new Az.RedisInstrumentation({responseHook:Rz})),yz=Object.assign(()=>{rAe(),oAe()},{id:RE}),sAe=(t={})=>({name:RE,setupOnce(){Nd=t,yz()}}),Iz=sAe;var Hz=K(jz(),1);var Fz="Postgres",Vz=w(Fz,Hz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),SAe=t=>({name:Fz,setupOnce(){Vz(t)}}),qz=SAe;b();var ei=K(ne(),1);le();var cb="PostgresJs",$z=[">=3.0.0 <4"],AAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,RAe=Symbol.for("sentry.query.from.instrumented.sql"),Yz=w(cb,t=>new ab({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),ab=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",$z,n=>{try{return this._patchPostgres(n)}catch(r){return ft&&S.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,$z,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return ft&&S.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return ft&&S.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Uy(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(yp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(tc,r);return}let o=n?.match(AAe);o?.[1]&&e.setAttribute(tc,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.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(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[RAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return yt({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[xi]:"postgres",[_A]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),ft&&S.error(`Error in requestHook for ${cb} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){ft&&S.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(fA,m?.[0]?.code||"unknown"),a.setAttribute(mA,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){ft&&S.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},yAe=t=>({name:cb,setupOnce(){Yz(t)}}),Wz=yAe;b();b();var QE=K(MK(),1);b();var qRe={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"}},$Re=qRe.version.split(".")[0],vb="PRISMA_INSTRUMENTATION",Lb=`V${$Re}_PRISMA_INSTRUMENTATION`,Wu=globalThis;function YRe(){let t=Wu[Lb];return t?.helper?t.helper:Wu[vb]?.helper}function WRe(t){let e={helper:t};Wu[Lb]=e,Wu[vb]=e}function zRe(){delete Wu[Lb],delete Wu[vb]}var KRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",QRe="00-10-10-00";function XRe(t){switch(t){case"client":return Oe.CLIENT;case"internal":default:return Oe.INTERNAL}}var JRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:QRe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)LK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!KRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(DK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return xK(s,e(s,r))}return n.startActiveSpan(o,t,s=>xK(s,e(s,r)))}};function LK(t,e,n,r,o){if(DK(e.name,o))return;let s={attributes:e.attributes,kind:XRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)LK(t,c,n,r,o);i.end(e.endTime)})}function xK(t,e){return ZRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function ZRe(t){return t!=null&&typeof t.then=="function"}function DK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var UK={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},vK=UK.version,eye=UK.name,tye="@prisma/client",wK=class extends QE.InstrumentationBase{tracerProvider;constructor(t={}){super(eye,vK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new QE.InstrumentationNodeModuleDefinition(tye,[vK])]}enable(){let t=this._config;WRe(new JRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){zRe()}isEnabled(){return YRe()!==void 0}};var kK="Prisma";function nye(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function GK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var Db=class extends wK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=GK();nye(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=rye(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Ft.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Ft.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function rye(t){switch(t){case"client":return Oe.CLIENT;case"internal":default:return Oe.INTERNAL}}var oye=w(kK,t=>new Db(t)),BK=t=>({name:kK,setupOnce(){oye(t)},setup(e){GK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var KK=K(zK(),1);var QK="Hapi",XK=w(QK,()=>new KK.HapiInstrumentation),Tye=()=>({name:QK,setupOnce(){XK()}}),JK=Tye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Bd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var eg=K(ne(),1);var Eye="@sentry/instrumentation-hono",gye="0.0.1",ZE=class extends eg.InstrumentationBase{constructor(e={}){super(Eye,gye,e)}init(){return[new eg.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(vt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return vt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Bd.MIDDLEWARE:Bd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var ZK="Hono";function Sye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){ft&&S.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[vi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var e2=w(ZK,()=>new ZE({responseHook:t=>{Sye(t)}})),Aye=()=>({name:ZK,setupOnce(){e2()}}),t2=Aye;var _2=K(d2(),1);le();var f2="Koa",m2=w(f2,_2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){ft&&S.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Mye=(t={})=>({name:f2,setupOnce(){m2(t)}}),h2=Mye;var N2=K(I2(),1);var O2="Connect",b2=w(O2,()=>new N2.ConnectInstrumentation),jye=()=>({name:O2,setupOnce(){b2()}}),C2=jye;var G2=K(k2(),1);var $ye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),B2="Tedious",j2=w(B2,()=>new G2.TediousInstrumentation({})),Yye=()=>{let t;return{name:B2,setupOnce(){let e=j2();t=Np(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";$ye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},H2=Yye;var Y2=K($2(),1);var W2="GenericPool",z2=w(W2,()=>new Y2.GenericPoolInstrumentation({})),zye=()=>{let t;return{name:W2,setupOnce(){let e=z2();t=Np(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},K2=zye;var s4=K(o4(),1);var i4="Amqplib",sIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},a4=w(i4,()=>new s4.AmqplibInstrumentation(sIe)),iIe=()=>({name:i4,setupOnce(){a4()}}),c4=iIe;var qd="VercelAI";var Tg=K(ne(),1);var aIe=[">=3.0.0 <7"],u4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function cIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function uIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(lIe(e.content),pIe(e.content))}function lIe(t){for(let e of t){if(!cIe(e))continue;let n=tI(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function pIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&nI(e.toolCallId)}function dIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var hg=class t extends Tg.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new Tg.InstrumentationNodeModuleDefinition("ai",aIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(qd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=dIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{uIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of u4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=u4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var l4=w(qd,()=>new hg({}));function _Ie(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var fIe=(t={})=>{let e;return{name:qd,options:t,setupOnce(){e=l4()},afterAllSetup(n){t.force??_Ie(n)?Pm(n):e?.callWhenPatched(()=>Pm(n))}}},p4=fIe;var gg=K(ne(),1);var mIe=[">=4.0.0 <7"],Eg=class extends gg.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new gg.InstrumentationNodeModuleDefinition("openai",mIe,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(Ki(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return xm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var d4=w(ws,t=>new Eg(t)),hIe=(t={})=>({name:ws,setupOnce(){d4(t)}}),_4=hIe;var Ag=K(ne(),1);var TIe=[">=0.19.2 <1.0.0"],Sg=class extends Ag.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new Ag.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",TIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ki(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return vm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var f4=w(ks,t=>new Sg(t)),EIe=(t={})=>({name:ks,options:t,setupOnce(){f4(t)}}),m4=EIe;var il=K(ne(),1);var h4=[">=0.10.0 <2"],Rg=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@google/genai",h4,n=>this._patch(n),n=>n,[new il.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",h4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(Ki(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Lm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return yp(e,"GoogleGenAI",o),e}};var T4=w(Gs,t=>new Rg(t)),gIe=(t={})=>({name:Gs,setupOnce(){T4(t)}}),E4=gIe;var _i=K(ne(),1);var yg=[">=0.1.0 <2.0.0"];function SIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function AIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=SIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var Ig=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,yg,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,yg,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",yg,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",yg,this._patch.bind(this),r=>r)])),e}_patch(e){Iy([ws,ks,Gs]);let n=Um(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=AIe(l,n))}}};var g4=w(Dm,t=>new Ig(t)),RIe=(t={})=>({name:Dm,setupOnce(){g4(t)}}),S4=RIe;var al=K(ne(),1);var A4=[">=0.0.0 <2.0.0"],Ng=class extends al.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new al.InstrumentationNodeModuleDefinition("@langchain/langgraph",A4,this._patch.bind(this),n=>n,[new al.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",A4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&km(e.StateGraph.prototype,this.getConfig()),e}};var R4=w(wm,t=>new Ng(t)),yIe=(t={})=>({name:wm,setupOnce(){R4(t)}}),y4=yIe;var x4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as N4 from"node:net";function O4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>I4(p,n,r,t,i)),l=["@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"];for(let p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>I4(d,n,r,t,i),d=>b4(d,r)));return c}function I4(t,e,n,r,o){return b4(t,n),e(t,"addDoc",IIe(r,o)),e(t,"getDocs",OIe(r,o)),e(t,"setDoc",bIe(r,o)),e(t,"deleteDoc",NIe(r,o)),t}function b4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function IIe(t,e){return function(r){return function(o,s){let i=bg(t,"addDoc",o);return e(i),Og(i,()=>r(o,s))}}}function NIe(t,e){return function(r){return function(o){let s=bg(t,"deleteDoc",o.parent||o);return e(s),Og(s,()=>r(o))}}}function OIe(t,e){return function(r){return function(o){let s=bg(t,"getDocs",o);return e(s),Og(s,()=>r(o))}}}function bIe(t,e){return function(r){return function(o,s,i){let a=bg(t,"setDoc",o.parent||o);return e(a),Og(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function Og(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function bg(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Oe.CLIENT});return PIe(r,n),r.setAttribute(tc,e),r}function CIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(N4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function PIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[pA]:e.path,[dA]:n.name,[xi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=CIe(s);a&&(i[SA]=a),c&&(i[AA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function C4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("firebase-functions",e);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:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>MIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>P4(m,r)))}),p}function gn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Oe.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function MIe(t,e,n,r,o,s){switch(P4(t,n),s){case"function":e(t,"onRequest",gn(r,o,"http.request")),e(t,"onCall",gn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",gn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",gn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",gn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",gn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",gn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",gn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",gn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",gn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",gn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",gn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",gn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",gn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",gn(r,o,"storage.object.metadataUpdated"));break}return t}function P4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var M4={},xIe=[">=3.0.0 <5"],vIe=[">=6.0.0 <7"],Cg=class extends x4.InstrumentationBase{constructor(e=M4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...M4,...e})}init(){let e=[];return e.push(O4(this.tracer,xIe,this._wrap,this._unwrap,this.getConfig())),e.push(C4(this.tracer,vIe,this._wrap,this._unwrap,this.getConfig())),e}};var v4="Firebase",LIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await sm(2e3))}}},L4=w(v4,()=>new Cg(LIe)),DIe=()=>({name:v4,setupOnce(){L4()}}),D4=DIe;function U4(){return[bq(),nY(),CY(),t2(),dW(),OW(),kW(),zW(),Iz(),qz(),BK(),JK(),h2(),C2(),H2(),K2(),qY(),c4(),eW(),S4(),y4(),p4(),_4(),m4(),E4(),Wz(),D4()]}b();var Pg=K(wI(),1),w4=K(cN(),1);le();var Zb=1e6;function k4(t,e={}){t.getOptions().debug&&IN();let[n,r]=UIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function UIe(t,e={}){let n=new w4.BasicTracerProvider({sampler:new Hh(t),resource:(0,Pg.defaultResource)().merge((0,Pg.resourceFromAttributes)({[RA]:"node",[lA]:"sentry",[yA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new jh({timeout:wIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new Bh);let r=new yN;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function wIe(t){if(t!=null){if(t>Zb)return ft&&S.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Zb}`),Zb;if(t<=0||Number.isNaN(t)){ft&&S.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function G4(){return Kh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(sq(),_q())}function B4(t){return[...G4(),...Xe(t)?U4():[]]}function eC(t={}){return kIe(t,B4)}function kIe(t={},e){Qi(t,"node");let n=LN({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(k4(n,{spanProcessors:t.openTelemetrySpanProcessors}),DN()),n}var GIe="prod",H4="0.1.15",BIe=`@tanagram/lore/${H4}`;function Mt(){return GIe}function fi(){return H4}function F4(){return BIe}eC({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:Mt(),release:fi(),sendDefaultPii:!0});om("service_name","lore-cli");import{realpathSync as Ixe}from"node:fs";import{fileURLToPath as Nxe,pathToFileURL as B9}from"node:url";var jIe=/\d/,HIe=["-","_","/","."];function FIe(t=""){if(!jIe.test(t))return t!==t.toLowerCase()}function V4(t,e){let n=e??HIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=FIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function VIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function qIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function $Ie(t,e){return t?(Array.isArray(t)?t:V4(t)).map(n=>VIe(e?.normalize?n.toLowerCase():n)).join(""):""}function $d(t,e){return qIe($Ie(t||"",e))}function Mg(t,e){return t?(Array.isArray(t)?t:V4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function q4(t){return Mg(t||"","_")}import{parseArgs as YIe}from"node:util";function Ug(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function tC(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
39
|
+
`)}function Kn(t){return typeof t=="function"?t():t}var Na=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function WIe(t=[],e={}){let n=new Set(e.boolean||[]),r=new Set(e.string||[]),o=e.alias||{},s=e.default||{},i=new Map,a=new Map;for(let[T,g]of Object.entries(o)){let R=g;for(let I of R)i.set(T,I),a.has(I)||a.set(I,[]),a.get(I).push(T),i.set(I,T),a.has(T)||a.set(T,[]),a.get(T).push(I)}let c={};function l(T){if(n.has(T))return"boolean";let g=a.get(T)||[];for(let R of g)if(n.has(R))return"boolean";return"string"}function p(T){if(r.has(T))return!0;let g=a.get(T)||[];for(let R of g)if(r.has(R))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let T of d)c[T]||(c[T]={type:l(T),default:s[T]});for(let[T,g]of i.entries())T.length===1&&c[g]&&!c[g].short&&(c[g].short=T);let _=[],f={};for(let T=0;T<t.length;T++){let g=t[T];if(g==="--"){_.push(...t.slice(T));break}if(g.startsWith("--no-")){let R=g.slice(5);f[R]=!0;continue}_.push(g)}let m;try{m=YIe({args:_,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:_}}let h={_:[]};h._=m.positionals;for(let[T,g]of Object.entries(m.values)){let R=g;l(T)==="boolean"&&typeof g=="string"?R=g!=="false":p(T)&&typeof g=="boolean"&&(R=""),h[T]=R}for(let[T]of Object.entries(f)){h[T]=!1;let g=i.get(T);g&&(h[g]=!1);let R=a.get(T);if(R)for(let I of R)h[I]=!1}for(let[T,g]of i.entries())h[T]!==void 0&&h[g]===void 0&&(h[g]=h[T]),h[g]!==void 0&&h[T]===void 0&&(h[T]=h[g]),h[T]!==h[g]&&s[g]===h[g]&&(h[g]=h[T]);return h}var zIe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),wg=(t,e=39)=>n=>zIe?n:`\x1B[${t}m${n}\x1B[${e}m`,xg=wg(1,22),Gr=wg(36),Lg=wg(90),vg=wg(4,24);function KIe(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=W4(e);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=$d(a.name),l=Mg(a.name);if(c!==a.name||l!==a.name){let p=Ug(n.alias[a.name]||[]);c!==a.name&&!p.includes(c)&&p.push(c),l!==a.name&&!p.includes(l)&&p.push(l),p.length>0&&(n.alias[a.name]=p)}}let o=WIe(t,n),[...s]=o._,i=new Proxy(o,{get(a,c){return a[c]??a[$d(c)]??a[Mg(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=s.shift();if(c!==void 0)i[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new Na(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let c=i[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new Na(`Invalid value for argument: ${Gr(`--${a.name}`)} (${Gr(c)}). Expected one of: ${l.map(p=>Gr(p)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new Na(`Missing required argument: --${a.name}`,"EARG");return i}function W4(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:Ug(r.alias)});return e}async function QIe(t){return Promise.all(t.map(e=>Kn(e)))}async function Dg(t,e){let n=await Kn(t.args||{}),r=KIe(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await QIe(t.plugins??[]),i,a;try{for(let p of s)await p.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await Kn(t.subCommands);if(l&&Object.keys(l).length>0){let p=XIe(e.rawArgs,n),d=e.rawArgs[p];if(d){let _=await $4(l,d);if(!_)throw new Na(`Unknown command ${Gr(d)}`,"E_UNKNOWN_COMMAND");await Dg(_,{rawArgs:e.rawArgs.slice(p+1)})}else{let _=await Kn(t.default);if(_){if(t.run)throw new Na("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let f=await $4(l,_);if(!f)throw new Na(`Default sub command ${Gr(_)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await Dg(f,{rawArgs:e.rawArgs})}else if(!t.run)throw new Na("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let c=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){c.push(l)}for(let l of[...s].reverse())try{await l.cleanup?.(o)}catch(p){c.push(p)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:i}}async function $4(t,e){if(e in t)return Kn(t[e]);for(let n of Object.values(t)){let r=await Kn(n),o=await Kn(r?.meta);if(o?.alias&&Ug(o.alias).includes(e))return r}}function XIe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&JIe(r,e)&&n++;continue}return n}return-1}function JIe(t,e){let n=t.replace(/^-{1,2}/,""),r=$d(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===$d(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var ZIe=/^no[-A-Z]/;async function kg(t,e){let n=await Kn(t.meta||{}),r=W4(await Kn(t.args||{})),o=await Kn(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],c=[],l=[];for(let f of r)if(f.type==="positional"){let m=f.name.toUpperCase(),h=f.required!==!1&&f.default===void 0;a.push([Gr(m+nC(f)),Y4(f,h)]),l.push(h?`<${m}>`:`[${m}]`)}else{let m=f.required===!0&&f.default===void 0,h=[...(f.alias||[]).map(T=>`-${T}`),`--${f.name}`].join(", ")+nC(f);if(i.push([Gr(h),Y4(f,m)]),f.type==="boolean"&&(f.default===!0||f.negativeDescription)&&!ZIe.test(f.name)){let T=[...(f.alias||[]).map(g=>`--no-${g}`),`--no-${f.name}`].join(", ");i.push([Gr(T),[f.negativeDescription,m?Lg("(Required)"):""].filter(Boolean).join(" ")])}m&&l.push(`--${f.name}`+nC(f))}if(t.subCommands){let f=[],m=await Kn(t.subCommands);for(let[h,T]of Object.entries(m)){let g=await Kn((await Kn(T))?.meta);if(g?.hidden)continue;let R=Ug(g?.alias),I=[h,...R].join(", ");c.push([Gr(I),g?.description||""]),f.push(h,...R)}l.push(f.join("|"))}let p=[],d=n.version||o.version;p.push(Lg(`${n.description} (${s+(d?` v${d}`:"")})`),"");let _=i.length>0||a.length>0;return p.push(`${vg(xg("USAGE"))} ${Gr(`${s}${_?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(p.push(vg(xg("ARGUMENTS")),""),p.push(tC(a," ")),p.push("")),i.length>0&&(p.push(vg(xg("OPTIONS")),""),p.push(tC(i," ")),p.push("")),c.length>0&&(p.push(vg(xg("COMMANDS")),""),p.push(tC(c," ")),p.push("",`Use ${Gr(`${s} <command> --help`)} for more information about a command.`)),p.filter(f=>typeof f=="string").join(`
|
|
40
|
+
`)}function nC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${q4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function Y4(t,e){let n=e?Lg("(Required)"):"",r=t.default===void 0?"":Lg(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{spawn as ZPe}from"node:child_process";import X3 from"node:crypto";import eMe from"node:http";var u={};aS(u,{BRAND:()=>NNe,DIRTY:()=>Oa,EMPTY_PATH:()=>rNe,INVALID:()=>Q,NEVER:()=>uOe,OK:()=>Zt,ParseStatus:()=>Ht,Schema:()=>ce,ZodAny:()=>Ti,ZodArray:()=>ns,ZodBigInt:()=>Ca,ZodBoolean:()=>Pa,ZodBranded:()=>Wd,ZodCatch:()=>ja,ZodDate:()=>Ma,ZodDefault:()=>Ba,ZodDiscriminatedUnion:()=>jg,ZodEffects:()=>gr,ZodEnum:()=>ka,ZodError:()=>vn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>Fg,ZodIntersection:()=>Da,ZodIssueCode:()=>O,ZodLazy:()=>Ua,ZodLiteral:()=>wa,ZodMap:()=>_l,ZodNaN:()=>ml,ZodNativeEnum:()=>Ga,ZodNever:()=>Br,ZodNull:()=>va,ZodNullable:()=>Ao,ZodNumber:()=>ba,ZodObject:()=>Ln,ZodOptional:()=>Tr,ZodParsedType:()=>D,ZodPipeline:()=>zd,ZodPromise:()=>Ei,ZodReadonly:()=>Ha,ZodRecord:()=>Hg,ZodSchema:()=>ce,ZodSet:()=>fl,ZodString:()=>hi,ZodSymbol:()=>pl,ZodTransformer:()=>gr,ZodTuple:()=>So,ZodType:()=>ce,ZodUndefined:()=>xa,ZodUnion:()=>La,ZodUnknown:()=>ts,ZodVoid:()=>dl,addIssueToContext:()=>M,any:()=>DNe,array:()=>GNe,bigint:()=>PNe,boolean:()=>o3,coerce:()=>cOe,custom:()=>t3,date:()=>MNe,datetimeRegex:()=>Z4,defaultErrorMap:()=>Zo,discriminatedUnion:()=>FNe,effect:()=>eOe,enum:()=>XNe,function:()=>zNe,getErrorMap:()=>cl,getParsedType:()=>go,instanceof:()=>bNe,intersection:()=>VNe,isAborted:()=>Gg,isAsync:()=>ul,isDirty:()=>Bg,isValid:()=>mi,late:()=>ONe,lazy:()=>KNe,literal:()=>QNe,makeIssue:()=>Yd,map:()=>YNe,nan:()=>CNe,nativeEnum:()=>JNe,never:()=>wNe,null:()=>LNe,nullable:()=>nOe,number:()=>r3,object:()=>BNe,objectUtil:()=>rC,oboolean:()=>aOe,onumber:()=>iOe,optional:()=>tOe,ostring:()=>sOe,pipeline:()=>oOe,preprocess:()=>rOe,promise:()=>ZNe,quotelessJson:()=>eNe,record:()=>$Ne,set:()=>WNe,setErrorMap:()=>nNe,strictObject:()=>jNe,string:()=>n3,symbol:()=>xNe,transformer:()=>eOe,tuple:()=>qNe,undefined:()=>vNe,union:()=>HNe,unknown:()=>UNe,util:()=>de,void:()=>kNe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var rC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(rC||(rC={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var O=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),eNe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),vn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};vn.create=t=>new vn(t);var tNe=(t,e)=>{let n;switch(t.code){case O.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case O.invalid_union:n="Invalid input";break;case O.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case O.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:n="Invalid function arguments";break;case O.invalid_return_type:n="Invalid function return type";break;case O.invalid_date:n="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case O.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case O.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case O.custom:n="Invalid input";break;case O.invalid_intersection_types:n="Intersection results could not be merged";break;case O.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},Zo=tNe;var z4=Zo;function nNe(t){z4=t}function cl(){return z4}var Yd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},rNe=[];function M(t,e){let n=cl(),r=Yd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zo?void 0:Zo].filter(o=>!!o)});t.common.issues.push(r)}var Ht=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),Oa=t=>({status:"dirty",value:t}),Zt=t=>({status:"valid",value:t}),Gg=t=>t.status==="aborted",Bg=t=>t.status==="dirty",mi=t=>t.status==="valid",ul=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Er=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},K4=(t,e)=>{if(mi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new vn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ht,ctx:{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ul(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return K4(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return mi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>mi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ul(o)?o:Promise.resolve(o));return K4(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:O.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new gr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Tr.create(this,this._def)}nullable(){return Ao.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ns.create(this)}promise(){return Ei.create(this,this._def)}or(e){return La.create([this,e],this._def)}and(e){return Da.create(this,e,this._def)}transform(e){return new gr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Ba({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Wd({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ja({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return zd.create(this,e)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},oNe=/^c[^\s-]{8,}$/i,sNe=/^[0-9a-z]+$/,iNe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aNe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,cNe=/^[a-z0-9_-]{21}$/i,uNe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lNe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pNe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dNe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",oC,_Ne=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fNe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,mNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,hNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,TNe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ENe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,X4="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",gNe=new RegExp(`^${X4}$`);function J4(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function SNe(t){return new RegExp(`^${J4(t)}$`)}function Z4(t){let e=`${X4}T${J4(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ANe(t,e){return!!((e==="v4"||!e)&&_Ne.test(t)||(e==="v6"||!e)&&mNe.test(t))}function RNe(t,e){if(!uNe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function yNe(t,e){return!!((e==="v4"||!e)&&fNe.test(t)||(e==="v6"||!e)&&hNe.test(t))}var hi=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ht,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")pNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")oC||(oC=new RegExp(dNe,"u")),oC.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")aNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")cNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")oNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")sNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")iNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:O.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:O.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Z4(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?gNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?SNe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?lNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?ANe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?RNe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?yNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?TNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?ENe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:O.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:O.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};hi.create=t=>new hi({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function INe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var ba=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ht;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:O.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?INe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};ba.create=t=>new ba({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Ca=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ht;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:O.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ca.create=t=>new Ca({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Pa=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return Zt(e.data)}};Pa.create=t=>new Pa({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var Ma=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_date}),Q}let r=new Ht,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ma.create=t=>new Ma({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var pl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return Zt(e.data)}};pl.create=t=>new pl({typeName:Z.ZodSymbol,...ie(t)});var xa=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return Zt(e.data)}};xa.create=t=>new xa({typeName:Z.ZodUndefined,...ie(t)});var va=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.null,received:r.parsedType}),Q}return Zt(e.data)}};va.create=t=>new va({typeName:Z.ZodNull,...ie(t)});var Ti=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Zt(e.data)}};Ti.create=t=>new Ti({typeName:Z.ZodAny,...ie(t)});var ts=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zt(e.data)}};ts.create=t=>new ts({typeName:Z.ZodUnknown,...ie(t)});var Br=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:O.invalid_type,expected:D.never,received:n.parsedType}),Q}};Br.create=t=>new Br({typeName:Z.ZodNever,...ie(t)});var dl=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.void,received:r.parsedType}),Q}return Zt(e.data)}};dl.create=t=>new dl({typeName:Z.ZodVoid,...ie(t)});var ns=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:O.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?O.too_big:O.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:O.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:O.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Er(n,i,n.path,a)))).then(i=>Ht.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Er(n,i,n.path,a)));return Ht.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};ns.create=(t,e)=>new ns({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function ll(t){if(t instanceof Ln){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Tr.create(ll(r))}return new Ln({...t._def,shape:()=>e})}else return t instanceof ns?new ns({...t._def,type:ll(t.element)}):t instanceof Tr?Tr.create(ll(t.unwrap())):t instanceof Ao?Ao.create(ll(t.unwrap())):t instanceof So?So.create(t.items.map(e=>ll(e))):t}var Ln=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:O.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Er(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Br){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:O.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Er(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ht.mergeObjectSync(r,l)):Ht.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ll(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Tr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return e3(de.objectKeys(this.shape))}};Ln.create=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.strictCreate=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strict",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.lazycreate=(t,e)=>new Ln({shape:t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});var La=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new vn(a.ctx.common.issues));return M(n,{code:O.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new vn(c));return M(n,{code:O.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};La.create=(t,e)=>new La({options:t,typeName:Z.ZodUnion,...ie(e)});var es=t=>t instanceof Ua?es(t.schema):t instanceof gr?es(t.innerType()):t instanceof wa?[t.value]:t instanceof ka?t.options:t instanceof Ga?de.objectValues(t.enum):t instanceof Ba?es(t._def.innerType):t instanceof xa?[void 0]:t instanceof va?[null]:t instanceof Tr?[void 0,...es(t.unwrap())]:t instanceof Ao?[null,...es(t.unwrap())]:t instanceof Wd||t instanceof Ha?es(t.unwrap()):t instanceof ja?es(t._def.innerType):[],jg=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:O.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=es(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function sC(t,e){let n=go(t),r=go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=sC(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=sC(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Da=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(Gg(s)||Gg(i))return Q;let a=sC(s.value,i.value);return a.valid?((Bg(s)||Bg(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:O.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Da.create=(t,e,n)=>new Da({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var So=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:O.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Er(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ht.mergeArray(n,i)):Ht.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};So.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new So({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var Hg=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:O.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Er(r,a,r.path,a)),value:i._parse(new Er(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ht.mergeObjectAsync(n,o):Ht.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:hi.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},_l=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:O.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Er(r,a,r.path,[l,"key"])),value:s._parse(new Er(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};_l.create=(t,e,n)=>new _l({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var fl=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:O.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:O.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:O.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Er(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};fl.create=(t,e)=>new fl({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var Fg=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:O.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return Yd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),Zo].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:c}})}function o(a,c){return Yd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),Zo].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ei){let a=this;return Zt(async function(...c){let l=new vn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return Zt(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new vn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new vn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:So.create(e).rest(ts.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||So.create([]).rest(ts.create()),returns:n||ts.create(),typeName:Z.ZodFunction,...ie(r)})}},Ua=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ua.create=(t,e)=>new Ua({getter:t,typeName:Z.ZodLazy,...ie(e)});var wa=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:O.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};wa.create=(t,e)=>new wa({value:t,typeName:Z.ZodLiteral,...ie(e)});function e3(t,e){return new ka({values:t,typeName:Z.ZodEnum,...ie(e)})}var ka=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:O.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:O.invalid_enum_value,options:r}),Q}return Zt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ka.create=e3;var Ga=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:O.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:O.invalid_enum_value,options:o}),Q}return Zt(e.data)}get enum(){return this._def.values}};Ga.create=(t,e)=>new Ga({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var Ei=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:O.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return Zt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Ei.create=(t,e)=>new Ei({type:t,typeName:Z.ZodPromise,...ie(e)});var gr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?Oa(c.value):n.value==="dirty"?Oa(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?Oa(a.value):n.value==="dirty"?Oa(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mi(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>mi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};gr.create=(t,e,n)=>new gr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});gr.createWithPreprocess=(t,e,n)=>new gr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var Tr=class extends ce{_parse(e){return this._getType(e)===D.undefined?Zt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tr.create=(t,e)=>new Tr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Ao=class extends ce{_parse(e){return this._getType(e)===D.null?Zt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ao.create=(t,e)=>new Ao({innerType:t,typeName:Z.ZodNullable,...ie(e)});var Ba=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var ja=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ul(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var ml=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};ml.create=t=>new ml({typeName:Z.ZodNaN,...ie(t)});var NNe=Symbol("zod_brand"),Wd=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},zd=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),Oa(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},Ha=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(mi(o)&&(o.value=Object.freeze(o.value)),o);return ul(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function Q4(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function t3(t,e={},n){return t?Ti.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Q4(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Q4(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ti.create()}var ONe={object:Ln.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var bNe=(t,e={message:`Input not instance of ${t.name}`})=>t3(n=>n instanceof t,e),n3=hi.create,r3=ba.create,CNe=ml.create,PNe=Ca.create,o3=Pa.create,MNe=Ma.create,xNe=pl.create,vNe=xa.create,LNe=va.create,DNe=Ti.create,UNe=ts.create,wNe=Br.create,kNe=dl.create,GNe=ns.create,BNe=Ln.create,jNe=Ln.strictCreate,HNe=La.create,FNe=jg.create,VNe=Da.create,qNe=So.create,$Ne=Hg.create,YNe=_l.create,WNe=fl.create,zNe=Fg.create,KNe=Ua.create,QNe=wa.create,XNe=ka.create,JNe=Ga.create,ZNe=Ei.create,eOe=gr.create,tOe=Tr.create,nOe=Ao.create,rOe=gr.createWithPreprocess,oOe=zd.create,sOe=()=>n3().optional(),iOe=()=>r3().optional(),aOe=()=>o3().optional(),cOe={string:t=>hi.create({...t,coerce:!0}),number:t=>ba.create({...t,coerce:!0}),boolean:t=>Pa.create({...t,coerce:!0}),bigint:t=>Ca.create({...t,coerce:!0}),date:t=>Ma.create({...t,coerce:!0})};var uOe=Q;var lOe=t=>typeof t?.safeParse=="function";var iC=t=>typeof t?.passthrough=="function";var pOe=(t,e)=>iC(t)?iC(e)?t.merge(e):t:iC(e)?e:Object.assign({},t,e);var LJe=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),dOe=Symbol("ContractNoBody"),i3=t=>"method"in t&&"path"in t;var a3=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return i3(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:pOe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,a3(r,e)]})),aC=Symbol("ContractPlainType"),Sr=()=>({router:(t,e)=>a3(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>aC,body:()=>aC,type:()=>aC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>dOe}),_Oe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},fOe=(t,e=!1)=>{let n=e?mOe(t):hOe(t);return n?.length>0?"?"+n:""},mOe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",hOe=t=>t?Object.keys(t).flatMap(e=>cC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",cC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>cC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>cC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var uC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var TOe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&lOe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},EOe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},s3=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),gOe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||TOe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&s3(p),...s3(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:EOe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},SOe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:AOe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},AOe=(t,e,n,r,o)=>{let s=_Oe({path:r.path,params:n}),i=fOe(t,o);return`${e}${s}${i}`},ROe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=SOe(t,e,r),s=await gOe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new uC(s,n)}},lC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>i3(r)?[n,ROe(r,e)]:[n,lC(r,e)]));var pC=["free","creator","team"],c3=typeof process<"u"&&process.env?.NODE_ENV!=="production",yOe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:c3?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:c3?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var u3=yOe.stripe.plans,UJe=Object.freeze(Object.fromEntries(u3.map(t=>[t.tier,t])));var IOe=Sr(),en=u.object({message:u.string()}),dC=u.record(u.unknown()),Fa=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),Vg=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),NOe=["active","archived"],qg=u.enum(NOe),l3=u.object({id:u.string().min(1),display_name:u.string().min(1)}),p3=u.object({id:Vg,name:u.string().min(1)}),_C=u.object({id:Fa,title:u.string().min(1),status:qg,author:l3,project:p3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),OOe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(_C)}),bOe=u.object({project_id:Vg.optional(),status:qg.optional()}),COe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:dC.optional(),project_id:Vg.nullable().optional()}),POe=u.object({id:Fa,created_at:u.string().datetime()}),MOe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:dC.optional(),project_id:Vg.nullable().optional(),status:qg.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),xOe=u.object({id:Fa,updated_at:u.string().datetime()}),vOe=u.object({id:Fa,title:u.string().min(1),prosemirror_json:dC,status:qg,author:l3,project:p3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),d3=IOe.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:bOe,responses:{200:OOe,401:en,403:en},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:COe,responses:{201:POe,401:en,403:en,404:en,422:en},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:vOe,401:en,403:en,404:en},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:MOe,responses:{200:xOe,401:en,403:en,404:en,422:en},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:en,403:en,404:en},summary:"Hard-delete a doc and any mention references it owns"}});var LOe=Sr(),et=u.object({message:u.string()}),fC=u.record(u.unknown()),Ro=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),DOe=["active","archived"],$g=u.enum(DOe),mC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),_3=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:mC}),UOe=u.object({id:Ro,name:u.string().min(1),status:$g,author:mC,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),wOe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(UOe)}),kOe=u.object({status:$g.optional()}),GOe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:fC.optional()}),BOe=u.object({id:Ro,created_at:u.string().datetime()}),jOe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:fC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),HOe=u.object({id:Ro,updated_at:u.string().datetime()}),FOe=u.object({archived:u.boolean()}),VOe=u.object({id:Ro,status:$g,archived_at:u.string().datetime().nullable()}),qOe=u.object({id:Ro,name:u.string().min(1),prosemirror_json:fC,status:$g,author:mC,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(_3),docs:u.array(_C)}),$Oe=u.object({thread_id:u.string().min(1).max(64)}),YOe=_3,f3=LOe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:kOe,responses:{200:wOe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:GOe,responses:{201:BOe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:Ro}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:qOe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:Ro}),headers:u.object({authorization:u.string().min(1).optional()}),body:jOe,responses:{200:HOe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:Ro}),headers:u.object({authorization:u.string().min(1).optional()}),body:FOe,responses:{200:VOe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:Ro}),headers:u.object({authorization:u.string().min(1).optional()}),body:$Oe,responses:{201:YOe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:Ro,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var WOe=Sr(),Yg=u.object({message:u.string()}),zOe=["thread","plan","doc","user"],Wg=u.enum(zOe),KOe=["doc","project"],QOe=u.enum(KOe),XOe=u.object({kind:Wg,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),JOe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(XOe)}),ZOe=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(Wg).optional())}),ebe=u.object({source_kind:QOe,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:Wg,target_id:u.string().min(1),created_at:u.string().datetime()}),tbe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(ebe)}),nbe=u.object({target_kind:Wg,target_id:u.string().min(1).max(64)}),m3=WOe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:ZOe,responses:{200:JOe,401:Yg,422:Yg},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:nbe,responses:{200:tbe,401:Yg,403:Yg},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var rbe=Sr(),obe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),gi=u.object({message:u.string()}),h3=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),sbe=u.object({before:u.string().min(1).max(64).optional()}),T3=rbe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:h3,401:gi,403:gi,404:gi},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:h3,401:gi,403:gi,404:gi},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:sbe,responses:{200:obe,401:gi,403:gi},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var ibe=Sr(),hC=u.object({message:u.string()}),abe=u.object({id:u.string().min(1),title:u.string(),href:u.string().min(1),author_display_name:u.string().nullable(),author_handle:u.string().nullable()}),cbe=u.object({name:u.string().min(1),usage_count:u.number().int().nonnegative(),href:u.string().min(1)}),ube=u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),href:u.string().min(1)}),lbe=u.object({type:u.literal("global_search"),threads:u.array(abe),skills:u.array(cbe),people:u.array(ube)}),pbe=u.object({q:u.string().trim().min(1).max(80)}),E3=ibe.router({globalSearch:{method:"GET",path:"/search",headers:u.object({authorization:u.string().min(1).optional()}),query:pbe,responses:{200:lbe,401:hC,403:hC,422:hC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var dbe=Sr(),_be=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),fbe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),E5e=fbe.extend({messages:u.array(_be)}),A=u.object({message:u.string()}),mbe=/^[a-zA-Z0-9_-]{2,32}$/,O3=u.string().regex(mbe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),TC=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),hbe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:TC,is_admin:u.boolean()}),Tbe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:O3.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),Ebe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),b3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),gbe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(Ebe)}),Sbe=u.object({email_address:u.string().email()}),Abe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),Rbe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),ybe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),Ibe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),Nbe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),Obe=u.object({user:Ibe,organization:Nbe}),bbe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),Cbe=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(bbe)}),C3=u.string().regex(/^th_[0-9A-Za-z]{22}$/),Kg=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),Pbe=u.object({id:C3,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:Kg,revision_count:u.number().int().positive()}),Mbe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),xbe=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:Mbe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),vbe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(xbe)}),Lbe=u.object({thread_block_id:Kg,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),Dbe=u.object({id:u.string().min(1)}),Ube=u.object({content:u.string().trim().min(1)}),wbe=u.object({id:u.string().min(1)}),kbe=u.object({content:u.string().trim().min(1)}),Gbe=u.object({id:u.string().min(1)}),Bbe=u.object({content:u.string().trim().min(1)}),jbe=u.object({id:u.string().min(1)}),Hbe=u.object({resolved:u.boolean()}),Fbe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),Vbe=u.object({resolved:u.boolean()}),qbe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),P3=u.record(u.unknown()),$be=u.object({id:Kg,body:u.string(),created_at:u.string().datetime(),prosemirror_json:P3,comment_threads:u.array(vbe)}),Ybe=u.object({id:C3,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:Kg,revision_count:u.number().int().positive(),revisions:u.array($be)}),Wbe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(Pbe)}),zbe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),M3=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),Kbe=u.array(M3),Qbe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(M3)}),Xbe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),Jbe=u.enum(["thread","building_block"]),Zbe=u.object({repo_origin_path:u.string().min(1),sources:u.array(Jbe).nonempty()}),eCe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(Zbe)}),Si=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),tCe=["transcript","plan"],nCe=u.enum(tCe),rCe=u.object({md5:u.string().min(1),harness:Si,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:nCe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),gC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),oCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),x3=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:oCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),v3=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),sCe=v3.extend({comments:u.array(x3)}),Kd=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(sCe).optional()}).passthrough(),L3=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(Kd)}),g3=Kd.extend({type:u.literal("plan"),prosemirror_json:P3,thread_file_id:u.string().min(1)}),iCe=u.union([u.literal(-1),u.literal(1)]),D3=u.union([u.literal(-1),u.literal(0),u.literal(1)]),S3=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:D3}),aCe=u.object({value:iCe}),cCe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),Va=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:cCe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),uCe=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(Va)}),lCe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),pCe=Va,dCe=u.object({content:u.string().trim().min(1).max(4e3)}),_Ce=Va,fCe=Va,g5e=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va})]),mCe=u.enum(["pending","generating","ready","failed"]),hCe=u.enum(["pending","generating","ready","failed"]),TCe=u.enum(["pending","placeholder","ai","user"]),U3=u.enum(["pending","generating","ready","failed"]),SC=u.enum(["pending","generating","ready","failed","disabled"]),w3=u.enum(["pending","generating","ready","failed"]),ECe=u.object({title:u.string().min(1),body:u.string().min(1),files:u.array(u.string()).optional()}),gCe=u.object({status:SC,url:u.string().nullable(),url_expires_at:u.string().nullable(),generated_at:u.string().nullable(),model:u.string().nullable()}),SCe=u.object({status:w3,steps:u.array(ECe),generated_at:u.string().nullable()}),ACe=u.object({remix_of_thread_id:u.string().nullable(),remix_count:u.number().int().nonnegative()}),RCe=u.object({cover:gCe,how_to:SCe,lineage:ACe}),yCe=u.object({id:u.string().min(1),title:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable()}),cover:u.object({url:u.string(),url_expires_at:u.string()}),remix_count:u.number().int().nonnegative(),started_at:u.string(),cover_generated_at:u.string()}),ICe=u.object({type:u.literal("list"),list_type:u.literal("card_feed_item"),has_more:u.boolean(),objects:u.array(yCe)}),NCe=u.enum(["asked","requested","decided","corrected","shared"]),OCe=u.object({id:u.string().min(1),kind:NCe,summary:u.string().min(1),block_id:u.string().min(1)}),bCe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:U3,generated_at:u.string().nullable(),objects:u.array(OCe)}),hl=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:gC,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:L3,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:Si,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:mCe,summary_generated_at:u.string().nullable(),title_status:hCe,title_generated_at:u.string().nullable(),title_source:TCe,decisions_status:U3,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:D3,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean(),card:RCe}),CCe=u.object({storage_url:u.string().min(1)}),PCe=u.object({storage_url:u.string(),harness:Si,thread:hl.nullable()}),MCe=u.object({status:u.literal("complete"),thread_files:u.array(PCe)}),xCe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:Si,expected_md5:u.string(),error:u.string().nullable(),thread:hl.nullable()}),vCe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(xCe)}),LCe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),DCe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:Si})]),UCe=hl,A3=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(UCe)}),wCe=u.enum(["recent","popular"]),kCe=hl,GCe=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(kCe)}),BCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:wCe.optional(),harness:Si.optional(),search:u.string().max(200).optional()}),jCe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(Si,u.number().int().nonnegative())}),HCe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),FCe=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(HCe)}),VCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),qCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),$Ce=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),YCe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),WCe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(YCe)}),zCe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:gC,skills_invoked:u.array(u.string())}),KCe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(zCe)}),QCe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),XCe=u.enum(["text_edit","redact","delete_block"]),JCe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:XCe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),ZCe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(JCe)}),ePe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),tPe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),nPe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(tPe)}),k3=u.object({id:u.string(),name:u.string()}),rPe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(k3)}),oPe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(rPe)}),sPe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:Si,author:gC,organization:k3}),iPe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(sPe)}),aPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),R3=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),cPe=u.object({visitor:u.string().min(1).max(64).optional()}),uPe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),lPe=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array(uPe)}),pPe=u.object({windows:u.array(lPe)}),dPe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),_Pe=v3,fPe=x3.extend({comment_thread_id:u.string().min(1)}),mPe=u.object({markdown:u.string().min(1)}),hPe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:g3,critiqued_plan_block:g3,annotations:u.array(dPe),comment_threads:u.array(_Pe),comments:u.array(fPe)}),Tl=u.enum(pC),G3=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),EC=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:G3}),TPe=u.object({effective_plan:Tl,features:G3,user:EC,organization:EC.nullable()}),EPe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),gPe=u.object({checkout_url:u.string().min(1)}),SPe=u.object({portal_url:u.string().min(1)}),APe=u.object({seat_quantity:u.number().int().positive()}),y3=u.object({plan:Tl.nullable()}),zg=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),RPe=u.object({users:u.array(zg),organizations:u.array(zg)}),yPe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),IPe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:yPe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),NPe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(IPe)}),OPe=u.object({thread_id:u.string().min(1)}),bPe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),CPe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),PPe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),B3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),I3=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(B3)}),MPe=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),xPe=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(MPe)}),vPe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),LPe=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),DPe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),UPe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:B3}),wPe=u.discriminatedUnion("type",[vPe,LPe,DPe,UPe]),kPe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(wPe)}),GPe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),BPe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(GPe)}),N3=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),jPe=u.enum(["avatar","banner"]),j3=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),HPe=u.object({kind:jPe,content_type:j3,base64_data:u.string().min(1)}),FPe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),VPe=u.object({content_type:j3,base64_data:u.string().min(1)}),qPe=u.object({cover_status:SC,cover_url:u.string().min(1),cover_url_expires_at:u.string().min(1),cover_generated_at:u.string().min(1)}),$Pe=b3,H3=dbe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:hbe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:OPe,responses:{200:bPe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:NPe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:qCe,responses:{200:A3,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:hl,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:A3,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:VCe,responses:{200:L3,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Ube,responses:{201:wbe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Bbe,responses:{201:jbe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Vbe,responses:{200:qbe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:WCe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:KCe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:$Ce,responses:{200:Kd,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:QCe,responses:{200:Kd,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:Kd,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:ZCe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:bCe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:LCe,responses:{200:hl,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:u.object({cover_status:SC,how_to_status:w3}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:u.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},uploadThreadCover:{method:"POST",path:"/threads/:id/card/cover/upload",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:VPe,responses:{200:qPe,401:A,403:A,404:A,413:A,422:A},summary:"Upload a custom cover image for a thread. Author or Tanagram admin only. Bytes go to the same storage substrate the AI cover uses (S3 in prod, filesystem in dev), and the threads row is updated atomically with the new cover_storage_url, cover_status='ready', cover_generated_at=now, cover_model='user-uploaded' so subsequent re-rolls / how-to fan-outs treat the upload like any other ready cover."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:aCe,responses:{200:S3,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:S3,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:uCe,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:lCe,responses:{201:pCe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:dCe,responses:{200:_Ce,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:fCe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:DCe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:Obe,responses:{201:TC,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:b3,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:Tbe,responses:{200:TC,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:O3}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:$Pe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:kPe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:xPe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:I3,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:I3,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:CPe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:PPe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:BPe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:N3,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:N3,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:HPe,responses:{200:FPe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:gbe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:Sbe,responses:{201:Abe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:eCe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:Cbe,responses:{201:Kbe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Ybe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Lbe,responses:{201:Dbe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:kbe,responses:{201:Gbe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Hbe,responses:{200:Fbe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:zbe,responses:{200:Wbe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:Xbe,responses:{200:Qbe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:FCe,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(rCe).nonempty()}),responses:{201:vCe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(CCe).nonempty()}),responses:{200:MCe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:ePe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:nPe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:oPe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:aPe,responses:{200:iPe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listCardFeed:{method:"GET",path:"/cards/feed",query:u.object({limit:u.coerce.number().int().min(1).max(48).optional()}),responses:{200:ICe},summary:"Slim feed of public threads with a ready cover image, ordered by cover_generated_at descending. Powers the landing-page UGC card scroll. Returns presigned cover URLs inline so the grid renders without a follow-up round trip per card."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:BCe,responses:{200:GCe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:jCe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:Rbe,responses:{201:ybe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:R3,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:cPe,responses:{200:R3,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:pPe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:mPe,responses:{200:hPe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:TPe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:EPe,responses:{200:gPe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:SPe,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:APe,responses:{200:EC,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:RPe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:y3,responses:{200:zg,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:y3,responses:{200:zg,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:f3,docs:d3,mentions:m3,favorites:T3,search:E3},{pathPrefix:"/api"});import t_ from"node:fs";import V3 from"node:path";import F3 from"node:os";import qa from"node:path";function rs(){let t=Mt()==="dev"?".lore-dev":".lore";return qa.join(F3.homedir(),t)}function Qd(){return qa.join(rs(),"log.txt")}function AC(){return qa.join(rs(),"sync_state.json")}function Qg(){return qa.join(rs(),"status.json")}function Xd(){return qa.join(rs(),"install_source.json")}function Jd(){return qa.join(rs(),"bin","lore")}function Zd(){let t=Mt();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function e_(){return qa.join(F3.homedir(),"Library","LaunchAgents",`${Zd()}.plist`)}function Xg(){return V3.join(rs(),"token")}function RC(){let t;try{t=t_.readFileSync(Xg(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||WPe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function Jg(){return RC().token}function q3(){return t_.existsSync(Xg())}function $3(t){let e=Xg();t_.mkdirSync(V3.dirname(e),{recursive:!0,mode:448}),t_.writeFileSync(e,t,{mode:384})}function Y3(){try{t_.rmSync(Xg())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function YPe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function WPe(t,e){let n;try{n=YPe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var zPe={dev:"http://localhost:4000",prod:"https://lore-api.tanagram.ai"};function Ai(t={}){let e=t.token??Jg();return lC(H3,{baseUrl:zPe[Mt()],baseHeaders:{"User-Agent":F4(),...e?{authorization:`Bearer ${e}`}:{}}})}import z3 from"node:fs";var W3=null;function KPe(){let t=rs();W3!==t&&(z3.mkdirSync(t,{recursive:!0}),W3=t)}function QPe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function XPe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
|
|
41
|
+
`;let o=Object.entries(n).map(([s,i])=>`${s}=${QPe(i)}`).join(" ");return o?`${r} ${o}
|
|
42
42
|
`:`${r}
|
|
43
|
-
`}function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
`}function yC(t,e,n){let r=XPe(t,e,n);KPe(),z3.appendFileSync(Qd(),r),Mt()==="dev"&&process.stderr.write(r)}var tn={info(t,e){yC("info",t,e)},warn(t,e){yC("warn",t,e)},error(t,e){yC("error",t,e)}};var JPe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function K3(){return JPe[Mt()]}var tMe=5*60*1e3;function nMe(){return X3.randomBytes(32).toString("base64url")}function rMe(t){return X3.createHash("sha256").update(t).digest("base64url")}function oMe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function sMe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Q3(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
|
|
44
|
+
<html><head><meta charset="utf-8"><title>Lore CLI</title></head>
|
|
45
|
+
<body style="font-family:system-ui;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;background:#fafafa">
|
|
46
|
+
<div style="text-align:center;max-width:400px;padding:40px;border:1px solid #e0e0e0;border-radius:10px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,0.1)">
|
|
47
|
+
<div style="font-size:48px;margin-bottom:20px">${r?"\u2713":"\u2717"}</div>
|
|
48
|
+
<h1 style="margin:0 0 10px">${r?"Authorization Complete":"Authorization Cancelled"}</h1>
|
|
49
|
+
<p style="color:#666">${r?"You can close this window now.":sMe(n??"Authorization was cancelled.")}</p>
|
|
50
|
+
<p style="color:#999;font-size:14px">You can close this tab and return to your terminal.</p>
|
|
51
|
+
</div></body></html>`)}async function iMe(){let t,e=new Promise(s=>{t=s}),n=eMe.createServer((s,i)=>{let a=new URL(s.url??"/","http://127.0.0.1");if(a.pathname!=="/callback"){i.writeHead(404),i.end();return}let c=a.searchParams.get("error");if(c){let p=a.searchParams.get("error_description")||c;Q3(i,"error",p),t?.({type:"error",description:p});return}let l=a.searchParams.get("code");if(l){Q3(i,"success"),t?.({type:"code",code:l});return}i.writeHead(400),i.end()});return await new Promise((s,i)=>{n.once("error",i),n.listen(0,"127.0.0.1",()=>{n.off("error",i),s()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(s){return new Promise((i,a)=>{let c=setTimeout(()=>{a(new Error("authorization timed out"))},s);e.then(l=>{clearTimeout(c),i(l)})})},close(){return new Promise((s,i)=>{n.close(a=>{if(a){i(a);return}s()})})}}}async function aMe(t){let{command:e,args:n}=cMe(process.platform,t);await new Promise((r,o)=>{let s=ZPe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function cMe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function uMe(t){if(RC().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function lMe({client:t=Ai(),openBrowser:e=aMe,setAccessToken:n=$3,webBaseURL:r=K3(),timeoutMs:o=tMe}={}){if(await uMe(t)){console.log(`
|
|
52
|
+
Already logged in. Use 'lore logout' if you want to sign out.
|
|
53
|
+
`);return}let s=nMe(),i=rMe(s),a=await iMe();try{let c=new URL("/cli-authorize",r);c.searchParams.set("redirect_uri",a.redirectURI),c.searchParams.set("code_challenge",i),c.searchParams.set("code_challenge_method","S256");try{await e(c.toString()),console.log(`
|
|
54
|
+
Opening browser to log in...`),console.log(`
|
|
55
|
+
If your browser didn't open, visit:`)}catch(d){tn.warn("open_browser_failed",{error:d instanceof Error?d.message:String(d)}),console.log(`
|
|
56
|
+
Visit this URL to log in:`)}console.log(` ${c.toString()}
|
|
57
|
+
`),console.log(" Waiting for authorization. Click Authorize in your browser...");let l=await a.waitForCallback(o);if(l.type==="error")throw console.log(`
|
|
58
|
+
Authorization denied: ${l.description}
|
|
59
|
+
`),new Error(l.description);let p=oMe(l.code);if(p.codeChallenge!==i)throw console.log(`
|
|
60
|
+
Authorization code verification failed.
|
|
61
|
+
`),new Error("PKCE challenge mismatch");n(p.sessionJwt),console.log(`
|
|
62
|
+
Logged in successfully.
|
|
63
|
+
`)}catch(c){throw c instanceof Error&&c.message==="authorization timed out"&&console.log(`
|
|
64
|
+
Authorization timed out. Please try again.
|
|
65
|
+
`),c}finally{await a.close()}}var J3={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){tn.info("command_start",{command:"login"}),await lMe({client:t?.client,openBrowser:t?.openBrowser,setAccessToken:t?.setAccessToken,webBaseURL:t?.webBaseURL,timeoutMs:t?.timeoutMs})}};var Z3={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){tn.info("command_start",{command:"logout"});let t=q3();if(Y3(),!t){console.log(`
|
|
66
|
+
Not currently logged in.
|
|
67
|
+
`);return}console.log(`
|
|
68
|
+
Logged out successfully.
|
|
69
|
+
`)}};var e9={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:t}){tn.info("command_start",{command:"whoami"});let n=await(t?.client??Ai()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var t9={meta:{name:"health",description:"Check API health"},async run({data:t}){tn.info("command_start",{command:"health"});let n=await(t?.client??Ai()).health();if(n.status===200){console.log(n.body.status);return}throw tn.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};import pMe from"node:fs/promises";var n9=100;async function dMe(t=Qd(),e=n9){let n;try{n=await pMe.readFile(t,"utf8")}catch(i){if(i.code==="ENOENT")return"";throw i}if(e<=0)return"";let r=n.split(`
|
|
70
|
+
`);r.at(-1)===""&&r.pop();let s=r.slice(-e).join(`
|
|
71
|
+
`);return s?`${s}
|
|
72
|
+
`:""}var r9={meta:{name:"logs",description:"Print recent log entries"},args:{lines:{type:"string",alias:"n",description:"Number of log entries to print",default:String(n9)}},async run({args:t}){let e=Number.parseInt(t.lines,10);if(!Number.isFinite(e)||e<0)throw new Error("--lines must be a non-negative integer");let n=await dMe(Qd(),e);n&&console.log(n.trimEnd())}};import{promises as Ri}from"node:fs";import _Me from"node:os";import $a from"node:path";import{fileURLToPath as o9}from"node:url";function IC(){return $a.join(_Me.homedir(),".claude","skills")}function s9(t){return t.map(e=>e.name).sort().join(", ")}function i9(t){return t[0]?$a.dirname(t[0].destination):IC()}async function fMe(t){try{return(await Ri.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function a9(){let t=[o9(new URL("../skills",import.meta.url)),o9(new URL("../../../skills",import.meta.url))];for(let e of t)if(await fMe(e))return e;throw new Error("bundled skills directory not found")}function mMe(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function hMe({destination:t=IC(),environment:e=Mt(),sourceDir:n}={}){let r=n??await a9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await Ri.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);if(await Ri.cp(l,p,{recursive:!0,force:!0}),s){let d=$a.join(p,"SKILL.md"),_=await Ri.readFile(d,"utf8");await Ri.writeFile(d,mMe(_,c))}i.push({name:c,source:l,destination:p})}return i}async function TMe({destination:t=IC(),environment:e=Mt(),sourceDir:n}={}){let r=n??await a9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);await Ri.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var c9={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await hMe({destination:t.destination});console.log(`installed skills ${s9(e)} to ${i9(e)}`)}},u9={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await TMe({destination:t.destination});console.log(`uninstalled skills ${s9(e)} from ${i9(e)}`)}};var l9={meta:{name:"version",description:"Print the Lore CLI version"},run(){console.log(fi())}};var EMe="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",gMe="https://phe.tanagram.ai/capture/",SMe=2e3;function p9(t){return process.env[t]??""}function AMe(t,e){let n=[t,e].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function d9({commandName:t,durationMs:e}){let n=p9("USER"),r=p9("HOST"),o=new AbortController,s=setTimeout(()=>o.abort(),SMe);try{await fetch(gMe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:EMe,event:"lore.cli.command_run",properties:{distinct_id:AMe(n,r),command_name:t,cli_version:fi(),duration_ms:Math.round(e),environment:Mt(),user:n,host:r}}),signal:o.signal})}catch(i){tn.warn("posthog_capture_failed",{command:t,error:i instanceof Error?i.message:String(i)})}finally{clearTimeout(s)}}import{execFile as BMe}from"node:child_process";import rn from"node:fs/promises";import jMe from"node:os";import yo from"node:path";import{promisify as HMe}from"node:util";import Zg from"node:fs/promises";import RMe from"node:path";var eS=class{status={};async markRunning(){let e=new Date().toISOString();this.status={pid:process.pid,state:"running",started_at:e,last_heartbeat_at:e},await this.persist()}async heartbeat(){this.status.pid=process.pid,this.status.last_heartbeat_at=new Date().toISOString(),await this.persist()}async markAuthenticated(){this.status.auth="logged_in",await this.heartbeat()}async markSyncSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],await this.persist()}async setPendingWatchers(e){this.status.pid=process.pid,this.status.state="running",this.status.pending_watchers=e.map(n=>({session_id:n.sessionId||void 0,project:n.project||void 0,transcript_path:n.transcriptPath||void 0,expires_at:n.expiresAt.toISOString()})),await this.heartbeat()}async markLoggedOut(){let e=new Date().toISOString();this.status.pid=process.pid,this.status.state="logged_out",this.status.auth="logged_out",this.status.last_heartbeat_at=e,this.status.last_completed_at=e,this.status.last_error=void 0,this.status.last_thread_ids=void 0,this.status.pending_watchers=void 0,await this.persist()}async markSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="idle",this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],this.status.pending_watchers=void 0,await this.persist()}async markError(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="error",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_error=e instanceof Error?e.message:String(e),this.status.pending_watchers=void 0,await this.persist()}async persist(){let e=Qg();await Zg.mkdir(RMe.dirname(e),{recursive:!0,mode:448}),await Zg.writeFile(e,`${JSON.stringify(yMe(this.status),null,2)}
|
|
73
|
+
`,{mode:384})}};async function _9(){try{return JSON.parse(await Zg.readFile(Qg(),"utf8"))}catch{return{}}}async function f9(){await Zg.rm(Qg(),{force:!0})}function yMe(t){return JSON.parse(JSON.stringify(t))}import El from"node:fs/promises";import nS from"node:os";import nn from"node:path";function yi(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}import IMe from"node:crypto";import n_ from"node:fs/promises";import NMe from"node:os";import tS from"node:path";async function os(t){try{let e=await n_.stat(t);return{exists:!0,size:e.size,modTimeUnixMs:e.mtime.getTime()}}catch(e){if(yi(e,"ENOENT"))return{exists:!1,size:0,modTimeUnixMs:0};throw e}}function NC(t,e){return t.exists!==e.exists?!0:t.exists?t.size!==e.size||t.modTimeUnixMs!==e.modTimeUnixMs:!1}async function OC(t){let e=await n_.mkdtemp(tS.join(NMe.tmpdir(),"lore-upload-")),n=tS.join(e,tS.basename(t));await n_.copyFile(t,n);let r=await n_.readFile(n);return{tempPath:n,md5:IMe.createHash("md5").update(r).digest("hex")}}async function m9(t){await n_.rm(tS.dirname(t),{recursive:!0,force:!0})}import h9 from"node:fs/promises";import r_ from"node:path";async function T9(t){let e=t.trim();if(!e)return null;for(;;){let n=r_.join(e,".git","config");try{return await h9.stat(n),n}catch{let r=r_.dirname(e);if(r===e)return null;e=r}}}async function E9(t){let e=await T9(t);return e?r_.dirname(r_.dirname(e)):null}async function g9(t){let e=await T9(r_.resolve(t.trim()));if(!e)return"";let n;try{n=await h9.readFile(e,"utf8")}catch{return""}let r=OMe(n),o=bMe(r);return o?`${o.owner}/${o.name}`:""}function OMe(t){let e=!1;for(let n of t.split(`
|
|
74
|
+
`)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith(";"))continue;if(r.startsWith("[")&&r.endsWith("]")){e=r==='[remote "origin"]';continue}if(!e)continue;let o=r.indexOf("=");if(!(o<0)&&r.slice(0,o).trim()==="url")return r.slice(o+1).trim()}return""}function bMe(t){let e=t.trim();if(!e)return null;let n="",r=/^(?:ssh:\/\/)?git@[^/:]+[:/](.+)$/.exec(e);if(r)n=r[1]??"";else try{n=new URL(e).pathname.replace(/^\/+/,"")}catch{n=e}n=n.replace(/\.git$/,"").replace(/^\/+|\/+$/g,"");let o=n.split("/").filter(Boolean);if(o.length<2)return null;let[s,i]=o.slice(-2);return!s||!i?null:{owner:s,name:i}}var CMe=60*60*1e3,CC=Symbol("missingSessionID"),R9={name:"claudeCode",historyFilePath:o_,readUnuploadedEntries:y9,collectLocalFiles:MMe,buildPendingTranscriptWatches:xMe};function o_(){return nn.join(nS.homedir(),".claude","history.jsonl")}async function y9(t){let e=o_(),n;try{n=await El.readFile(e,"utf8")}catch(r){if(yi(r,"ENOENT"))return[];throw r}return PMe(n,t)}function PMe(t,e,n=o_()){let r=[],o=t.split(`
|
|
75
|
+
`);for(let i=0;i<o.length;i+=1){let a=o[i]?.trim();if(!a)continue;let c;try{c=JSON.parse(a)}catch(l){S9({historyPath:n,lineNumber:i+1,line:a,reason:"unparseable_json",error:l});continue}if(!GMe(c)){S9({historyPath:n,lineNumber:i+1,line:a,reason:"invalid_history_entry"});continue}r.push(c)}let s=r.findIndex(i=>i.timestamp>=e);return s>=0?r.slice(s):[]}function S9({historyPath:t,lineNumber:e,line:n,reason:r,error:o}){tn.warn("claude_history_entry_skipped",{history_path:t,line_number:e,history_line:n,reason:r,...o?{error:o instanceof Error?o.message:String(o)}:{}})}async function MMe(t){let e=[],n=new Array(t.length),r=new Set,o=new Set,s=[];try{for(let i=0;i<t.length;i+=1){let a=t[i],c=await I9(a);if(c===CC){let m=`__missing_session__:${a.project}:${a.timestamp}:${i}`;n[i]=m,r.add(m),o.add(m);continue}if(n[i]=c.key,o.has(c.key))continue;let l=await os(c.fullPath),p;try{p=await OC(c.fullPath)}catch(m){if(yi(m,"ENOENT")){r.add(c.key),o.add(c.key);continue}throw new Error(`read session transcript ${c.fullPath}: ${String(m)}`)}s.push(p.tempPath);let d=await g9(a.project);e.push({key:c.key,filename:c.relativeFilename,sourcePath:c.fullPath,repoOriginPath:d,tempPath:p.tempPath,md5:p.md5,fileType:"transcript",harness:"claudeCode",harnessInternalId:a.sessionId?.trim()??"",watchedState:l}),o.add(c.key);let _=await El.readFile(p.tempPath,"utf8"),f=wMe(_);for(let m of f){let h;try{h=await kMe(m)}catch{continue}let T=`${c.key}::plan:${h}`;if(o.has(T))continue;let g=await os(h),R;try{R=await OC(h)}catch(I){if(yi(I,"ENOENT"))continue;throw new Error(`read plan file ${h}: ${String(I)}`)}s.push(R.tempPath),e.push({key:T,filename:h,sourcePath:h,repoOriginPath:d,tempPath:R.tempPath,md5:R.md5,fileType:"plan",harness:"claudeCode",harnessInternalId:h,watchedState:g}),o.add(T)}}}catch(i){throw await Promise.all(s.map(a=>El.rm(nn.dirname(a),{recursive:!0,force:!0}))),i}return{entries:t,localFiles:e,entryFileKeys:n,skippedFileKeys:r}}async function xMe(t,e){let n=await y9(t),r=Date.now(),o=[],s=new Set;for(let i of n){let a=await I9(i);if(a===CC||s.has(a.fullPath))continue;let c=await os(a.fullPath);c.exists&&(o.push({sessionId:i.sessionId?.trim()??"",project:i.project,transcriptPath:a.fullPath,expiresAt:new Date(r+CMe),baseline:e.get(a.fullPath)??c}),s.add(a.fullPath))}return o.sort((i,a)=>i.transcriptPath.localeCompare(a.transcriptPath))}async function I9(t){let e=t.sessionId?.trim();if(!e)return CC;let n=DMe(),r=await vMe(t.project),o=null;for(let s of r){let i=LMe(s),a=nn.posix.join(i,`${e}.jsonl`),c=nn.join(n,...a.split("/")),l={fullPath:c,relativeFilename:a,key:a};o??=l;try{return await El.stat(c),l}catch(p){if(!yi(p,"ENOENT"))throw new Error(`stat session transcript ${c}: ${String(p)}`)}}if(!o)throw new Error("history entry is missing project path");return o}async function vMe(t){let e=nn.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");let n=[e],r=await E9(e);if(!r||r===e)return n;for(let o=nn.dirname(e);o!==e&&(n.push(o),o!==r);)e=o,o=nn.dirname(o);return n}function LMe(t){let e=nn.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");return e.split(nn.sep).join("-")}function DMe(){return nn.join(nS.homedir(),".claude","projects")}function UMe(){return nn.join(nS.homedir(),".claude","plans")}function wMe(t){let e=[],n=new Set;for(let r of t.split(`
|
|
76
|
+
`)){let o=r.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{break}if(s.type!=="assistant")continue;let i=s.message?.content;if(Array.isArray(i))for(let a of i){if(!bC(a)||a.type!=="tool_use"||a.name!=="ExitPlanMode"||!bC(a.input))continue;let c=a.input.planFilePath;if(typeof c!="string")continue;let l=c.trim();!l||n.has(l)||(e.push(l),n.add(l))}}return e}async function kMe(t){let e=t.trim();if(!e)throw new Error("plan file path is empty");let n=UMe(),r=n;try{r=await El.realpath(n)}catch{}if(e.startsWith("~/")&&(e=nn.join(nS.homedir(),e.slice(2))),!nn.isAbsolute(e))throw new Error(`plan file path must stay under ${n}`);if(e=nn.normalize(e),!A9(e,n))throw new Error(`plan file path must stay under ${n}`);try{let o=await El.realpath(e);if(!A9(o,r))throw new Error(`plan file path must resolve under ${n}`)}catch(o){if(!yi(o,"ENOENT"))throw o}return e}function A9(t,e){let n=nn.relative(e,t);return n===""||n!==".."&&!n.startsWith(`..${nn.sep}`)}function GMe(t){return bC(t)&&typeof t.timestamp=="number"&&typeof t.project=="string"}function bC(t){return t!==null&&typeof t=="object"}var FMe=HMe(BMe),VMe=2*60*1e3;async function MC(){vC();let t=await YMe(),e=await WMe(t);await XMe(t);let n=await $Me();return await b9(),await JMe(n),await ZMe(),{plistPath:n,binaryPath:e}}async function N9(){vC(),await b9(),await rn.rm(e_(),{force:!0}),await rn.rm(Jd(),{force:!0}),await rn.rm(Xd(),{force:!0}),await f9()}async function O9(){vC();let t=e_(),e=Jd(),n=yo.join(yo.dirname(Xd()),"status.json"),r=Xd(),o=await _9(),s=await C9(),i=await oxe(t),a=nxe(o,new Date),{health:c,healthy:l}=txe(i,s,o,a);return{label:Zd(),enabled:i,loaded:s.loaded,running:s.running,healthy:l,health:c,heartbeat_fresh:a,plist_path:t,binary_path:e,status_path:n,install_source_path:r,...Object.keys(o).length>0?{status:o}:{}}}async function qMe(){let t=Jd(),e=o_();return`<?xml version="1.0" encoding="UTF-8"?>
|
|
48
77
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
49
78
|
<plist version="1.0">
|
|
50
79
|
<dict>
|
|
51
80
|
<key>Label</key>
|
|
52
|
-
<string>${
|
|
81
|
+
<string>${rS(Zd())}</string>
|
|
53
82
|
<key>ProgramArguments</key>
|
|
54
83
|
<array>
|
|
55
|
-
<string>${
|
|
84
|
+
<string>${rS(t)}</string>
|
|
56
85
|
<string>_run_upload</string>
|
|
57
86
|
</array>
|
|
58
87
|
<key>RunAtLoad</key>
|
|
59
88
|
<true/>
|
|
60
89
|
<key>WatchPaths</key>
|
|
61
90
|
<array>
|
|
62
|
-
<string>${
|
|
91
|
+
<string>${rS(e)}</string>
|
|
63
92
|
</array>
|
|
64
93
|
<key>ProcessType</key>
|
|
65
94
|
<string>Background</string>
|
|
@@ -68,42 +97,16 @@ Url: ${_m(t)}`),!0}return!1}function Wce(t,e){return e?.length?cm(t).some(n=>Ts(
|
|
|
68
97
|
<key>EnvironmentVariables</key>
|
|
69
98
|
<dict>
|
|
70
99
|
<key>PATH</key>
|
|
71
|
-
<string>${
|
|
100
|
+
<string>${rS(rxe())}</string>
|
|
72
101
|
</dict>
|
|
73
102
|
</dict>
|
|
74
103
|
</plist>
|
|
75
|
-
`}async function
|
|
104
|
+
`}async function $Me(){let t=e_();return await rn.mkdir(yo.dirname(t),{recursive:!0,mode:493}),await rn.writeFile(t,await qMe(),{mode:420}),t}async function YMe(){let t=process.argv[1];if(!t)throw new Error("resolve current executable: missing process argv[1]");return rn.realpath(t)}async function WMe(t){let e=Jd();await rn.mkdir(yo.dirname(e),{recursive:!0,mode:448});let n=zMe(t);if(n.type==="write")return await rn.writeFile(e,n.contents,{mode:493}),await rn.chmod(e,493),e;if(await rn.realpath(e).catch(()=>"")!==t){let o=`${e}.tmp`;await rn.copyFile(t,o),await rn.chmod(o,493),await rn.rename(o,e)}return e}function zMe(t){return KMe(t)?{type:"write",contents:QMe(t)}:{type:"copy"}}function KMe(t){return t.endsWith(".ts")||t.endsWith(".tsx")}function QMe(t){let e=yo.dirname(yo.dirname(t)),n=yo.join(e,"node_modules",".bin","tsx");return`#!/bin/sh
|
|
76
105
|
set -eu
|
|
77
|
-
cd ${
|
|
78
|
-
exec ${
|
|
79
|
-
`}function
|
|
80
|
-
`,{mode:384})}async function
|
|
81
|
-
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function FS(...t){try{let e=await AOe("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(GOe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function DOe(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function UOe(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+ROe>=e.getTime()}function uC(){return`gui/${process.getuid?.()??SOe.userInfo().uid}`}function p3(){return`${uC()}/${zd()}`}function wOe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(So.delimiter)??[],...t].filter(Boolean))).join(So.delimiter)}async function kOe(t){try{return await tn.stat(t),!0}catch{return!1}}function HS(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function lC(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function d3(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function GOe(t){return t instanceof Error}var _3={meta:{name:"enable",description:"Install and start background uploads"},async run(){let{plistPath:t,binaryPath:e}=await cC();console.log("Lore background uploads enabled."),console.log(`LaunchAgent: ${t}`),console.log(`Stable binary: ${e}`)}},f3={meta:{name:"disable",description:"Stop and remove background uploads"},async run(){await a3(),console.log("Lore background uploads disabled.")}},m3={meta:{name:"restart",description:"Restart background uploads"},async run(){await cC(),console.log("Lore background uploads restarted.")}},h3={meta:{name:"status",description:"Show background upload status"},args:{json:{type:"boolean",description:"Output status as JSON"}},async run({args:t}){let e=await c3();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(`Lore: ${e.health}`),console.log(`Enabled: ${e.enabled}`),console.log(`Loaded: ${e.loaded}`),console.log(`Running: ${e.running}`),console.log(`Healthy: ${e.healthy}`),e.status?.last_heartbeat_at&&console.log(`Last heartbeat: ${e.status.last_heartbeat_at}`),e.status?.last_success_at&&console.log(`Last success: ${e.status.last_success_at}`),e.status?.last_error&&console.log(`Last error: ${e.status.last_error}`),console.log(`LaunchAgent: ${e.plist_path}`),console.log(`Stable binary: ${e.binary_path}`),console.log(`Status file: ${e.status_path}`)}};var u={};sg(u,{BRAND:()=>lNe,DIRTY:()=>ba,EMPTY_PATH:()=>FOe,INVALID:()=>Q,NEVER:()=>zNe,OK:()=>nn,ParseStatus:()=>Ft,Schema:()=>ce,ZodAny:()=>Ei,ZodArray:()=>os,ZodBigInt:()=>Pa,ZodBoolean:()=>Ma,ZodBranded:()=>e_,ZodCatch:()=>Ha,ZodDate:()=>xa,ZodDefault:()=>ja,ZodDiscriminatedUnion:()=>$S,ZodEffects:()=>Sr,ZodEnum:()=>Ga,ZodError:()=>vn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>WS,ZodIntersection:()=>Ua,ZodIssueCode:()=>N,ZodLazy:()=>wa,ZodLiteral:()=>ka,ZodMap:()=>fl,ZodNaN:()=>hl,ZodNativeEnum:()=>Ba,ZodNever:()=>Br,ZodNull:()=>La,ZodNullable:()=>Ro,ZodNumber:()=>Ca,ZodObject:()=>Ln,ZodOptional:()=>Tr,ZodParsedType:()=>D,ZodPipeline:()=>t_,ZodPromise:()=>Si,ZodReadonly:()=>Fa,ZodRecord:()=>YS,ZodSchema:()=>ce,ZodSet:()=>ml,ZodString:()=>Ti,ZodSymbol:()=>dl,ZodTransformer:()=>Sr,ZodTuple:()=>Ao,ZodType:()=>ce,ZodUndefined:()=>va,ZodUnion:()=>Da,ZodUnknown:()=>rs,ZodVoid:()=>_l,addIssueToContext:()=>M,any:()=>SNe,array:()=>yNe,bigint:()=>fNe,boolean:()=>b3,coerce:()=>WNe,custom:()=>I3,date:()=>mNe,datetimeRegex:()=>R3,defaultErrorMap:()=>ts,discriminatedUnion:()=>bNe,effect:()=>BNe,enum:()=>wNe,function:()=>LNe,getErrorMap:()=>ul,getParsedType:()=>go,instanceof:()=>dNe,intersection:()=>CNe,isAborted:()=>VS,isAsync:()=>ll,isDirty:()=>qS,isValid:()=>hi,late:()=>pNe,lazy:()=>DNe,literal:()=>UNe,makeIssue:()=>Zd,map:()=>xNe,nan:()=>_Ne,nativeEnum:()=>kNe,never:()=>ANe,null:()=>ENe,nullable:()=>HNe,number:()=>N3,object:()=>INe,objectUtil:()=>pC,oboolean:()=>YNe,onumber:()=>$Ne,optional:()=>jNe,ostring:()=>qNe,pipeline:()=>VNe,preprocess:()=>FNe,promise:()=>GNe,quotelessJson:()=>BOe,record:()=>MNe,set:()=>vNe,setErrorMap:()=>HOe,strictObject:()=>ONe,string:()=>O3,symbol:()=>hNe,transformer:()=>BNe,tuple:()=>PNe,undefined:()=>TNe,union:()=>NNe,unknown:()=>gNe,util:()=>de,void:()=>RNe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var pC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(pC||(pC={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var N=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),BOe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),vn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};vn.create=t=>new vn(t);var jOe=(t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},ts=jOe;var T3=ts;function HOe(t){T3=t}function ul(){return T3}var Zd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},FOe=[];function M(t,e){let n=ul(),r=Zd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ts?void 0:ts].filter(o=>!!o)});t.common.issues.push(r)}var Ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),ba=t=>({status:"dirty",value:t}),nn=t=>({status:"valid",value:t}),VS=t=>t.status==="aborted",qS=t=>t.status==="dirty",hi=t=>t.status==="valid",ll=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Er=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},E3=(t,e)=>{if(hi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new vn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ft,ctx:{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ll(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return E3(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return hi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>hi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ll(o)?o:Promise.resolve(o));return E3(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:N.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Tr.create(this,this._def)}nullable(){return Ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Si.create(this,this._def)}or(e){return Da.create([this,e],this._def)}and(e){return Ua.create(this,e,this._def)}transform(e){return new Sr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ja({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new e_({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Ha({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return t_.create(this,e)}readonly(){return Fa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},VOe=/^c[^\s-]{8,}$/i,qOe=/^[0-9a-z]+$/,$Oe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,YOe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,WOe=/^[a-z0-9_-]{21}$/i,zOe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,KOe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,QOe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XOe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dC,JOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,eNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nNe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rNe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",oNe=new RegExp(`^${g3}$`);function A3(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function sNe(t){return new RegExp(`^${A3(t)}$`)}function R3(t){let e=`${g3}T${A3(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function iNe(t,e){return!!((e==="v4"||!e)&&JOe.test(t)||(e==="v6"||!e)&&eNe.test(t))}function aNe(t,e){if(!zOe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function cNe(t,e){return!!((e==="v4"||!e)&&ZOe.test(t)||(e==="v6"||!e)&&tNe.test(t))}var Ti=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ft,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")QOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")dC||(dC=new RegExp(XOe,"u")),dC.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")YOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")WOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")VOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")qOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")$Oe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:N.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:N.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?R3(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?oNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?sNe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?KOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?iNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?aNe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?cNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?nNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?rNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:N.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:N.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ti.create=t=>new Ti({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function uNe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Ca=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ft;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?uNe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ca.create=t=>new Ca({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Pa=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ft;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Pa.create=t=>new Pa({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Ma=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return nn(e.data)}};Ma.create=t=>new Ma({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var xa=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_date}),Q}let r=new Ft,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};xa.create=t=>new xa({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var dl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return nn(e.data)}};dl.create=t=>new dl({typeName:Z.ZodSymbol,...ie(t)});var va=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return nn(e.data)}};va.create=t=>new va({typeName:Z.ZodUndefined,...ie(t)});var La=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.null,received:r.parsedType}),Q}return nn(e.data)}};La.create=t=>new La({typeName:Z.ZodNull,...ie(t)});var Ei=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return nn(e.data)}};Ei.create=t=>new Ei({typeName:Z.ZodAny,...ie(t)});var rs=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nn(e.data)}};rs.create=t=>new rs({typeName:Z.ZodUnknown,...ie(t)});var Br=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.never,received:n.parsedType}),Q}};Br.create=t=>new Br({typeName:Z.ZodNever,...ie(t)});var _l=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.void,received:r.parsedType}),Q}return nn(e.data)}};_l.create=t=>new _l({typeName:Z.ZodVoid,...ie(t)});var os=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:N.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?N.too_big:N.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:N.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:N.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Er(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Er(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};os.create=(t,e)=>new os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function pl(t){if(t instanceof Ln){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Tr.create(pl(r))}return new Ln({...t._def,shape:()=>e})}else return t instanceof os?new os({...t._def,type:pl(t.element)}):t instanceof Tr?Tr.create(pl(t.unwrap())):t instanceof Ro?Ro.create(pl(t.unwrap())):t instanceof Ao?Ao.create(t.items.map(e=>pl(e))):t}var Ln=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:N.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Er(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Br){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:N.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Er(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ft.mergeObjectSync(r,l)):Ft.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return pl(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Tr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return y3(de.objectKeys(this.shape))}};Ln.create=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.strictCreate=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strict",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.lazycreate=(t,e)=>new Ln({shape:t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});var Da=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new vn(a.ctx.common.issues));return M(n,{code:N.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new vn(c));return M(n,{code:N.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};Da.create=(t,e)=>new Da({options:t,typeName:Z.ZodUnion,...ie(e)});var ns=t=>t instanceof wa?ns(t.schema):t instanceof Sr?ns(t.innerType()):t instanceof ka?[t.value]:t instanceof Ga?t.options:t instanceof Ba?de.objectValues(t.enum):t instanceof ja?ns(t._def.innerType):t instanceof va?[void 0]:t instanceof La?[null]:t instanceof Tr?[void 0,...ns(t.unwrap())]:t instanceof Ro?[null,...ns(t.unwrap())]:t instanceof e_||t instanceof Fa?ns(t.unwrap()):t instanceof Ha?ns(t._def.innerType):[],$S=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:N.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=ns(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function _C(t,e){let n=go(t),r=go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=_C(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=_C(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ua=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(VS(s)||VS(i))return Q;let a=_C(s.value,i.value);return a.valid?((qS(s)||qS(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:N.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ua.create=(t,e,n)=>new Ua({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var Ao=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:N.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Er(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ao.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ao({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var YS=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:N.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Er(r,a,r.path,a)),value:i._parse(new Er(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:Ti.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},fl=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:N.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Er(r,a,r.path,[l,"key"])),value:s._parse(new Er(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};fl.create=(t,e,n)=>new fl({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var ml=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:N.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:N.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:N.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Er(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};ml.create=(t,e)=>new ml({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var WS=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:N.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return Zd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ul(),ts].filter(l=>!!l),issueData:{code:N.invalid_arguments,argumentsError:c}})}function o(a,c){return Zd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ul(),ts].filter(l=>!!l),issueData:{code:N.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Si){let a=this;return nn(async function(...c){let l=new vn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return nn(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new vn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new vn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ao.create(e).rest(rs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Ao.create([]).rest(rs.create()),returns:n||rs.create(),typeName:Z.ZodFunction,...ie(r)})}},wa=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};wa.create=(t,e)=>new wa({getter:t,typeName:Z.ZodLazy,...ie(e)});var ka=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};ka.create=(t,e)=>new ka({value:t,typeName:Z.ZodLiteral,...ie(e)});function y3(t,e){return new Ga({values:t,typeName:Z.ZodEnum,...ie(e)})}var Ga=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:N.invalid_enum_value,options:r}),Q}return nn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ga.create=y3;var Ba=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:N.invalid_enum_value,options:o}),Q}return nn(e.data)}get enum(){return this._def.values}};Ba.create=(t,e)=>new Ba({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var Si=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:N.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return nn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Si.create=(t,e)=>new Si({type:t,typeName:Z.ZodPromise,...ie(e)});var Sr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?ba(c.value):n.value==="dirty"?ba(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?ba(a.value):n.value==="dirty"?ba(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hi(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>hi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};Sr.create=(t,e,n)=>new Sr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});Sr.createWithPreprocess=(t,e,n)=>new Sr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var Tr=class extends ce{_parse(e){return this._getType(e)===D.undefined?nn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tr.create=(t,e)=>new Tr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Ro=class extends ce{_parse(e){return this._getType(e)===D.null?nn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ro.create=(t,e)=>new Ro({innerType:t,typeName:Z.ZodNullable,...ie(e)});var ja=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var Ha=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ll(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var hl=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};hl.create=t=>new hl({typeName:Z.ZodNaN,...ie(t)});var lNe=Symbol("zod_brand"),e_=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},t_=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),ba(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},Fa=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(hi(o)&&(o.value=Object.freeze(o.value)),o);return ll(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function S3(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I3(t,e={},n){return t?Ei.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=S3(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=S3(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ei.create()}var pNe={object:Ln.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var dNe=(t,e={message:`Input not instance of ${t.name}`})=>I3(n=>n instanceof t,e),O3=Ti.create,N3=Ca.create,_Ne=hl.create,fNe=Pa.create,b3=Ma.create,mNe=xa.create,hNe=dl.create,TNe=va.create,ENe=La.create,SNe=Ei.create,gNe=rs.create,ANe=Br.create,RNe=_l.create,yNe=os.create,INe=Ln.create,ONe=Ln.strictCreate,NNe=Da.create,bNe=$S.create,CNe=Ua.create,PNe=Ao.create,MNe=YS.create,xNe=fl.create,vNe=ml.create,LNe=WS.create,DNe=wa.create,UNe=ka.create,wNe=Ga.create,kNe=Ba.create,GNe=Si.create,BNe=Sr.create,jNe=Tr.create,HNe=Ro.create,FNe=Sr.createWithPreprocess,VNe=t_.create,qNe=()=>O3().optional(),$Ne=()=>N3().optional(),YNe=()=>b3().optional(),WNe={string:t=>Ti.create({...t,coerce:!0}),number:t=>Ca.create({...t,coerce:!0}),boolean:t=>Ma.create({...t,coerce:!0}),bigint:t=>Pa.create({...t,coerce:!0}),date:t=>xa.create({...t,coerce:!0})};var zNe=Q;var KNe=t=>typeof t?.safeParse=="function";var fC=t=>typeof t?.passthrough=="function";var QNe=(t,e)=>fC(t)?fC(e)?t.merge(e):t:fC(e)?e:Object.assign({},t,e);var d5e=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),XNe=Symbol("ContractNoBody"),P3=t=>"method"in t&&"path"in t;var M3=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return P3(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:QNe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,M3(r,e)]})),mC=Symbol("ContractPlainType"),gr=()=>({router:(t,e)=>M3(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>mC,body:()=>mC,type:()=>mC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>XNe}),JNe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},ZNe=(t,e=!1)=>{let n=e?ebe(t):tbe(t);return n?.length>0?"?"+n:""},ebe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",tbe=t=>t?Object.keys(t).flatMap(e=>hC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",hC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>hC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>hC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var TC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var nbe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&KNe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},rbe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},C3=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),obe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||nbe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&C3(p),...C3(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:rbe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},sbe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:ibe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},ibe=(t,e,n,r,o)=>{let s=JNe({path:r.path,params:n}),i=ZNe(t,o);return`${e}${s}${i}`},abe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=sbe(t,e,r),s=await obe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new TC(s,n)}},EC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>P3(r)?[n,abe(r,e)]:[n,EC(r,e)]));var SC=["free","creator","team"],x3=typeof process<"u"&&process.env?.NODE_ENV!=="production",cbe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:x3?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:x3?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var v3=cbe.stripe.plans,f5e=Object.freeze(Object.fromEntries(v3.map(t=>[t.tier,t])));var ube=gr(),rn=u.object({message:u.string()}),gC=u.record(u.unknown()),Va=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),zS=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),lbe=["active","archived"],KS=u.enum(lbe),L3=u.object({id:u.string().min(1),display_name:u.string().min(1)}),D3=u.object({id:zS,name:u.string().min(1)}),AC=u.object({id:Va,title:u.string().min(1),status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),pbe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(AC)}),dbe=u.object({project_id:zS.optional(),status:KS.optional()}),_be=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional()}),fbe=u.object({id:Va,created_at:u.string().datetime()}),mbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional(),status:KS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),hbe=u.object({id:Va,updated_at:u.string().datetime()}),Tbe=u.object({id:Va,title:u.string().min(1),prosemirror_json:gC,status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),U3=ube.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:dbe,responses:{200:pbe,401:rn,403:rn},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:_be,responses:{201:fbe,401:rn,403:rn,404:rn,422:rn},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Tbe,401:rn,403:rn,404:rn},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),body:mbe,responses:{200:hbe,401:rn,403:rn,404:rn,422:rn},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:rn,403:rn,404:rn},summary:"Hard-delete a doc and any mention references it owns"}});var Ebe=gr(),et=u.object({message:u.string()}),RC=u.record(u.unknown()),yo=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),Sbe=["active","archived"],QS=u.enum(Sbe),yC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),w3=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:yC}),gbe=u.object({id:yo,name:u.string().min(1),status:QS,author:yC,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),Abe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(gbe)}),Rbe=u.object({status:QS.optional()}),ybe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:RC.optional()}),Ibe=u.object({id:yo,created_at:u.string().datetime()}),Obe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:RC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),Nbe=u.object({id:yo,updated_at:u.string().datetime()}),bbe=u.object({archived:u.boolean()}),Cbe=u.object({id:yo,status:QS,archived_at:u.string().datetime().nullable()}),Pbe=u.object({id:yo,name:u.string().min(1),prosemirror_json:RC,status:QS,author:yC,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(w3),docs:u.array(AC)}),Mbe=u.object({thread_id:u.string().min(1).max(64)}),xbe=w3,k3=Ebe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:Rbe,responses:{200:Abe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:ybe,responses:{201:Ibe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Pbe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Obe,responses:{200:Nbe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:bbe,responses:{200:Cbe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Mbe,responses:{201:xbe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:yo,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var vbe=gr(),XS=u.object({message:u.string()}),Lbe=["thread","plan","doc","user"],JS=u.enum(Lbe),Dbe=["doc","project"],Ube=u.enum(Dbe),wbe=u.object({kind:JS,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),kbe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(wbe)}),Gbe=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(JS).optional())}),Bbe=u.object({source_kind:Ube,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:JS,target_id:u.string().min(1),created_at:u.string().datetime()}),jbe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(Bbe)}),Hbe=u.object({target_kind:JS,target_id:u.string().min(1).max(64)}),G3=vbe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Gbe,responses:{200:kbe,401:XS,422:XS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:Hbe,responses:{200:jbe,401:XS,403:XS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var Fbe=gr(),Vbe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),gi=u.object({message:u.string()}),B3=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),qbe=u.object({before:u.string().min(1).max(64).optional()}),j3=Fbe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:B3,401:gi,403:gi,404:gi},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B3,401:gi,403:gi,404:gi},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:qbe,responses:{200:Vbe,401:gi,403:gi},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var $be=gr(),IC=u.object({message:u.string()}),Ybe=u.object({id:u.string().min(1),title:u.string(),href:u.string().min(1),author_display_name:u.string().nullable(),author_handle:u.string().nullable()}),Wbe=u.object({name:u.string().min(1),usage_count:u.number().int().nonnegative(),href:u.string().min(1)}),zbe=u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),href:u.string().min(1)}),Kbe=u.object({type:u.literal("global_search"),threads:u.array(Ybe),skills:u.array(Wbe),people:u.array(zbe)}),Qbe=u.object({q:u.string().trim().min(1).max(80)}),H3=$be.router({globalSearch:{method:"GET",path:"/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Qbe,responses:{200:Kbe,401:IC,403:IC,422:IC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var Xbe=gr(),Jbe=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),Zbe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),X5e=Zbe.extend({messages:u.array(Jbe)}),A=u.object({message:u.string()}),eCe=/^[a-zA-Z0-9_-]{2,32}$/,K3=u.string().regex(eCe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),OC=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),tCe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:OC,is_admin:u.boolean()}),nCe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:K3.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),rCe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),Q3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),oCe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(rCe)}),sCe=u.object({email_address:u.string().email()}),iCe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),aCe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),cCe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),uCe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),lCe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),pCe=u.object({user:uCe,organization:lCe}),dCe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),_Ce=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(dCe)}),X3=u.string().regex(/^th_[0-9A-Za-z]{22}$/),eg=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),fCe=u.object({id:X3,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:eg,revision_count:u.number().int().positive()}),mCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),hCe=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:mCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),TCe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(hCe)}),ECe=u.object({thread_block_id:eg,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),SCe=u.object({id:u.string().min(1)}),gCe=u.object({content:u.string().trim().min(1)}),ACe=u.object({id:u.string().min(1)}),RCe=u.object({content:u.string().trim().min(1)}),yCe=u.object({id:u.string().min(1)}),ICe=u.object({content:u.string().trim().min(1)}),OCe=u.object({id:u.string().min(1)}),NCe=u.object({resolved:u.boolean()}),bCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),CCe=u.object({resolved:u.boolean()}),PCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),J3=u.record(u.unknown()),MCe=u.object({id:eg,body:u.string(),created_at:u.string().datetime(),prosemirror_json:J3,comment_threads:u.array(TCe)}),xCe=u.object({id:X3,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:eg,revision_count:u.number().int().positive(),revisions:u.array(MCe)}),vCe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(fCe)}),LCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),Z3=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),DCe=u.array(Z3),UCe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(Z3)}),wCe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),kCe=u.enum(["thread","building_block"]),GCe=u.object({repo_origin_path:u.string().min(1),sources:u.array(kCe).nonempty()}),BCe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(GCe)}),Ai=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),jCe=["transcript","plan"],HCe=u.enum(jCe),FCe=u.object({md5:u.string().min(1),harness:Ai,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:HCe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),bC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),VCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),e9=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:VCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),t9=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),qCe=t9.extend({comments:u.array(e9)}),n_=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(qCe).optional()}).passthrough(),n9=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(n_)}),F3=n_.extend({type:u.literal("plan"),prosemirror_json:J3,thread_file_id:u.string().min(1)}),$Ce=u.union([u.literal(-1),u.literal(1)]),r9=u.union([u.literal(-1),u.literal(0),u.literal(1)]),V3=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9}),YCe=u.object({value:$Ce}),WCe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),qa=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:WCe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),zCe=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(qa)}),KCe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),QCe=qa,XCe=u.object({content:u.string().trim().min(1).max(4e3)}),JCe=qa,ZCe=qa,J5e=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa})]),ePe=u.enum(["pending","generating","ready","failed"]),tPe=u.enum(["pending","generating","ready","failed"]),nPe=u.enum(["pending","placeholder","ai","user"]),o9=u.enum(["pending","generating","ready","failed"]),s9=u.enum(["pending","generating","ready","failed","disabled"]),i9=u.enum(["pending","generating","ready","failed"]),rPe=u.object({title:u.string().min(1),body:u.string().min(1),files:u.array(u.string()).optional()}),oPe=u.object({status:s9,url:u.string().nullable(),url_expires_at:u.string().nullable(),generated_at:u.string().nullable(),model:u.string().nullable()}),sPe=u.object({status:i9,steps:u.array(rPe),generated_at:u.string().nullable()}),iPe=u.object({remix_of_thread_id:u.string().nullable(),remix_count:u.number().int().nonnegative()}),aPe=u.object({cover:oPe,how_to:sPe,lineage:iPe}),cPe=u.enum(["asked","requested","decided","corrected","shared"]),uPe=u.object({id:u.string().min(1),kind:cPe,summary:u.string().min(1),block_id:u.string().min(1)}),lPe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:o9,generated_at:u.string().nullable(),objects:u.array(uPe)}),Tl=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:bC,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:n9,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:Ai,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:ePe,summary_generated_at:u.string().nullable(),title_status:tPe,title_generated_at:u.string().nullable(),title_source:nPe,decisions_status:o9,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean(),card:aPe}),pPe=u.object({storage_url:u.string().min(1)}),dPe=u.object({storage_url:u.string(),harness:Ai,thread:Tl.nullable()}),_Pe=u.object({status:u.literal("complete"),thread_files:u.array(dPe)}),fPe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:Ai,expected_md5:u.string(),error:u.string().nullable(),thread:Tl.nullable()}),mPe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(fPe)}),hPe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),TPe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:Ai})]),EPe=Tl,q3=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(EPe)}),SPe=u.enum(["recent","popular"]),gPe=Tl,APe=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(gPe)}),RPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:SPe.optional(),harness:Ai.optional(),search:u.string().max(200).optional()}),yPe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(Ai,u.number().int().nonnegative())}),IPe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),OPe=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(IPe)}),NPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),bPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),CPe=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),PPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),MPe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(PPe)}),xPe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:bC,skills_invoked:u.array(u.string())}),vPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(xPe)}),LPe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),DPe=u.enum(["text_edit","redact","delete_block"]),UPe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:DPe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),wPe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(UPe)}),kPe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),GPe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),BPe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(GPe)}),a9=u.object({id:u.string(),name:u.string()}),jPe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(a9)}),HPe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(jPe)}),FPe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:Ai,author:bC,organization:a9}),VPe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(FPe)}),qPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),$3=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),$Pe=u.object({visitor:u.string().min(1).max(64).optional()}),YPe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),WPe=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array(YPe)}),zPe=u.object({windows:u.array(WPe)}),KPe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),QPe=t9,XPe=e9.extend({comment_thread_id:u.string().min(1)}),JPe=u.object({markdown:u.string().min(1)}),ZPe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:F3,critiqued_plan_block:F3,annotations:u.array(KPe),comment_threads:u.array(QPe),comments:u.array(XPe)}),El=u.enum(SC),c9=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),NC=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:El,admin_override:El.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:c9}),eMe=u.object({effective_plan:El,features:c9,user:NC,organization:NC.nullable()}),tMe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),nMe=u.object({checkout_url:u.string().min(1)}),rMe=u.object({portal_url:u.string().min(1)}),oMe=u.object({seat_quantity:u.number().int().positive()}),Y3=u.object({plan:El.nullable()}),ZS=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:El,admin_override:El.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),sMe=u.object({users:u.array(ZS),organizations:u.array(ZS)}),iMe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),aMe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:iMe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),cMe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(aMe)}),uMe=u.object({thread_id:u.string().min(1)}),lMe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),pMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),dMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),u9=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),W3=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(u9)}),_Me=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),fMe=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(_Me)}),mMe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),hMe=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),TMe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),EMe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:u9}),SMe=u.discriminatedUnion("type",[mMe,hMe,TMe,EMe]),gMe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(SMe)}),AMe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),RMe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(AMe)}),z3=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),yMe=u.enum(["avatar","banner"]),IMe=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),OMe=u.object({kind:yMe,content_type:IMe,base64_data:u.string().min(1)}),NMe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),bMe=Q3,l9=Xbe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:tCe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:uMe,responses:{200:lMe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:cMe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:bPe,responses:{200:q3,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Tl,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:q3,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:NPe,responses:{200:n9,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:gCe,responses:{201:ACe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ICe,responses:{201:OCe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:CCe,responses:{200:PCe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:MPe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:vPe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:CPe,responses:{200:n_,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:LPe,responses:{200:n_,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:n_,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wPe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:lPe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:hPe,responses:{200:Tl,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:u.object({cover_status:s9,how_to_status:i9}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:u.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:YCe,responses:{200:V3,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:V3,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:zCe,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:KCe,responses:{201:QCe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:XCe,responses:{200:JCe,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:ZCe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:TPe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:pCe,responses:{201:OC,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Q3,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:nCe,responses:{200:OC,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:K3}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:bMe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:gMe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:fMe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:pMe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:dMe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:RMe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:OMe,responses:{200:NMe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:oCe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:sCe,responses:{201:iCe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:BCe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:_Ce,responses:{201:DCe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:xCe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ECe,responses:{201:SCe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:RCe,responses:{201:yCe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:NCe,responses:{200:bCe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:LCe,responses:{200:vCe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:wCe,responses:{200:UCe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:OPe,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(FCe).nonempty()}),responses:{201:mPe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(pPe).nonempty()}),responses:{200:_Pe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:kPe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:BPe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:HPe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:qPe,responses:{200:VPe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:RPe,responses:{200:APe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:yPe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:aCe,responses:{201:cCe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:$3,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:$Pe,responses:{200:$3,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:zPe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:JPe,responses:{200:ZPe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:eMe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:tMe,responses:{200:nMe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:rMe,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:oMe,responses:{200:NC,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:sMe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:k3,docs:U3,mentions:G3,favorites:j3,search:H3},{pathPrefix:"/api"});import r_ from"node:fs";import p9 from"node:path";function tg(){return p9.join(Zo(),"token")}function CC(){let t;try{t=r_.readFileSync(tg(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||PMe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function ng(){return CC().token}function d9(){return r_.existsSync(tg())}function _9(t){let e=tg();r_.mkdirSync(p9.dirname(e),{recursive:!0,mode:448}),r_.writeFileSync(e,t,{mode:384})}function f9(){try{r_.rmSync(tg())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function CMe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function PMe(t,e){let n;try{n=CMe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var MMe={dev:"http://localhost:4000",prod:"https://lore-api.tanagram.ai"};function Ri(t={}){let e=t.token??ng();return EC(l9,{baseUrl:MMe[xt()],baseHeaders:{"User-Agent":B4(),...e?{authorization:`Bearer ${e}`}:{}}})}var m9={meta:{name:"health",description:"Check API health"},async run({data:t}){pt.info("command_start",{command:"health"});let n=await(t?.client??Ri()).health();if(n.status===200){console.log(n.body.status);return}throw pt.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var h9={meta:{name:"hello",description:"Print a friendly greeting"},run(){pt.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as vMe}from"node:child_process";import S9 from"node:crypto";import LMe from"node:http";var xMe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function T9(){return xMe[xt()]}var DMe=5*60*1e3;function UMe(){return S9.randomBytes(32).toString("base64url")}function wMe(t){return S9.createHash("sha256").update(t).digest("base64url")}function kMe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function GMe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E9(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<div style="text-align:center;max-width:400px;padding:40px;border:1px solid #e0e0e0;border-radius:10px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,0.1)">
|
|
85
|
-
<div style="font-size:48px;margin-bottom:20px">${r?"\u2713":"\u2717"}</div>
|
|
86
|
-
<h1 style="margin:0 0 10px">${r?"Authorization Complete":"Authorization Cancelled"}</h1>
|
|
87
|
-
<p style="color:#666">${r?"You can close this window now.":GMe(n??"Authorization was cancelled.")}</p>
|
|
88
|
-
<p style="color:#999;font-size:14px">You can close this tab and return to your terminal.</p>
|
|
89
|
-
</div></body></html>`)}async function BMe(){let t,e=new Promise(s=>{t=s}),n=LMe.createServer((s,i)=>{let a=new URL(s.url??"/","http://127.0.0.1");if(a.pathname!=="/callback"){i.writeHead(404),i.end();return}let c=a.searchParams.get("error");if(c){let p=a.searchParams.get("error_description")||c;E9(i,"error",p),t?.({type:"error",description:p});return}let l=a.searchParams.get("code");if(l){E9(i,"success"),t?.({type:"code",code:l});return}i.writeHead(400),i.end()});return await new Promise((s,i)=>{n.once("error",i),n.listen(0,"127.0.0.1",()=>{n.off("error",i),s()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(s){return new Promise((i,a)=>{let c=setTimeout(()=>{a(new Error("authorization timed out"))},s);e.then(l=>{clearTimeout(c),i(l)})})},close(){return new Promise((s,i)=>{n.close(a=>{if(a){i(a);return}s()})})}}}async function jMe(t){let{command:e,args:n}=HMe(process.platform,t);await new Promise((r,o)=>{let s=vMe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function HMe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function FMe(t){if(CC().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function VMe({client:t=Ri(),openBrowser:e=jMe,setAccessToken:n=_9,webBaseURL:r=T9(),timeoutMs:o=DMe}={}){if(await FMe(t)){console.log(`
|
|
90
|
-
Already logged in. Use 'lore logout' if you want to sign out.
|
|
91
|
-
`);return}let s=UMe(),i=wMe(s),a=await BMe();try{let c=new URL("/cli-authorize",r);c.searchParams.set("redirect_uri",a.redirectURI),c.searchParams.set("code_challenge",i),c.searchParams.set("code_challenge_method","S256");try{await e(c.toString()),console.log(`
|
|
92
|
-
Opening browser to log in...`),console.log(`
|
|
93
|
-
If your browser didn't open, visit:`)}catch(d){pt.warn("open_browser_failed",{error:d instanceof Error?d.message:String(d)}),console.log(`
|
|
94
|
-
Visit this URL to log in:`)}console.log(` ${c.toString()}
|
|
95
|
-
`),console.log(" Waiting for authorization. Click Authorize in your browser...");let l=await a.waitForCallback(o);if(l.type==="error")throw console.log(`
|
|
96
|
-
Authorization denied: ${l.description}
|
|
97
|
-
`),new Error(l.description);let p=kMe(l.code);if(p.codeChallenge!==i)throw console.log(`
|
|
98
|
-
Authorization code verification failed.
|
|
99
|
-
`),new Error("PKCE challenge mismatch");n(p.sessionJwt),console.log(`
|
|
100
|
-
Logged in successfully.
|
|
101
|
-
`)}catch(c){throw c instanceof Error&&c.message==="authorization timed out"&&console.log(`
|
|
102
|
-
Authorization timed out. Please try again.
|
|
103
|
-
`),c}finally{await a.close()}}var g9={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){pt.info("command_start",{command:"login"}),await VMe({client:t?.client,openBrowser:t?.openBrowser,setAccessToken:t?.setAccessToken,webBaseURL:t?.webBaseURL,timeoutMs:t?.timeoutMs})}};var A9={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){pt.info("command_start",{command:"logout"});let t=d9();if(f9(),!t){console.log(`
|
|
104
|
-
Not currently logged in.
|
|
105
|
-
`);return}console.log(`
|
|
106
|
-
Logged out successfully.
|
|
107
|
-
`)}};var R9={meta:{name:"logs",description:"Print the path to the log file"},run(){pt.info("command_start",{command:"logs"}),console.log(US())}};import{promises as yi}from"node:fs";import qMe from"node:os";import $a from"node:path";import{fileURLToPath as y9}from"node:url";function PC(){return $a.join(qMe.homedir(),".claude","skills")}function I9(t){return t.map(e=>e.name).sort().join(", ")}function O9(t){return t[0]?$a.dirname(t[0].destination):PC()}async function $Me(t){try{return(await yi.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function N9(){let t=[y9(new URL("../skills",import.meta.url)),y9(new URL("../../skills",import.meta.url))];for(let e of t)if(await $Me(e))return e;throw new Error("bundled skills directory not found")}function YMe(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function WMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await yi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await yi.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);if(await yi.cp(l,p,{recursive:!0,force:!0}),s){let d=$a.join(p,"SKILL.md"),_=await yi.readFile(d,"utf8");await yi.writeFile(d,YMe(_,c))}i.push({name:c,source:l,destination:p})}return i}async function zMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await yi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);await yi.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var b9={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await WMe({destination:t.destination});console.log(`installed skills ${I9(e)} to ${O9(e)}`)}},C9={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await zMe({destination:t.destination});console.log(`uninstalled skills ${I9(e)} from ${O9(e)}`)}};import rg from"node:fs/promises";import KMe from"node:path";import{setTimeout as xC}from"node:timers/promises";var QMe=1e3,XMe=2*60*1e3,JMe=1e3,ZMe=250,og=class extends Error{constructor(){super("lore is logged out")}};async function M9(t={}){let e=await pxe(),n=t.recorder??new jS,r=t.adapter??n3,o=t.client??Ri();await n.markRunning();let s=[],i=e,a=new Map,c=!1;try{let l=await x9({lastUploadedTimestamp:e.latestUploadedTimestamp,adapter:r,client:o,recorder:n});if(s=l.threadIDs,i=l.syncState,a=l.watchBaselineOverrides,c=l.loggedOut,c||await n.markSyncSuccess(s),!c&&s.length>0){let p=await exe({syncState:i,baselineOverrides:a,adapter:r,client:o,recorder:n});s=[...s,...p.threadIDs],i=p.syncState,c=p.loggedOut}return c?await n.markLoggedOut():await n.markSuccess(s),s}catch(l){throw await n.markError(l),l}}async function x9(t){let e=[],n={latestUploadedTimestamp:t.lastUploadedTimestamp},r=new Map,o=!1;try{let s=await txe(t);e=s.threadIDs,n=s.syncState,r=s.watchBaselineOverrides}catch(s){if(s instanceof og)o=!0,e=[],r=new Map;else throw await P9(n),s}return await P9(n),{threadIDs:e,syncState:n,watchBaselineOverrides:r,loggedOut:o}}async function exe(t){let e=t.adapter.historyFilePath(),n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(t.syncState.latestUploadedTimestamp,t.baselineOverrides);if(await t.recorder.setPendingWatchers(r),r.length===0)return await t.recorder.setPendingWatchers([]),{threadIDs:[],syncState:t.syncState,loggedOut:!1};let o=[],s=t.syncState;try{for(;;){await xC(JMe),await t.recorder.heartbeat();let i=new Date,a=await es(e),c=rC(n,a);if(n=a,c||(c=await uxe(r)),!c){let p=lxe(r,i);if(r=p.watchers,p.changed&&await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};continue}await xC(ZMe);let l=await x9({lastUploadedTimestamp:s.latestUploadedTimestamp,adapter:t.adapter,client:t.client,recorder:t.recorder});if(s=l.syncState,l.loggedOut)return{threadIDs:o,syncState:s,loggedOut:!0};if(o.push(...l.threadIDs),await t.recorder.markSyncSuccess(l.threadIDs),l.threadIDs.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};if(n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(s.latestUploadedTimestamp,l.watchBaselineOverrides),await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1}}}finally{await t.recorder.setPendingWatchers([])}}async function txe(t){let e={latestUploadedTimestamp:t.lastUploadedTimestamp},n=await t.adapter.readUnuploadedEntries(t.lastUploadedTimestamp);if(n.length===0)return{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};if(!ng())throw new og;await t.recorder.markAuthenticated();let o=await t.adapter.collectLocalFiles(n);try{if(o.localFiles.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,o.skippedFileKeys),{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};let s=await nxe(t.client,o.localFiles);if(s.thread_files.length!==o.localFiles.length)throw new Error(`upload session returned ${s.thread_files.length} files for ${o.localFiles.length} local files`);let i=ixe(o.localFiles,s.thread_files),a=[],c=[],l=new Set;for(let m=0;m<s.thread_files.length;m+=1){let h=s.thread_files[m],T=i[m];if(!(!h||!T)){if(!h.presigned_url?.trim()){let S=h.error?.trim()||`upload session response missing presigned_url for ${T.filename}`;pt.info("run_upload_skip",{filename:T.filename,reason:S}),l.add(T.key);continue}a.push(h),c.push(T)}}for(let m=0;m<a.length;m+=1){let h=a[m],T=c[m];!h||!T||await rxe(h.presigned_url??"",T.tempPath)}let p=[],d=new Map,_=new Set([...o.skippedFileKeys,...l]);if(a.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d};let f=await oxe(t.client,s.id,a);if(f.thread_files.length!==c.length)throw new Error(`completed upload session returned ${f.thread_files.length} files for ${c.length} local files`);for(let m=0;m<f.thread_files.length;m+=1){await t.recorder.heartbeat();let h=f.thread_files[m],T=c[m];if(!h||!T)continue;let S=h.thread?.id?.trim()??"";if(!S){if(T.fileType==="plan"){_.add(T.key);continue}throw new Error(`complete upload session response missing thread for ${T.filename}`)}p.push(S),await sxe(t.client,S,t.recorder),_.add(T.key),T.sourcePath&&d.set(T.sourcePath,T.watchedState)}return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d}}finally{await Promise.all(o.localFiles.map(s=>K4(s.tempPath)))}}async function nxe(t,e){let n=e.map(o=>({md5:o.md5,harness:o.harness,filename:o.filename,repo_origin_path:o.repoOriginPath||void 0,file_type:o.fileType,harness_internal_id:o.harnessInternalId})),r=await t.createUploadSession({body:{thread_files:n}});if(r.status!==201)throw new Error(vC("create upload session",r.status,r.body));return r.body}async function rxe(t,e){let n=await rg.readFile(e),r=await fetch(t,{method:"PUT",body:n,headers:{"content-length":String(n.length)}});if(!r.ok)throw new Error(`upload transcript: unexpected status ${r.status}: ${await r.text()}`)}async function oxe(t,e,n){let r=n.map(s=>({storage_url:axe(s)})),o=await t.completeUploadSession({params:{id:e},body:{thread_files:r}});if(o.status!==200)throw new Error(vC("complete upload session",o.status,o.body));return o.body}async function sxe(t,e,n,r={}){let o=r.timeoutMs??XMe,s=r.pollIntervalMs??QMe,i=Date.now();for(;;){await n.heartbeat();let a=await t.getThread({params:{id:e}});if(a.status!==200)throw new Error(vC(`get thread ${e}`,a.status,a.body));let c=a.body.transcript_parsing_state;if(c==="parsed"||c==="too_large_to_parse")return;if(c!=="pending"&&c!=="parsing")throw new Error(`unexpected transcript parsing state for thread ${e}: ${JSON.stringify(c)}`);let l=Date.now()-i;if(l>=o)throw new Error(`timed out waiting for thread ${e} parsing after ${o}ms`);await xC(Math.min(s,o-l))}}function ixe(t,e){let n=new Map;for(let r of t){let o=r.md5.trim().toLowerCase();n.set(o,[...n.get(o)??[],r])}return e.map((r,o)=>{let s=r.expected_md5?.trim();if(!s)throw new Error(`upload session response missing expected_md5 for thread_files[${o}]`);let i=s.toLowerCase(),a=n.get(i);if(!a||a.length===0)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);let[c,...l]=a;if(!c)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);return l.length===0?n.delete(i):n.set(i,l),c})}function MC(t,e,n,r){let o=t;for(let s=0;s<e.length;s+=1){let i=n[s];if(!i||!r.has(i))break;o=e[s]?.timestamp??o}return o}function axe(t){if(!t.storage_url.trim())throw new Error("upload session response missing storage_url");return`s3://${cxe(t.presigned_url??"")}/${t.storage_url.replace(/^\/+/,"")}`}function cxe(t){let e;try{e=new URL(t)}catch(s){throw new Error(`parse presigned URL ${JSON.stringify(t)}: ${String(s)}`)}let n=e.hostname,r=n.indexOf(".s3");if(r>0)return n.slice(0,r);let o=e.pathname.replace(/^\/+|\/+$/g,"").split("/");if(o.length>=2&&o[0])return o[0];throw new Error(`could not determine S3 bucket from presigned URL ${JSON.stringify(t)}`)}async function uxe(t){for(let e of t){let n=await es(e.transcriptPath);if(rC(e.baseline,n))return!0}return!1}function lxe(t,e){let n=t.filter(r=>e<r.expiresAt);return{watchers:n,changed:n.length!==t.length}}async function pxe(){try{return{latestUploadedTimestamp:JSON.parse(await rg.readFile(tC(),"utf8")).latestUploadedTimestamp??0}}catch{return{latestUploadedTimestamp:0}}}async function P9(t){let e=tC();await rg.mkdir(KMe.dirname(e),{recursive:!0,mode:448}),await rg.writeFile(e,`${JSON.stringify(t,null,2)}
|
|
108
|
-
`,{mode:384})}function vC(t,e,n){return dxe(n)&&typeof n.message=="string"?`${t} failed: HTTP ${e}: ${n.message}`:`${t} failed: HTTP ${e}`}function dxe(t){return t!==null&&typeof t=="object"}var v9={meta:{name:"_run_upload",hidden:!0},async run({data:t}){let e=await M9({client:t?.client,adapter:t?.adapter,recorder:t?.recorder});console.log(JSON.stringify(e))}};var L9={meta:{name:"version",description:"Print the Lore CLI version"},run(){console.log(fi())}};var D9={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:t}){pt.info("command_start",{command:"whoami"});let n=await(t?.client??Ri()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var _xe="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",fxe="https://phe.tanagram.ai/capture/",mxe=2e3;function U9(t){return process.env[t]??""}function hxe(t,e){let n=[t,e].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function w9({commandName:t,durationMs:e}){let n=U9("USER"),r=U9("HOST"),o=new AbortController,s=setTimeout(()=>o.abort(),mxe);try{await fetch(fxe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:_xe,event:"lore.cli.command_run",properties:{distinct_id:hxe(n,r),command_name:t,cli_version:fi(),duration_ms:Math.round(e),environment:xt(),user:n,host:r}}),signal:o.signal})}catch(i){pt.warn("posthog_capture_failed",{command:t,error:i instanceof Error?i.message:String(i)})}finally{clearTimeout(s)}}var j9={hello:h9,health:m9,enable:_3,disable:f3,restart:m3,status:h3,login:g9,logout:A9,whoami:D9,logs:R9,version:L9,_run_upload:v9,"postinstall:install-skills":b9,"postinstall:uninstall-skills":C9};function Sxe(t){let e=t.find(n=>!n.startsWith("-"));return e||"hello"}var gxe={name:"cli-metrics",setup(t){t.data={...t.data,commandStartedAtMs:performance.now()}},async cleanup(t){let e=t.data?.commandStartedAtMs;if(typeof e!="number")return;let n=performance.now()-e;await(t.data?.captureCliCommandMetric??w9)({commandName:Sxe(t.rawArgs),durationMs:n})}},LC={meta:{name:"lore",description:"Lore CLI"},plugins:[gxe],subCommands:j9,default:"hello"};function G9(t){return t instanceof Error&&t.name==="CLIError"}function Axe(t){let e=t.find(r=>!r.startsWith("-")),n=e?j9[e]:void 0;return n?[n,LC]:[LC,void 0]}async function Rxe(t){try{if(t.includes("--help")||t.includes("-h")){console.log(await $4(...Axe(t)));return}if(t.includes("--version")||t.includes("-v")){console.log(fi());return}await vS(LC,{rawArgs:t})}catch(e){if(G9(e)||xt()==="prod"&&e instanceof Error?console.error(e.message):console.error(e,`
|
|
109
|
-
`),!G9(e)){te(e),om(2e3).catch(()=>{}).finally(()=>{process.exit(1)});return}process.exit(1)}}function B9(t){try{return Txe(t)}catch{return t}}function yxe(t,e){if(!e)return!1;let n=Exe(t);return k9(B9(n)).href===k9(B9(e)).href}yxe(import.meta.url,process.argv[1])&&await Rxe(process.argv.slice(2));export{yxe as isCliEntrypoint,LC as mainCommand};
|
|
106
|
+
cd ${PC(e)}
|
|
107
|
+
exec ${PC(n)} ${PC(t)} "$@"
|
|
108
|
+
`}function PC(t){return`'${t.replaceAll("'","'\\''")}'`}async function XMe(t){let e=Xd();await rn.mkdir(yo.dirname(e),{recursive:!0,mode:448}),await rn.writeFile(e,`${JSON.stringify({binary_path:t,updated_at:new Date().toISOString()},null,2)}
|
|
109
|
+
`,{mode:384})}async function b9(){try{await oS("bootout",xC(),e_())}catch(t){if(M9(t)||!(await C9().catch(()=>({loaded:!0}))).loaded)return;throw t}}async function JMe(t){await oS("bootstrap",xC(),t)}async function ZMe(){await oS("kickstart","-k",P9())}async function C9(){try{let t=await oS("print",P9());return exe(t)}catch(t){if(M9(t))return{loaded:!1,running:!1,pid:0,raw:""};throw t}}function exe(t){let e={loaded:t.trim().length>0,running:!1,pid:0,raw:t},n;for(let r of t.split(`
|
|
110
|
+
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function oS(...t){try{let e=await FMe("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(sxe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function txe(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function nxe(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+VMe>=e.getTime()}function xC(){return`gui/${process.getuid?.()??jMe.userInfo().uid}`}function P9(){return`${xC()}/${Zd()}`}function rxe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(yo.delimiter)??[],...t].filter(Boolean))).join(yo.delimiter)}async function oxe(t){try{return await rn.stat(t),!0}catch{return!1}}function rS(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function vC(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function M9(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function sxe(t){return t instanceof Error}var x9={meta:{name:"enable",description:"Install and start background uploads"},async run(){let{plistPath:t,binaryPath:e}=await MC();console.log("Lore background uploads enabled."),console.log(`LaunchAgent: ${t}`),console.log(`Stable binary: ${e}`)}},v9={meta:{name:"disable",description:"Stop and remove background uploads"},async run(){await N9(),console.log("Lore background uploads disabled.")}},L9={meta:{name:"restart",description:"Restart background uploads"},async run(){await MC(),console.log("Lore background uploads restarted.")}},D9={meta:{name:"status",description:"Show background upload status"},args:{json:{type:"boolean",description:"Output status as JSON"}},async run({args:t}){let e=await O9();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(`Lore: ${e.health}`),console.log(`Enabled: ${e.enabled}`),console.log(`Loaded: ${e.loaded}`),console.log(`Running: ${e.running}`),console.log(`Healthy: ${e.healthy}`),e.status?.last_heartbeat_at&&console.log(`Last heartbeat: ${e.status.last_heartbeat_at}`),e.status?.last_success_at&&console.log(`Last success: ${e.status.last_success_at}`),e.status?.last_error&&console.log(`Last error: ${e.status.last_error}`),console.log(`LaunchAgent: ${e.plist_path}`),console.log(`Stable binary: ${e.binary_path}`),console.log(`Status file: ${e.status_path}`)}};import sS from"node:fs/promises";import ixe from"node:path";import{setTimeout as DC}from"node:timers/promises";var axe=1e3,cxe=2*60*1e3,uxe=1e3,lxe=250,iS=class extends Error{constructor(){super("lore is logged out")}};async function w9(t={}){let e=await Rxe(),n=t.recorder??new eS,r=t.adapter??R9,o=t.client??Ai();await n.markRunning();let s=[],i=e,a=new Map,c=!1;try{let l=await k9({lastUploadedTimestamp:e.latestUploadedTimestamp,adapter:r,client:o,recorder:n});if(s=l.threadIDs,i=l.syncState,a=l.watchBaselineOverrides,c=l.loggedOut,c||await n.markSyncSuccess(s),!c&&s.length>0){let p=await pxe({syncState:i,baselineOverrides:a,adapter:r,client:o,recorder:n});s=[...s,...p.threadIDs],i=p.syncState,c=p.loggedOut}return c?await n.markLoggedOut():await n.markSuccess(s),s}catch(l){throw await n.markError(l),l}}async function k9(t){let e=[],n={latestUploadedTimestamp:t.lastUploadedTimestamp},r=new Map,o=!1;try{let s=await dxe(t);e=s.threadIDs,n=s.syncState,r=s.watchBaselineOverrides}catch(s){if(s instanceof iS)o=!0,e=[],r=new Map;else throw await U9(n),s}return await U9(n),{threadIDs:e,syncState:n,watchBaselineOverrides:r,loggedOut:o}}async function pxe(t){let e=t.adapter.historyFilePath(),n=await os(e),r=await t.adapter.buildPendingTranscriptWatches(t.syncState.latestUploadedTimestamp,t.baselineOverrides);if(await t.recorder.setPendingWatchers(r),r.length===0)return await t.recorder.setPendingWatchers([]),{threadIDs:[],syncState:t.syncState,loggedOut:!1};let o=[],s=t.syncState;try{for(;;){await DC(uxe),await t.recorder.heartbeat();let i=new Date,a=await os(e),c=NC(n,a);if(n=a,c||(c=await Sxe(r)),!c){let p=Axe(r,i);if(r=p.watchers,p.changed&&await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};continue}await DC(lxe);let l=await k9({lastUploadedTimestamp:s.latestUploadedTimestamp,adapter:t.adapter,client:t.client,recorder:t.recorder});if(s=l.syncState,l.loggedOut)return{threadIDs:o,syncState:s,loggedOut:!0};if(o.push(...l.threadIDs),await t.recorder.markSyncSuccess(l.threadIDs),l.threadIDs.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};if(n=await os(e),r=await t.adapter.buildPendingTranscriptWatches(s.latestUploadedTimestamp,l.watchBaselineOverrides),await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1}}}finally{await t.recorder.setPendingWatchers([])}}async function dxe(t){let e={latestUploadedTimestamp:t.lastUploadedTimestamp},n=await t.adapter.readUnuploadedEntries(t.lastUploadedTimestamp);if(n.length===0)return{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};if(!Jg())throw new iS;await t.recorder.markAuthenticated();let o=await t.adapter.collectLocalFiles(n);try{if(o.localFiles.length===0)return e.latestUploadedTimestamp=LC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,o.skippedFileKeys),{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};let s=await _xe(t.client,o.localFiles);if(s.thread_files.length!==o.localFiles.length)throw new Error(`upload session returned ${s.thread_files.length} files for ${o.localFiles.length} local files`);let i=Txe(o.localFiles,s.thread_files),a=[],c=[],l=new Set;for(let m=0;m<s.thread_files.length;m+=1){let h=s.thread_files[m],T=i[m];if(!(!h||!T)){if(!h.presigned_url?.trim()){let g=h.error?.trim()||`upload session response missing presigned_url for ${T.filename}`;tn.info("run_upload_skip",{filename:T.filename,reason:g}),l.add(T.key);continue}a.push(h),c.push(T)}}for(let m=0;m<a.length;m+=1){let h=a[m],T=c[m];!h||!T||await fxe(h.presigned_url??"",T.tempPath)}let p=[],d=new Map,_=new Set([...o.skippedFileKeys,...l]);if(a.length===0)return e.latestUploadedTimestamp=LC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d};let f=await mxe(t.client,s.id,a);if(f.thread_files.length!==c.length)throw new Error(`completed upload session returned ${f.thread_files.length} files for ${c.length} local files`);for(let m=0;m<f.thread_files.length;m+=1){await t.recorder.heartbeat();let h=f.thread_files[m],T=c[m];if(!h||!T)continue;let g=h.thread?.id?.trim()??"";if(!g){if(T.fileType==="plan"){_.add(T.key);continue}throw new Error(`complete upload session response missing thread for ${T.filename}`)}p.push(g),await hxe(t.client,g,t.recorder),_.add(T.key),T.sourcePath&&d.set(T.sourcePath,T.watchedState)}return e.latestUploadedTimestamp=LC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d}}finally{await Promise.all(o.localFiles.map(s=>m9(s.tempPath)))}}async function _xe(t,e){let n=e.map(o=>({md5:o.md5,harness:o.harness,filename:o.filename,repo_origin_path:o.repoOriginPath||void 0,file_type:o.fileType,harness_internal_id:o.harnessInternalId})),r=await t.createUploadSession({body:{thread_files:n}});if(r.status!==201)throw new Error(UC("create upload session",r.status,r.body));return r.body}async function fxe(t,e){let n=await sS.readFile(e),r=await fetch(t,{method:"PUT",body:n,headers:{"content-length":String(n.length)}});if(!r.ok)throw new Error(`upload transcript: unexpected status ${r.status}: ${await r.text()}`)}async function mxe(t,e,n){let r=n.map(s=>({storage_url:Exe(s)})),o=await t.completeUploadSession({params:{id:e},body:{thread_files:r}});if(o.status!==200)throw new Error(UC("complete upload session",o.status,o.body));return o.body}async function hxe(t,e,n,r={}){let o=r.timeoutMs??cxe,s=r.pollIntervalMs??axe,i=Date.now();for(;;){await n.heartbeat();let a=await t.getThread({params:{id:e}});if(a.status!==200)throw new Error(UC(`get thread ${e}`,a.status,a.body));let c=a.body.transcript_parsing_state;if(c==="parsed"||c==="too_large_to_parse")return;if(c!=="pending"&&c!=="parsing")throw new Error(`unexpected transcript parsing state for thread ${e}: ${JSON.stringify(c)}`);let l=Date.now()-i;if(l>=o)throw new Error(`timed out waiting for thread ${e} parsing after ${o}ms`);await DC(Math.min(s,o-l))}}function Txe(t,e){let n=new Map;for(let r of t){let o=r.md5.trim().toLowerCase();n.set(o,[...n.get(o)??[],r])}return e.map((r,o)=>{let s=r.expected_md5?.trim();if(!s)throw new Error(`upload session response missing expected_md5 for thread_files[${o}]`);let i=s.toLowerCase(),a=n.get(i);if(!a||a.length===0)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);let[c,...l]=a;if(!c)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);return l.length===0?n.delete(i):n.set(i,l),c})}function LC(t,e,n,r){let o=t;for(let s=0;s<e.length;s+=1){let i=n[s];if(!i||!r.has(i))break;o=e[s]?.timestamp??o}return o}function Exe(t){if(!t.storage_url.trim())throw new Error("upload session response missing storage_url");return`s3://${gxe(t.presigned_url??"")}/${t.storage_url.replace(/^\/+/,"")}`}function gxe(t){let e;try{e=new URL(t)}catch(s){throw new Error(`parse presigned URL ${JSON.stringify(t)}: ${String(s)}`)}let n=e.hostname,r=n.indexOf(".s3");if(r>0)return n.slice(0,r);let o=e.pathname.replace(/^\/+|\/+$/g,"").split("/");if(o.length>=2&&o[0])return o[0];throw new Error(`could not determine S3 bucket from presigned URL ${JSON.stringify(t)}`)}async function Sxe(t){for(let e of t){let n=await os(e.transcriptPath);if(NC(e.baseline,n))return!0}return!1}function Axe(t,e){let n=t.filter(r=>e<r.expiresAt);return{watchers:n,changed:n.length!==t.length}}async function Rxe(){try{return{latestUploadedTimestamp:JSON.parse(await sS.readFile(AC(),"utf8")).latestUploadedTimestamp??0}}catch{return{latestUploadedTimestamp:0}}}async function U9(t){let e=AC();await sS.mkdir(ixe.dirname(e),{recursive:!0,mode:448}),await sS.writeFile(e,`${JSON.stringify(t,null,2)}
|
|
111
|
+
`,{mode:384})}function UC(t,e,n){return yxe(n)&&typeof n.message=="string"?`${t} failed: HTTP ${e}: ${n.message}`:`${t} failed: HTTP ${e}`}function yxe(t){return t!==null&&typeof t=="object"}var G9={meta:{name:"_run_upload",hidden:!0},async run({data:t}){let e=await w9({client:t?.client,adapter:t?.adapter,recorder:t?.recorder});console.log(JSON.stringify(e))}};var H9={health:t9,enable:x9,disable:v9,restart:L9,status:D9,login:J3,logout:Z3,whoami:e9,logs:r9,version:l9,_run_upload:G9,"postinstall:install-skills":c9,"postinstall:uninstall-skills":u9};function F9(t){return t.find(n=>!n.startsWith("-"))??"lore"}var Oxe={name:"cli-metrics",setup(t){t.data={...t.data,commandStartedAtMs:performance.now()}},async cleanup(t){let e=t.data?.commandStartedAtMs;if(typeof e!="number")return;let n=performance.now()-e;await(t.data?.captureCliCommandMetric??d9)({commandName:F9(t.rawArgs),durationMs:n})}},s_={meta:{name:"lore",description:"Lore CLI"},plugins:[Oxe],subCommands:H9};function wC(t){return t instanceof Error&&t.name==="CLIError"}function bxe(t){return wC(t)&&t.code==="E_UNKNOWN_COMMAND"}function Cxe(t){let e=t.find(r=>!r.startsWith("-")),n=e?H9[e]:void 0;return n?[n,s_]:[s_,void 0]}async function Pxe(t){try{return t.includes("--help")||t.includes("-h")?(console.log(await kg(...Cxe(t))),0):t.includes("--version")||t.includes("-v")?(console.log(fi()),0):t.some(e=>!e.startsWith("-"))?(await Dg(s_,{rawArgs:t}),0):(console.log(await kg(s_)),0)}catch(e){return bxe(e)?(console.error(`Unrecognized command: ${F9(t)}`),console.error(await kg(s_))):wC(e)||Mt()==="prod"&&e instanceof Error?console.error(e.message):console.error(e,`
|
|
112
|
+
`),wC(e)||(te(e),await im(2e3).catch(()=>{})),1}}async function Mxe(t){let e=await Pxe(t);e!==0&&process.exit(e)}function j9(t){try{return Ixe(t)}catch{return t}}function xxe(t,e){if(!e)return!1;let n=Nxe(t);return B9(j9(n)).href===B9(j9(e)).href}xxe(import.meta.url,process.argv[1])&&await Mxe(process.argv.slice(2));export{xxe as isCliEntrypoint,s_ as mainCommand,Pxe as runCli};
|