@visa/cli 2.0.0-rc.8 → 2.0.0
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 +71 -29
- package/dist/cli.js +186 -129
- package/dist/mcp-server/index.js +38 -65
- package/install.ps1 +36 -5
- package/install.sh +120 -0
- package/package.json +7 -4
package/dist/cli.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
"use strict";var L8=Object.create;var Ml=Object.defineProperty;var D8=Object.getOwnPropertyDescriptor;var x8=Object.getOwnPropertyNames;var U8=Object.getPrototypeOf,w8=Object.prototype.hasOwnProperty;var U=(t,e)=>()=>(t&&(e=t(t=0)),e);var f=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mS=(t,e)=>{for(var n in e)Ml(t,n,{get:e[n],enumerable:!0})},cN=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x8(e))!w8.call(t,o)&&o!==n&&Ml(t,o,{get:()=>e[o],enumerable:!(r=D8(e,o))||r.enumerable});return t};var C=(t,e,n)=>(n=t!=null?L8(U8(t)):{},cN(e||!t||!t.__esModule?Ml(n,"default",{value:t,enumerable:!0}):n,t)),I=t=>cN(Ml({},"__esModule",{value:!0}),t);var IS=f((F0e,X8)=>{X8.exports={name:"@visa/cli",version:"2.0.0-rc.8",description:"AI-powered payments for Claude Code",bin:{"visa-cli":"./bin/visa-cli.js"},scripts:{build:"tsc --noEmit && node esbuild.config.js",dev:"tsc --watch",pretest:"pnpm build",start:"node dist/mcp-server/index.js",test:"jest --config jest.config.js","test:unit":"jest --config jest.config.js","test:unit:watch":"jest --config jest.config.js --watch","test:unit:coverage":"jest --config jest.config.js --coverage","test:smoke":"VISA_AUTH_URL=https://auth.visacli.sh jest --config jest.smoke.config.js","test:integration":"jest --config jest.integration.config.js","test:e2e":"jest --config jest.e2e.config.js","test:catalog-e2e":"jest --config jest.catalog-e2e.config.js","test:all":"npm run test:unit && npm run test:integration && npm run test:e2e",prepublishOnly:"npm run build && npm test",lint:"eslint src/**/*.ts",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"'},keywords:["visa","checkout","mcp","ai-agent","payments","click-to-pay","usdc","stablecoin"],author:"Visa Crypto Labs",license:"SEE LICENSE IN LICENSE",dependencies:{"@modelcontextprotocol/sdk":"^1.0.0",commander:"^12.1.0",zod:"^3.23.0"},devDependencies:{"@visa/observability":"workspace:*","@visa-cli/tools":"workspace:*","@changesets/changelog-git":"^0.2.1","@changesets/cli":"^2.31.0","@types/jest":"^30.0.0","@types/node":"^25.6.0","@typescript-eslint/eslint-plugin":"^8.59.1","@typescript-eslint/parser":"^8.59.1","@types/express":"^5.0.0",esbuild:"^0.27.4",express:"^4.21.0",eslint:"^10.0.2","eslint-config-prettier":"^10.1.8",jest:"^29.7.0",prettier:"^3.8.3","ts-jest":"^29.2.0",typescript:"^5.7.0"},engines:{node:">=18.0.0"},mcpName:"io.github.visa-crypto-labs/visa-cli",files:["bin/visa-cli.js","dist/","install.ps1","native/visa-keychain.m","server.json","README.md","LICENSE"]}});var Br,sT=U(()=>{Br="1.9.1"});function gJ(t){let e=new Set([t]),n=new Set,r=t.match(xI);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 u=c.match(xI);if(!u)return s(c);let l={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return l.prerelease!=null||o.major!==l.major?s(c):o.major===0?o.minor===l.minor&&o.patch<=l.patch?i(c):s(c):o.minor<=l.minor?i(c):s(c)}}var xI,UI,wI=U(()=>{sT();xI=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;UI=gJ(Br)});function sr(t,e,n,r=!1){var o;let s=Nc[Oc]=(o=Nc[Oc])!==null&&o!==void 0?o:{version:Br};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!==Br){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Br}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Br}.`),!0}function sn(t){var e,n;let r=(e=Nc[Oc])===null||e===void 0?void 0:e.version;if(!(!r||!UI(r)))return(n=Nc[Oc])===null||n===void 0?void 0:n[t]}function ir(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Br}.`);let n=Nc[Oc];n&&delete n[t]}var AJ,Oc,Nc,hs=U(()=>{sT();wI();AJ=Br.split(".")[0],Oc=Symbol.for(`opentelemetry.js.api.${AJ}`),Nc=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Ic(t,e,n){let r=sn("diag");if(r)return r[t](e,...n)}var ip,VI=U(()=>{hs();ip=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Ic("debug",this._namespace,e)}error(...e){return Ic("error",this._namespace,e)}info(...e){return Ic("info",this._namespace,e)}warn(...e){return Ic("warn",this._namespace,e)}verbose(...e){return Ic("verbose",this._namespace,e)}}});var ze,ap=U(()=>{(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"})(ze||(ze={}))});function BI(t,e){t<ze.NONE?t=ze.NONE:t>ze.ALL&&(t=ze.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",ze.ERROR),warn:n("warn",ze.WARN),info:n("info",ze.INFO),debug:n("debug",ze.DEBUG),verbose:n("verbose",ze.VERBOSE)}}var GI=U(()=>{ap()});var RJ,nt,gs=U(()=>{VI();GI();ap();hs();RJ="diag",nt=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=sn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:ze.INFO})=>{var i,a,c;if(o===n){let p=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=p.stack)!==null&&i!==void 0?i:p.message),!1}typeof s=="number"&&(s={logLevel:s});let u=sn("diag"),l=BI((a=s.logLevel)!==null&&a!==void 0?a:ze.INFO,o);if(u&&!s.suppressOverrideMessage){let p=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn(`Current logger will be overwritten from ${p}`),l.warn(`Current logger will overwrite one already registered from ${p}`)}return sr("diag",l,n,!0)};n.setLogger=r,n.disable=()=>{ir(RJ,n)},n.createComponentLogger=o=>new ip(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var cp,HI=U(()=>{cp=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 kI,FI=U(()=>{kI=Symbol("BaggageEntryMetadata")});function jI(t={}){return new cp(new Map(Object.entries(t)))}function $I(t){return typeof t!="string"&&(OJ.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:kI,toString(){return t}}}var OJ,iT=U(()=>{gs();HI();FI();OJ=nt.instance()});function Bn(t){return Symbol.for(t)}var aT,mi,Cc=U(()=>{aT=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}}},mi=new aT});var cT,uT,up,YI=U(()=>{cT=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],uT={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(uT[e]=console[e])}up=class{constructor(){function e(n){return function(...r){let o=uT[n];if(typeof o!="function"&&(o=uT.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<cT.length;n++)this[cT[n].n]=e(cT[n].c)}}});function qI(){return mT}var lT,hi,pT,dT,_T,ET,Pc,fT,ST,TT,mT,NJ,IJ,CJ,PJ,MJ,yJ,vJ,hT=U(()=>{lT=class{constructor(){}createGauge(e,n){return IJ}createHistogram(e,n){return CJ}createCounter(e,n){return NJ}createUpDownCounter(e,n){return PJ}createObservableGauge(e,n){return yJ}createObservableCounter(e,n){return MJ}createObservableUpDownCounter(e,n){return vJ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},hi=class{},pT=class extends hi{add(e,n){}},dT=class extends hi{add(e,n){}},_T=class extends hi{record(e,n){}},ET=class extends hi{record(e,n){}},Pc=class{addCallback(e){}removeCallback(e){}},fT=class extends Pc{},ST=class extends Pc{},TT=class extends Pc{},mT=new lT,NJ=new pT,IJ=new _T,CJ=new ET,PJ=new dT,MJ=new fT,yJ=new ST,vJ=new TT});var lp,KI=U(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(lp||(lp={}))});var pp,dp,gT=U(()=>{pp={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},dp={set(t,e,n){t!=null&&(t[e]=n)}}});var _p,WI=U(()=>{Cc();_p=class{active(){return mi}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var AT,bJ,ar,Mc=U(()=>{WI();hs();gs();AT="context",bJ=new _p,ar=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return sr(AT,e,nt.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 sn(AT)||bJ}disable(){this._getContextManager().disable(),ir(AT,nt.instance())}}});var Tn,RT=U(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Tn||(Tn={}))});var yc,As,Ep,fp=U(()=>{RT();yc="0000000000000000",As="00000000000000000000000000000000",Ep={traceId:As,spanId:yc,traceFlags:Tn.NONE}});var cr,Sp=U(()=>{fp();cr=class{constructor(e=Ep){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 Tp(t){return t.getValue(OT)||void 0}function XI(){return Tp(ar.getInstance().active())}function vc(t,e){return t.setValue(OT,e)}function zI(t){return t.deleteValue(OT)}function JI(t,e){return vc(t,new cr(e))}function mp(t){var e;return(e=Tp(t))===null||e===void 0?void 0:e.spanContext()}var OT,NT=U(()=>{Cc();Sp();Mc();OT=Bn("OpenTelemetry Context Key SPAN")});function QI(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(hp[t.charCodeAt(r)]|0)+(hp[t.charCodeAt(r+1)]|0)+(hp[t.charCodeAt(r+2)]|0)+(hp[t.charCodeAt(r+3)]|0);return n===e}function IT(t){return QI(t,32)&&t!==As}function CT(t){return QI(t,16)&&t!==yc}function Gr(t){return IT(t.traceId)&&CT(t.spanId)}function ZI(t){return new cr(t)}var hp,gp=U(()=>{fp();Sp();hp=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 LJ(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 PT,gi,MT=U(()=>{Mc();NT();Sp();gp();PT=ar.getInstance(),gi=class{startSpan(e,n,r=PT.active()){if(!!n?.root)return new cr;let s=r&&mp(r);return LJ(s)&&Gr(s)?new cr(s):new cr}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??PT.active(),u=this.startSpan(e,s,c),l=vc(c,u);return PT.with(l,a,void 0,u)}}});var DJ,Ai,yT=U(()=>{MT();DJ=new gi,Ai=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):DJ}}});var Ap,eC=U(()=>{MT();Ap=class{getTracer(e,n,r){return new gi}}});var xJ,Rs,vT=U(()=>{yT();eC();xJ=new Ap,Rs=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Ai(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:xJ}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 Rp,tC=U(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Rp||(Rp={}))});var dt,nC=U(()=>{(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"})(dt||(dt={}))});var Se,rC=U(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Se||(Se={}))});function oC(t){return VJ.test(t)}function sC(t){return BJ.test(t)&&!GJ.test(t)}var bT,UJ,wJ,VJ,BJ,GJ,iC=U(()=>{bT="[_0-9a-z-*/]",UJ=`[a-z]${bT}{0,255}`,wJ=`[a-z0-9]${bT}{0,240}@[a-z]${bT}{0,13}`,VJ=new RegExp(`^(?:${UJ}|${wJ})$`),BJ=/^[ -~]{0,255}[!-~]$/,GJ=/,|=/});var aC,HJ,cC,uC,Op,lC=U(()=>{iC();aC=32,HJ=512,cC=",",uC="=",Op=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+uC+this.get(n)),e),[]).join(cC)}_parse(e){e.length>HJ||(this._internalState=e.split(cC).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(uC);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);oC(i)&&sC(a)&&n.set(i,a)}return n},new Map),this._internalState.size>aC&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,aC))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function pC(t){return new Op(t)}var dC=U(()=>{lC()});var k,_C=U(()=>{Mc();k=ar.getInstance()});var an,EC=U(()=>{gs();an=nt.instance()});var LT,fC,SC=U(()=>{hT();LT=class{getMeter(e,n,r){return mT}},fC=new LT});var DT,Np,TC=U(()=>{SC();hs();gs();DT="metrics",Np=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return sr(DT,e,nt.instance())}getMeterProvider(){return sn(DT)||fC}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){ir(DT,nt.instance())}}});var xT,mC=U(()=>{TC();xT=Np.getInstance()});var Ip,hC=U(()=>{Ip=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function wT(t){return t.getValue(UT)||void 0}function gC(){return wT(ar.getInstance().active())}function AC(t,e){return t.setValue(UT,e)}function RC(t){return t.deleteValue(UT)}var UT,OC=U(()=>{Mc();Cc();UT=Bn("OpenTelemetry Baggage Key")});var VT,kJ,Cp,NC=U(()=>{hs();hC();gT();OC();iT();gs();VT="propagation",kJ=new Ip,Cp=class t{constructor(){this.createBaggage=jI,this.getBaggage=wT,this.getActiveBaggage=gC,this.setBaggage=AC,this.deleteBaggage=RC}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return sr(VT,e,nt.instance())}inject(e,n,r=dp){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=pp){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){ir(VT,nt.instance())}_getGlobalPropagator(){return sn(VT)||kJ}}});var xt,IC=U(()=>{NC();xt=Cp.getInstance()});var BT,Pp,CC=U(()=>{hs();vT();gp();NT();gs();BT="trace",Pp=class t{constructor(){this._proxyTracerProvider=new Rs,this.wrapSpanContext=ZI,this.isSpanContextValid=Gr,this.deleteSpan=zI,this.getSpan=Tp,this.getActiveSpan=XI,this.getSpanContext=mp,this.setSpan=vc,this.setSpanContext=JI}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=sr(BT,this._proxyTracerProvider,nt.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return sn(BT)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){ir(BT,nt.instance()),this._proxyTracerProvider=new Rs}}});var K,PC=U(()=>{CC();K=Pp.getInstance()});var x={};mS(x,{DiagConsoleLogger:()=>up,DiagLogLevel:()=>ze,INVALID_SPANID:()=>yc,INVALID_SPAN_CONTEXT:()=>Ep,INVALID_TRACEID:()=>As,ProxyTracer:()=>Ai,ProxyTracerProvider:()=>Rs,ROOT_CONTEXT:()=>mi,SamplingDecision:()=>Rp,SpanKind:()=>dt,SpanStatusCode:()=>Se,TraceFlags:()=>Tn,ValueType:()=>lp,baggageEntryMetadataFromString:()=>$I,context:()=>k,createContextKey:()=>Bn,createNoopMeter:()=>qI,createTraceState:()=>pC,default:()=>FJ,defaultTextMapGetter:()=>pp,defaultTextMapSetter:()=>dp,diag:()=>an,isSpanContextValid:()=>Gr,isValidSpanId:()=>CT,isValidTraceId:()=>IT,metrics:()=>xT,propagation:()=>xt,trace:()=>K});var FJ,y=U(()=>{iT();Cc();YI();ap();hT();KI();gT();yT();vT();tC();nC();rC();RT();dC();gp();fp();_C();EC();mC();IC();PC();FJ={context:k,diag:an,metrics:xT,propagation:xt,trace:K}});var bc=f(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.isTracingSuppressed=So.unsuppressTracing=So.suppressTracing=void 0;var jJ=(y(),I(x)),GT=(0,jJ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function $J(t){return t.setValue(GT,!0)}So.suppressTracing=$J;function YJ(t){return t.deleteValue(GT)}So.unsuppressTracing=YJ;function qJ(t){return t.getValue(GT)===!0}So.isTracingSuppressed=qJ});var HT=f(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.BAGGAGE_MAX_TOTAL_LENGTH=ht.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=ht.BAGGAGE_MAX_NAME_VALUE_PAIRS=ht.BAGGAGE_HEADER=ht.BAGGAGE_ITEMS_SEPARATOR=ht.BAGGAGE_PROPERTIES_SEPARATOR=ht.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;ht.BAGGAGE_KEY_PAIR_SEPARATOR="=";ht.BAGGAGE_PROPERTIES_SEPARATOR=";";ht.BAGGAGE_ITEMS_SEPARATOR=",";ht.BAGGAGE_HEADER="baggage";ht.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;ht.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;ht.BAGGAGE_MAX_TOTAL_LENGTH=8192});var kT=f(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.parseKeyPairsIntoRecord=ur.parsePairKeyValue=ur.getKeyPairs=ur.serializeKeyPairs=void 0;var KJ=(y(),I(x)),Os=HT();function WJ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Os.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Os.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}ur.serializeKeyPairs=WJ;function XJ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Os.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}ur.getKeyPairs=XJ;function MC(t){let e=t.split(Os.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let n=e.shift();if(!n)return;let r=n.indexOf(Os.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=decodeURIComponent(n.substring(0,r).trim()),s=decodeURIComponent(n.substring(r+1).trim()),i;return e.length>0&&(i=(0,KJ.baggageEntryMetadataFromString)(e.join(Os.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:i}}ur.parsePairKeyValue=MC;function zJ(t){return typeof t!="string"||t.length===0?{}:t.split(Os.BAGGAGE_ITEMS_SEPARATOR).map(e=>MC(e)).filter(e=>e!==void 0&&e.value.length>0).reduce((e,n)=>(e[n.key]=n.value,e),{})}ur.parseKeyPairsIntoRecord=zJ});var yC=f(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});Mp.W3CBaggagePropagator=void 0;var FT=(y(),I(x)),JJ=bc(),Ns=HT(),jT=kT(),$T=class{inject(e,n,r){let o=FT.propagation.getBaggage(e);if(!o||(0,JJ.isTracingSuppressed)(e))return;let s=(0,jT.getKeyPairs)(o).filter(a=>a.length<=Ns.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Ns.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,jT.serializeKeyPairs)(s);i.length>0&&r.set(n,Ns.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Ns.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Ns.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Ns.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,jT.parsePairKeyValue)(c);if(u){let l={value:u.value};u.metadata&&(l.metadata=u.metadata),i[u.key]=l}}),Object.entries(i).length===0)?e:FT.propagation.setBaggage(e,FT.propagation.createBaggage(i))}fields(){return[Ns.BAGGAGE_HEADER]}};Mp.W3CBaggagePropagator=$T});var vC=f(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.AnchoredClock=void 0;var YT=class{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}};yp.AnchoredClock=YT});var UC=f(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.isAttributeValue=To.isAttributeKey=To.sanitizeAttributes=void 0;var bC=(y(),I(x));function QJ(t){let e={};if(typeof t!="object"||t==null)return e;for(let[n,r]of Object.entries(t)){if(!LC(n)){bC.diag.warn(`Invalid attribute key: ${n}`);continue}if(!DC(r)){bC.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}To.sanitizeAttributes=QJ;function LC(t){return typeof t=="string"&&t.length>0}To.isAttributeKey=LC;function DC(t){return t==null?!0:Array.isArray(t)?ZJ(t):xC(t)}To.isAttributeValue=DC;function ZJ(t){let e;for(let n of t)if(n!=null){if(!e){if(xC(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}function xC(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}});var qT=f(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});vp.loggingErrorHandler=void 0;var eQ=(y(),I(x));function tQ(){return t=>{eQ.diag.error(nQ(t))}}vp.loggingErrorHandler=tQ;function nQ(t){return typeof t=="string"?t:JSON.stringify(rQ(t))}function rQ(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 KT=f(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.globalErrorHandler=Ri.setGlobalErrorHandler=void 0;var oQ=qT(),wC=(0,oQ.loggingErrorHandler)();function sQ(t){wC=t}Ri.setGlobalErrorHandler=sQ;function iQ(t){try{wC(t)}catch{}}Ri.globalErrorHandler=iQ});var WT=f(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.TracesSamplerValues=void 0;var aQ;(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"})(aQ=Lc.TracesSamplerValues||(Lc.TracesSamplerValues={}))});var XT=f(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.parseEnvironment=Ne.DEFAULT_ENVIRONMENT=Ne.DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT=Ne.DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT=Ne.DEFAULT_ATTRIBUTE_COUNT_LIMIT=Ne.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=void 0;var mo=(y(),I(x)),cQ=WT(),uQ=",",lQ=["OTEL_SDK_DISABLED"];function pQ(t){return lQ.indexOf(t)>-1}var dQ=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function _Q(t){return dQ.indexOf(t)>-1}var EQ=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function fQ(t){return EQ.indexOf(t)>-1}Ne.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;Ne.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;Ne.DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT=128;Ne.DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT=128;Ne.DEFAULT_ENVIRONMENT={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:mo.DiagLogLevel.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ne.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,OTEL_ATTRIBUTE_COUNT_LIMIT:Ne.DEFAULT_ATTRIBUTE_COUNT_LIMIT,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ne.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Ne.DEFAULT_ATTRIBUTE_COUNT_LIMIT,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ne.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Ne.DEFAULT_ATTRIBUTE_COUNT_LIMIT,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:Ne.DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:Ne.DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:cQ.TracesSamplerValues.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function SQ(t,e,n){if(typeof n[t]>"u")return;let r=String(n[t]);e[t]=r.toLowerCase()==="true"}function TQ(t,e,n,r=-1/0,o=1/0){if(typeof n[t]<"u"){let s=Number(n[t]);isNaN(s)||(s<r?e[t]=r:s>o?e[t]=o:e[t]=s)}}function mQ(t,e,n,r=uQ){let o=n[t];typeof o=="string"&&(e[t]=o.split(r).map(s=>s.trim()))}var hQ={ALL:mo.DiagLogLevel.ALL,VERBOSE:mo.DiagLogLevel.VERBOSE,DEBUG:mo.DiagLogLevel.DEBUG,INFO:mo.DiagLogLevel.INFO,WARN:mo.DiagLogLevel.WARN,ERROR:mo.DiagLogLevel.ERROR,NONE:mo.DiagLogLevel.NONE};function gQ(t,e,n){let r=n[t];if(typeof r=="string"){let o=hQ[r.toUpperCase()];o!=null&&(e[t]=o)}}function AQ(t){let e={};for(let n in Ne.DEFAULT_ENVIRONMENT){let r=n;switch(r){case"OTEL_LOG_LEVEL":gQ(r,e,t);break;default:if(pQ(r))SQ(r,e,t);else if(_Q(r))TQ(r,e,t);else if(fQ(r))mQ(r,e,t);else{let o=t[r];typeof o<"u"&&o!==null&&(e[r]=String(o))}}}return e}Ne.parseEnvironment=AQ});var VC=f(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.getEnvWithoutDefaults=Oi.getEnv=void 0;var zT=XT();function RQ(){let t=(0,zT.parseEnvironment)(process.env);return Object.assign({},zT.DEFAULT_ENVIRONMENT,t)}Oi.getEnv=RQ;function OQ(){return(0,zT.parseEnvironment)(process.env)}Oi.getEnvWithoutDefaults=OQ});var BC=f(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp._globalThis=void 0;bp._globalThis=typeof globalThis=="object"?globalThis:global});var JT=f(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});Lp.hexToBinary=void 0;function GC(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function NQ(t){let e=new Uint8Array(t.length/2),n=0;for(let r=0;r<t.length;r+=2){let o=GC(t.charCodeAt(r)),s=GC(t.charCodeAt(r+1));e[n++]=o<<4|s}return e}Lp.hexToBinary=NQ});var HC=f(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.hexToBase64=void 0;var IQ=JT();function CQ(t){return Buffer.from((0,IQ.hexToBinary)(t)).toString("base64")}Dp.hexToBase64=CQ});var jC=f(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.RandomIdGenerator=void 0;var PQ=8,FC=16,QT=class{constructor(){this.generateTraceId=kC(FC),this.generateSpanId=kC(PQ)}};Up.RandomIdGenerator=QT;var xp=Buffer.allocUnsafe(FC);function kC(t){return function(){for(let n=0;n<t/4;n++)xp.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(xp[n]>0);n++)n===t-1&&(xp[t-1]=1);return xp.toString("hex",0,t)}}});var $C=f(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.otperformance=void 0;var MQ=require("perf_hooks");wp.otperformance=MQ.performance});var ZT=f(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});Vp.VERSION=void 0;Vp.VERSION="1.30.1"});function Be(t){for(var e={},n=t.length,r=0;r<n;r++){var o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var em=U(()=>{});var YC,qC,KC,WC,XC,zC,JC,QC,ZC,eP,tP,nP,rP,oP,sP,iP,aP,cP,uP,lP,pP,dP,_P,EP,fP,SP,TP,mP,hP,gP,AP,RP,OP,NP,IP,CP,PP,MP,yP,vP,bP,LP,DP,xP,UP,wP,VP,BP,GP,HP,kP,FP,jP,$P,YP,qP,KP,WP,XP,zP,JP,QP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,EM,fM,SM,TM,mM,hM,gM,AM,RM,OM,NM,IM,CM,PM,MM,yM,vM,bM,LM,DM,xM,UM,wM,VM,BM,GM,HM,kM,FM,jM,$M,YM,qM,KM,WM,XM,zM,JM,QM,ZM,ey,ty,ny,ry,oy,sy,iy,ay,cy,uy,ly,yQ,vQ,bQ,LQ,DQ,xQ,UQ,wQ,VQ,BQ,GQ,HQ,kQ,FQ,jQ,$Q,YQ,qQ,KQ,WQ,XQ,zQ,JQ,QQ,ZQ,e9,t9,n9,r9,o9,s9,i9,a9,c9,u9,l9,p9,d9,_9,E9,f9,S9,T9,m9,h9,g9,A9,R9,O9,N9,I9,C9,P9,M9,y9,v9,b9,L9,D9,x9,U9,w9,V9,B9,G9,H9,k9,F9,j9,$9,Y9,q9,K9,W9,X9,z9,J9,Q9,Z9,eZ,tZ,nZ,rZ,oZ,sZ,iZ,aZ,cZ,uZ,lZ,pZ,dZ,_Z,EZ,fZ,SZ,TZ,mZ,hZ,gZ,AZ,RZ,OZ,NZ,IZ,CZ,PZ,MZ,yZ,vZ,bZ,LZ,DZ,xZ,UZ,wZ,VZ,BZ,GZ,HZ,kZ,FZ,jZ,$Z,YZ,qZ,KZ,WZ,XZ,py,dy,_y,Ey,fy,Sy,Ty,my,hy,gy,Ay,Ry,Oy,Ny,Iy,Cy,Py,My,yy,vy,by,Ly,Dy,xy,Uy,wy,Vy,By,Gy,Hy,ky,Fy,jy,$y,Yy,qy,Ky,Wy,Xy,zy,Jy,Qy,Zy,ev,tv,nv,rv,zZ,JZ,QZ,ZZ,e7,t7,n7,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,E7,f7,S7,T7,m7,h7,g7,A7,R7,O7,N7,I7,C7,P7,M7,y7,v7,b7,L7,D7,x7,U7,w7,V7,B7,G7,H7,k7,F7,j7,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,Ev,$7,Y7,q7,K7,W7,X7,z7,J7,Q7,Z7,eee,tee,fv,Sv,Tv,mv,hv,nee,ree,oee,see,iee,aee,gv,Av,Rv,cee,uee,lee,pee,Ov,Nv,Iv,Cv,dee,_ee,Eee,fee,See,Pv,Mv,yv,vv,bv,Lv,Dv,Tee,mee,hee,gee,Aee,Ree,Oee,Nee,xv,Uv,wv,Vv,Bv,Iee,Cee,Pee,Mee,yee,vee,Gv,Hv,kv,Fv,jv,$v,Yv,qv,Kv,Wv,Xv,zv,Jv,Qv,Zv,eb,tb,nb,rb,ob,sb,bee,Lee,Dee,xee,Uee,wee,Vee,Bee,Gee,Hee,kee,Fee,jee,$ee,Yee,qee,Kee,Wee,Xee,zee,Jee,Qee,ib,ab,cb,ub,lb,Zee,ete,tte,nte,rte,ote,pb,db,ste,ite,ate,_b,Eb,cte,ute,lte,fb,Sb,Tb,mb,hb,gb,Ab,Rb,Ob,Nb,Ib,Cb,Pb,Mb,yb,vb,bb,pte,dte,_te,Ete,fte,Ste,Tte,mte,hte,gte,Ate,Rte,Ote,Nte,Ite,Cte,Pte,Mte,Lb,Db,yte,vte,bte,xb=U(()=>{em();YC="aws.lambda.invoked_arn",qC="db.system",KC="db.connection_string",WC="db.user",XC="db.jdbc.driver_classname",zC="db.name",JC="db.statement",QC="db.operation",ZC="db.mssql.instance_name",eP="db.cassandra.keyspace",tP="db.cassandra.page_size",nP="db.cassandra.consistency_level",rP="db.cassandra.table",oP="db.cassandra.idempotence",sP="db.cassandra.speculative_execution_count",iP="db.cassandra.coordinator.id",aP="db.cassandra.coordinator.dc",cP="db.hbase.namespace",uP="db.redis.database_index",lP="db.mongodb.collection",pP="db.sql.table",dP="exception.type",_P="exception.message",EP="exception.stacktrace",fP="exception.escaped",SP="faas.trigger",TP="faas.execution",mP="faas.document.collection",hP="faas.document.operation",gP="faas.document.time",AP="faas.document.name",RP="faas.time",OP="faas.cron",NP="faas.coldstart",IP="faas.invoked_name",CP="faas.invoked_provider",PP="faas.invoked_region",MP="net.transport",yP="net.peer.ip",vP="net.peer.port",bP="net.peer.name",LP="net.host.ip",DP="net.host.port",xP="net.host.name",UP="net.host.connection.type",wP="net.host.connection.subtype",VP="net.host.carrier.name",BP="net.host.carrier.mcc",GP="net.host.carrier.mnc",HP="net.host.carrier.icc",kP="peer.service",FP="enduser.id",jP="enduser.role",$P="enduser.scope",YP="thread.id",qP="thread.name",KP="code.function",WP="code.namespace",XP="code.filepath",zP="code.lineno",JP="http.method",QP="http.url",ZP="http.target",eM="http.host",tM="http.scheme",nM="http.status_code",rM="http.flavor",oM="http.user_agent",sM="http.request_content_length",iM="http.request_content_length_uncompressed",aM="http.response_content_length",cM="http.response_content_length_uncompressed",uM="http.server_name",lM="http.route",pM="http.client_ip",dM="aws.dynamodb.table_names",_M="aws.dynamodb.consumed_capacity",EM="aws.dynamodb.item_collection_metrics",fM="aws.dynamodb.provisioned_read_capacity",SM="aws.dynamodb.provisioned_write_capacity",TM="aws.dynamodb.consistent_read",mM="aws.dynamodb.projection",hM="aws.dynamodb.limit",gM="aws.dynamodb.attributes_to_get",AM="aws.dynamodb.index_name",RM="aws.dynamodb.select",OM="aws.dynamodb.global_secondary_indexes",NM="aws.dynamodb.local_secondary_indexes",IM="aws.dynamodb.exclusive_start_table",CM="aws.dynamodb.table_count",PM="aws.dynamodb.scan_forward",MM="aws.dynamodb.segment",yM="aws.dynamodb.total_segments",vM="aws.dynamodb.count",bM="aws.dynamodb.scanned_count",LM="aws.dynamodb.attribute_definitions",DM="aws.dynamodb.global_secondary_index_updates",xM="messaging.system",UM="messaging.destination",wM="messaging.destination_kind",VM="messaging.temp_destination",BM="messaging.protocol",GM="messaging.protocol_version",HM="messaging.url",kM="messaging.message_id",FM="messaging.conversation_id",jM="messaging.message_payload_size_bytes",$M="messaging.message_payload_compressed_size_bytes",YM="messaging.operation",qM="messaging.consumer_id",KM="messaging.rabbitmq.routing_key",WM="messaging.kafka.message_key",XM="messaging.kafka.consumer_group",zM="messaging.kafka.client_id",JM="messaging.kafka.partition",QM="messaging.kafka.tombstone",ZM="rpc.system",ey="rpc.service",ty="rpc.method",ny="rpc.grpc.status_code",ry="rpc.jsonrpc.version",oy="rpc.jsonrpc.request_id",sy="rpc.jsonrpc.error_code",iy="rpc.jsonrpc.error_message",ay="message.type",cy="message.id",uy="message.compressed_size",ly="message.uncompressed_size",yQ=YC,vQ=qC,bQ=KC,LQ=WC,DQ=XC,xQ=zC,UQ=JC,wQ=QC,VQ=ZC,BQ=eP,GQ=tP,HQ=nP,kQ=rP,FQ=oP,jQ=sP,$Q=iP,YQ=aP,qQ=cP,KQ=uP,WQ=lP,XQ=pP,zQ=dP,JQ=_P,QQ=EP,ZQ=fP,e9=SP,t9=TP,n9=mP,r9=hP,o9=gP,s9=AP,i9=RP,a9=OP,c9=NP,u9=IP,l9=CP,p9=PP,d9=MP,_9=yP,E9=vP,f9=bP,S9=LP,T9=DP,m9=xP,h9=UP,g9=wP,A9=VP,R9=BP,O9=GP,N9=HP,I9=kP,C9=FP,P9=jP,M9=$P,y9=YP,v9=qP,b9=KP,L9=WP,D9=XP,x9=zP,U9=JP,w9=QP,V9=ZP,B9=eM,G9=tM,H9=nM,k9=rM,F9=oM,j9=sM,$9=iM,Y9=aM,q9=cM,K9=uM,W9=lM,X9=pM,z9=dM,J9=_M,Q9=EM,Z9=fM,eZ=SM,tZ=TM,nZ=mM,rZ=hM,oZ=gM,sZ=AM,iZ=RM,aZ=OM,cZ=NM,uZ=IM,lZ=CM,pZ=PM,dZ=MM,_Z=yM,EZ=vM,fZ=bM,SZ=LM,TZ=DM,mZ=xM,hZ=UM,gZ=wM,AZ=VM,RZ=BM,OZ=GM,NZ=HM,IZ=kM,CZ=FM,PZ=jM,MZ=$M,yZ=YM,vZ=qM,bZ=KM,LZ=WM,DZ=XM,xZ=zM,UZ=JM,wZ=QM,VZ=ZM,BZ=ey,GZ=ty,HZ=ny,kZ=ry,FZ=oy,jZ=sy,$Z=iy,YZ=ay,qZ=cy,KZ=uy,WZ=ly,XZ=Be([YC,qC,KC,WC,XC,zC,JC,QC,ZC,eP,tP,nP,rP,oP,sP,iP,aP,cP,uP,lP,pP,dP,_P,EP,fP,SP,TP,mP,hP,gP,AP,RP,OP,NP,IP,CP,PP,MP,yP,vP,bP,LP,DP,xP,UP,wP,VP,BP,GP,HP,kP,FP,jP,$P,YP,qP,KP,WP,XP,zP,JP,QP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,EM,fM,SM,TM,mM,hM,gM,AM,RM,OM,NM,IM,CM,PM,MM,yM,vM,bM,LM,DM,xM,UM,wM,VM,BM,GM,HM,kM,FM,jM,$M,YM,qM,KM,WM,XM,zM,JM,QM,ZM,ey,ty,ny,ry,oy,sy,iy,ay,cy,uy,ly]),py="other_sql",dy="mssql",_y="mysql",Ey="oracle",fy="db2",Sy="postgresql",Ty="redshift",my="hive",hy="cloudscape",gy="hsqldb",Ay="progress",Ry="maxdb",Oy="hanadb",Ny="ingres",Iy="firstsql",Cy="edb",Py="cache",My="adabas",yy="firebird",vy="derby",by="filemaker",Ly="informix",Dy="instantdb",xy="interbase",Uy="mariadb",wy="netezza",Vy="pervasive",By="pointbase",Gy="sqlite",Hy="sybase",ky="teradata",Fy="vertica",jy="h2",$y="coldfusion",Yy="cassandra",qy="hbase",Ky="mongodb",Wy="redis",Xy="couchbase",zy="couchdb",Jy="cosmosdb",Qy="dynamodb",Zy="neo4j",ev="geode",tv="elasticsearch",nv="memcached",rv="cockroachdb",zZ=py,JZ=dy,QZ=_y,ZZ=Ey,e7=fy,t7=Sy,n7=Ty,r7=my,o7=hy,s7=gy,i7=Ay,a7=Ry,c7=Oy,u7=Ny,l7=Iy,p7=Cy,d7=Py,_7=My,E7=yy,f7=vy,S7=by,T7=Ly,m7=Dy,h7=xy,g7=Uy,A7=wy,R7=Vy,O7=By,N7=Gy,I7=Hy,C7=ky,P7=Fy,M7=jy,y7=$y,v7=Yy,b7=qy,L7=Ky,D7=Wy,x7=Xy,U7=zy,w7=Jy,V7=Qy,B7=Zy,G7=ev,H7=tv,k7=nv,F7=rv,j7=Be([py,dy,_y,Ey,fy,Sy,Ty,my,hy,gy,Ay,Ry,Oy,Ny,Iy,Cy,Py,My,yy,vy,by,Ly,Dy,xy,Uy,wy,Vy,By,Gy,Hy,ky,Fy,jy,$y,Yy,qy,Ky,Wy,Xy,zy,Jy,Qy,Zy,ev,tv,nv,rv]),ov="all",sv="each_quorum",iv="quorum",av="local_quorum",cv="one",uv="two",lv="three",pv="local_one",dv="any",_v="serial",Ev="local_serial",$7=ov,Y7=sv,q7=iv,K7=av,W7=cv,X7=uv,z7=lv,J7=pv,Q7=dv,Z7=_v,eee=Ev,tee=Be([ov,sv,iv,av,cv,uv,lv,pv,dv,_v,Ev]),fv="datasource",Sv="http",Tv="pubsub",mv="timer",hv="other",nee=fv,ree=Sv,oee=Tv,see=mv,iee=hv,aee=Be([fv,Sv,Tv,mv,hv]),gv="insert",Av="edit",Rv="delete",cee=gv,uee=Av,lee=Rv,pee=Be([gv,Av,Rv]),Ov="alibaba_cloud",Nv="aws",Iv="azure",Cv="gcp",dee=Ov,_ee=Nv,Eee=Iv,fee=Cv,See=Be([Ov,Nv,Iv,Cv]),Pv="ip_tcp",Mv="ip_udp",yv="ip",vv="unix",bv="pipe",Lv="inproc",Dv="other",Tee=Pv,mee=Mv,hee=yv,gee=vv,Aee=bv,Ree=Lv,Oee=Dv,Nee=Be([Pv,Mv,yv,vv,bv,Lv,Dv]),xv="wifi",Uv="wired",wv="cell",Vv="unavailable",Bv="unknown",Iee=xv,Cee=Uv,Pee=wv,Mee=Vv,yee=Bv,vee=Be([xv,Uv,wv,Vv,Bv]),Gv="gprs",Hv="edge",kv="umts",Fv="cdma",jv="evdo_0",$v="evdo_a",Yv="cdma2000_1xrtt",qv="hsdpa",Kv="hsupa",Wv="hspa",Xv="iden",zv="evdo_b",Jv="lte",Qv="ehrpd",Zv="hspap",eb="gsm",tb="td_scdma",nb="iwlan",rb="nr",ob="nrnsa",sb="lte_ca",bee=Gv,Lee=Hv,Dee=kv,xee=Fv,Uee=jv,wee=$v,Vee=Yv,Bee=qv,Gee=Kv,Hee=Wv,kee=Xv,Fee=zv,jee=Jv,$ee=Qv,Yee=Zv,qee=eb,Kee=tb,Wee=nb,Xee=rb,zee=ob,Jee=sb,Qee=Be([Gv,Hv,kv,Fv,jv,$v,Yv,qv,Kv,Wv,Xv,zv,Jv,Qv,Zv,eb,tb,nb,rb,ob,sb]),ib="1.0",ab="1.1",cb="2.0",ub="SPDY",lb="QUIC",Zee=ib,ete=ab,tte=cb,nte=ub,rte=lb,ote={HTTP_1_0:ib,HTTP_1_1:ab,HTTP_2_0:cb,SPDY:ub,QUIC:lb},pb="queue",db="topic",ste=pb,ite=db,ate=Be([pb,db]),_b="receive",Eb="process",cte=_b,ute=Eb,lte=Be([_b,Eb]),fb=0,Sb=1,Tb=2,mb=3,hb=4,gb=5,Ab=6,Rb=7,Ob=8,Nb=9,Ib=10,Cb=11,Pb=12,Mb=13,yb=14,vb=15,bb=16,pte=fb,dte=Sb,_te=Tb,Ete=mb,fte=hb,Ste=gb,Tte=Ab,mte=Rb,hte=Ob,gte=Nb,Ate=Ib,Rte=Cb,Ote=Pb,Nte=Mb,Ite=yb,Cte=vb,Pte=bb,Mte={OK:fb,CANCELLED:Sb,UNKNOWN:Tb,INVALID_ARGUMENT:mb,DEADLINE_EXCEEDED:hb,NOT_FOUND:gb,ALREADY_EXISTS:Ab,PERMISSION_DENIED:Rb,RESOURCE_EXHAUSTED:Ob,FAILED_PRECONDITION:Nb,ABORTED:Ib,OUT_OF_RANGE:Cb,UNIMPLEMENTED:Pb,INTERNAL:Mb,UNAVAILABLE:yb,DATA_LOSS:vb,UNAUTHENTICATED:bb},Lb="SENT",Db="RECEIVED",yte=Lb,vte=Db,bte=Be([Lb,Db])});var Ub=U(()=>{xb()});var wb,Vb,Bb,Gb,Hb,kb,Fb,jb,$b,Yb,qb,Kb,Wb,Xb,zb,Jb,Qb,Zb,eL,tL,nL,rL,oL,sL,iL,aL,cL,uL,lL,pL,dL,_L,EL,fL,SL,TL,mL,hL,gL,AL,RL,OL,NL,IL,CL,PL,ML,yL,vL,bL,LL,DL,xL,UL,wL,VL,BL,GL,HL,kL,FL,jL,$L,YL,qL,KL,WL,XL,zL,JL,QL,ZL,eD,tD,nD,rD,oD,sD,iD,aD,cD,Lte,Dte,xte,Ute,wte,Vte,Bte,Gte,Hte,kte,Fte,jte,$te,Yte,qte,Kte,Wte,Xte,zte,Jte,Qte,Zte,ene,tne,nne,rne,one,sne,ine,ane,cne,une,lne,pne,dne,_ne,Ene,fne,Sne,Tne,mne,hne,gne,Ane,Rne,One,Nne,Ine,Cne,Pne,Mne,yne,vne,bne,Lne,Dne,xne,Une,wne,Vne,Bne,Gne,Hne,kne,Fne,jne,$ne,Yne,qne,Kne,Wne,Xne,zne,Jne,Qne,Zne,ere,tre,nre,rre,ore,sre,uD,lD,pD,dD,ire,are,cre,ure,lre,_D,ED,fD,SD,TD,mD,hD,gD,AD,RD,OD,ND,ID,CD,PD,MD,yD,pre,dre,_re,Ere,fre,Sre,Tre,mre,hre,gre,Are,Rre,Ore,Nre,Ire,Cre,Pre,Mre,vD,bD,yre,vre,bre,LD,DD,xD,UD,wD,VD,BD,Lre,Dre,xre,Ure,wre,Vre,Bre,Gre,GD,HD,kD,FD,jD,$D,YD,qD,KD,WD,XD,Hre,kre,Fre,jre,$re,Yre,qre,Kre,Wre,Xre,zre,Jre,zD,JD,QD,ZD,ex,tx,nx,rx,ox,sx,Qre,Zre,eoe,toe,noe,roe,ooe,soe,ioe,aoe,coe,ix=U(()=>{em();wb="cloud.provider",Vb="cloud.account.id",Bb="cloud.region",Gb="cloud.availability_zone",Hb="cloud.platform",kb="aws.ecs.container.arn",Fb="aws.ecs.cluster.arn",jb="aws.ecs.launchtype",$b="aws.ecs.task.arn",Yb="aws.ecs.task.family",qb="aws.ecs.task.revision",Kb="aws.eks.cluster.arn",Wb="aws.log.group.names",Xb="aws.log.group.arns",zb="aws.log.stream.names",Jb="aws.log.stream.arns",Qb="container.name",Zb="container.id",eL="container.runtime",tL="container.image.name",nL="container.image.tag",rL="deployment.environment",oL="device.id",sL="device.model.identifier",iL="device.model.name",aL="faas.name",cL="faas.id",uL="faas.version",lL="faas.instance",pL="faas.max_memory",dL="host.id",_L="host.name",EL="host.type",fL="host.arch",SL="host.image.name",TL="host.image.id",mL="host.image.version",hL="k8s.cluster.name",gL="k8s.node.name",AL="k8s.node.uid",RL="k8s.namespace.name",OL="k8s.pod.uid",NL="k8s.pod.name",IL="k8s.container.name",CL="k8s.replicaset.uid",PL="k8s.replicaset.name",ML="k8s.deployment.uid",yL="k8s.deployment.name",vL="k8s.statefulset.uid",bL="k8s.statefulset.name",LL="k8s.daemonset.uid",DL="k8s.daemonset.name",xL="k8s.job.uid",UL="k8s.job.name",wL="k8s.cronjob.uid",VL="k8s.cronjob.name",BL="os.type",GL="os.description",HL="os.name",kL="os.version",FL="process.pid",jL="process.executable.name",$L="process.executable.path",YL="process.command",qL="process.command_line",KL="process.command_args",WL="process.owner",XL="process.runtime.name",zL="process.runtime.version",JL="process.runtime.description",QL="service.name",ZL="service.namespace",eD="service.instance.id",tD="service.version",nD="telemetry.sdk.name",rD="telemetry.sdk.language",oD="telemetry.sdk.version",sD="telemetry.auto.version",iD="webengine.name",aD="webengine.version",cD="webengine.description",Lte=wb,Dte=Vb,xte=Bb,Ute=Gb,wte=Hb,Vte=kb,Bte=Fb,Gte=jb,Hte=$b,kte=Yb,Fte=qb,jte=Kb,$te=Wb,Yte=Xb,qte=zb,Kte=Jb,Wte=Qb,Xte=Zb,zte=eL,Jte=tL,Qte=nL,Zte=rL,ene=oL,tne=sL,nne=iL,rne=aL,one=cL,sne=uL,ine=lL,ane=pL,cne=dL,une=_L,lne=EL,pne=fL,dne=SL,_ne=TL,Ene=mL,fne=hL,Sne=gL,Tne=AL,mne=RL,hne=OL,gne=NL,Ane=IL,Rne=CL,One=PL,Nne=ML,Ine=yL,Cne=vL,Pne=bL,Mne=LL,yne=DL,vne=xL,bne=UL,Lne=wL,Dne=VL,xne=BL,Une=GL,wne=HL,Vne=kL,Bne=FL,Gne=jL,Hne=$L,kne=YL,Fne=qL,jne=KL,$ne=WL,Yne=XL,qne=zL,Kne=JL,Wne=QL,Xne=ZL,zne=eD,Jne=tD,Qne=nD,Zne=rD,ere=oD,tre=sD,nre=iD,rre=aD,ore=cD,sre=Be([wb,Vb,Bb,Gb,Hb,kb,Fb,jb,$b,Yb,qb,Kb,Wb,Xb,zb,Jb,Qb,Zb,eL,tL,nL,rL,oL,sL,iL,aL,cL,uL,lL,pL,dL,_L,EL,fL,SL,TL,mL,hL,gL,AL,RL,OL,NL,IL,CL,PL,ML,yL,vL,bL,LL,DL,xL,UL,wL,VL,BL,GL,HL,kL,FL,jL,$L,YL,qL,KL,WL,XL,zL,JL,QL,ZL,eD,tD,nD,rD,oD,sD,iD,aD,cD]),uD="alibaba_cloud",lD="aws",pD="azure",dD="gcp",ire=uD,are=lD,cre=pD,ure=dD,lre=Be([uD,lD,pD,dD]),_D="alibaba_cloud_ecs",ED="alibaba_cloud_fc",fD="aws_ec2",SD="aws_ecs",TD="aws_eks",mD="aws_lambda",hD="aws_elastic_beanstalk",gD="azure_vm",AD="azure_container_instances",RD="azure_aks",OD="azure_functions",ND="azure_app_service",ID="gcp_compute_engine",CD="gcp_cloud_run",PD="gcp_kubernetes_engine",MD="gcp_cloud_functions",yD="gcp_app_engine",pre=_D,dre=ED,_re=fD,Ere=SD,fre=TD,Sre=mD,Tre=hD,mre=gD,hre=AD,gre=RD,Are=OD,Rre=ND,Ore=ID,Nre=CD,Ire=PD,Cre=MD,Pre=yD,Mre=Be([_D,ED,fD,SD,TD,mD,hD,gD,AD,RD,OD,ND,ID,CD,PD,MD,yD]),vD="ec2",bD="fargate",yre=vD,vre=bD,bre=Be([vD,bD]),LD="amd64",DD="arm32",xD="arm64",UD="ia64",wD="ppc32",VD="ppc64",BD="x86",Lre=LD,Dre=DD,xre=xD,Ure=UD,wre=wD,Vre=VD,Bre=BD,Gre=Be([LD,DD,xD,UD,wD,VD,BD]),GD="windows",HD="linux",kD="darwin",FD="freebsd",jD="netbsd",$D="openbsd",YD="dragonflybsd",qD="hpux",KD="aix",WD="solaris",XD="z_os",Hre=GD,kre=HD,Fre=kD,jre=FD,$re=jD,Yre=$D,qre=YD,Kre=qD,Wre=KD,Xre=WD,zre=XD,Jre=Be([GD,HD,kD,FD,jD,$D,YD,qD,KD,WD,XD]),zD="cpp",JD="dotnet",QD="erlang",ZD="go",ex="java",tx="nodejs",nx="php",rx="python",ox="ruby",sx="webjs",Qre=zD,Zre=JD,eoe=QD,toe=ZD,noe=ex,roe=tx,ooe=nx,soe=rx,ioe=ox,aoe=sx,coe=Be([zD,JD,QD,ZD,ex,tx,nx,rx,ox,sx])});var ax=U(()=>{ix()});var uoe,loe,poe,doe,_oe,Eoe,foe,Soe,Toe,moe,hoe,goe,Aoe,Roe,Ooe,Noe,Ioe,Coe,Poe,Moe,yoe,voe,boe,Loe,Doe,xoe,Uoe,woe,Voe,Boe,Goe,Hoe,koe,Foe,joe,$oe,Yoe,qoe,Koe,Woe,Xoe,zoe,Joe,Qoe,Zoe,ese,tse,nse,rse,ose,sse,ise,ase,cse,use,lse,pse,dse,_se,Ese,fse,Sse,Tse,mse,hse,gse,Ase,Rse,Ose,Nse,Ise,Cse,Pse,Mse,yse,vse,bse,Lse,Dse,xse,Use,wse,Vse,Bse,Gse,Hse,kse,Fse,jse,$se,Yse,qse,Kse,Wse,Xse,zse,Jse,Qse,Zse,eie,tie,nie,rie,oie,sie,iie,aie,cie,uie,lie,cx=U(()=>{uoe="aspnetcore.rate_limiting.result",loe="acquired",poe="endpoint_limiter",doe="global_limiter",_oe="request_canceled",Eoe="telemetry.sdk.language",foe="cpp",Soe="dotnet",Toe="erlang",moe="go",hoe="java",goe="nodejs",Aoe="php",Roe="python",Ooe="ruby",Noe="rust",Ioe="swift",Coe="webjs",Poe="telemetry.sdk.name",Moe="telemetry.sdk.version",yoe="aspnetcore.diagnostics.handler.type",voe="aspnetcore.diagnostics.exception.result",boe="aborted",Loe="handled",Doe="skipped",xoe="unhandled",Uoe="aspnetcore.rate_limiting.policy",woe="aspnetcore.request.is_unhandled",Voe="aspnetcore.routing.is_fallback",Boe="aspnetcore.routing.match_status",Goe="failure",Hoe="success",koe="client.address",Foe="client.port",joe="error.type",$oe="_OTHER",Yoe="exception.escaped",qoe="exception.message",Koe="exception.stacktrace",Woe="exception.type",Xoe=function(t){return"http.request.header."+t},zoe="http.request.method",Joe="_OTHER",Qoe="CONNECT",Zoe="DELETE",ese="GET",tse="HEAD",nse="OPTIONS",rse="PATCH",ose="POST",sse="PUT",ise="TRACE",ase="http.request.method_original",cse="http.request.resend_count",use=function(t){return"http.response.header."+t},lse="http.response.status_code",pse="http.route",dse="jvm.gc.action",_se="jvm.gc.name",Ese="jvm.memory.pool.name",fse="jvm.memory.type",Sse="heap",Tse="non_heap",mse="jvm.thread.daemon",hse="jvm.thread.state",gse="blocked",Ase="new",Rse="runnable",Ose="terminated",Nse="timed_waiting",Ise="waiting",Cse="network.local.address",Pse="network.local.port",Mse="network.peer.address",yse="network.peer.port",vse="network.protocol.name",bse="network.protocol.version",Lse="network.transport",Dse="pipe",xse="quic",Use="tcp",wse="udp",Vse="unix",Bse="network.type",Gse="ipv4",Hse="ipv6",kse="otel.scope.name",Fse="otel.scope.version",jse="otel.status_code",$se="ERROR",Yse="OK",qse="otel.status_description",Kse="server.address",Wse="server.port",Xse="service.name",zse="service.version",Jse="signalr.connection.status",Qse="app_shutdown",Zse="normal_closure",eie="timeout",tie="signalr.transport",nie="long_polling",rie="server_sent_events",oie="web_sockets",sie="url.fragment",iie="url.full",aie="url.path",cie="url.query",uie="url.scheme",lie="user_agent.original"});var pie,die,_ie,Eie,fie,Sie,Tie,mie,hie,gie,Aie,Rie,Oie,Nie,Iie,Cie,Pie,Mie,yie,vie,bie,Lie,Die,xie,Uie,wie,Vie,Bie,Gie,Hie,kie,ux=U(()=>{pie="aspnetcore.diagnostics.exceptions",die="aspnetcore.rate_limiting.active_request_leases",_ie="aspnetcore.rate_limiting.queued_requests",Eie="aspnetcore.rate_limiting.request.time_in_queue",fie="aspnetcore.rate_limiting.request_lease.duration",Sie="aspnetcore.rate_limiting.requests",Tie="aspnetcore.routing.match_attempts",mie="http.client.request.duration",hie="http.server.request.duration",gie="jvm.class.count",Aie="jvm.class.loaded",Rie="jvm.class.unloaded",Oie="jvm.cpu.count",Nie="jvm.cpu.recent_utilization",Iie="jvm.cpu.time",Cie="jvm.gc.duration",Pie="jvm.memory.committed",Mie="jvm.memory.limit",yie="jvm.memory.used",vie="jvm.memory.used_after_last_gc",bie="jvm.thread.count",Lie="kestrel.active_connections",Die="kestrel.active_tls_handshakes",xie="kestrel.connection.duration",Uie="kestrel.queued_connections",wie="kestrel.queued_requests",Vie="kestrel.rejected_connections",Bie="kestrel.tls_handshake.duration",Gie="kestrel.upgraded_connections",Hie="signalr.server.active_connections",kie="signalr.server.connection.duration"});var mn={};mS(mn,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>boe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>Loe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>Doe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>xoe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>loe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>poe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>doe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>_oe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>Goe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>Hoe,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>voe,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>yoe,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>Uoe,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>uoe,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>woe,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>Voe,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>Boe,ATTR_CLIENT_ADDRESS:()=>koe,ATTR_CLIENT_PORT:()=>Foe,ATTR_ERROR_TYPE:()=>joe,ATTR_EXCEPTION_ESCAPED:()=>Yoe,ATTR_EXCEPTION_MESSAGE:()=>qoe,ATTR_EXCEPTION_STACKTRACE:()=>Koe,ATTR_EXCEPTION_TYPE:()=>Woe,ATTR_HTTP_REQUEST_HEADER:()=>Xoe,ATTR_HTTP_REQUEST_METHOD:()=>zoe,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>ase,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>cse,ATTR_HTTP_RESPONSE_HEADER:()=>use,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>lse,ATTR_HTTP_ROUTE:()=>pse,ATTR_JVM_GC_ACTION:()=>dse,ATTR_JVM_GC_NAME:()=>_se,ATTR_JVM_MEMORY_POOL_NAME:()=>Ese,ATTR_JVM_MEMORY_TYPE:()=>fse,ATTR_JVM_THREAD_DAEMON:()=>mse,ATTR_JVM_THREAD_STATE:()=>hse,ATTR_NETWORK_LOCAL_ADDRESS:()=>Cse,ATTR_NETWORK_LOCAL_PORT:()=>Pse,ATTR_NETWORK_PEER_ADDRESS:()=>Mse,ATTR_NETWORK_PEER_PORT:()=>yse,ATTR_NETWORK_PROTOCOL_NAME:()=>vse,ATTR_NETWORK_PROTOCOL_VERSION:()=>bse,ATTR_NETWORK_TRANSPORT:()=>Lse,ATTR_NETWORK_TYPE:()=>Bse,ATTR_OTEL_SCOPE_NAME:()=>kse,ATTR_OTEL_SCOPE_VERSION:()=>Fse,ATTR_OTEL_STATUS_CODE:()=>jse,ATTR_OTEL_STATUS_DESCRIPTION:()=>qse,ATTR_SERVER_ADDRESS:()=>Kse,ATTR_SERVER_PORT:()=>Wse,ATTR_SERVICE_NAME:()=>Xse,ATTR_SERVICE_VERSION:()=>zse,ATTR_SIGNALR_CONNECTION_STATUS:()=>Jse,ATTR_SIGNALR_TRANSPORT:()=>tie,ATTR_TELEMETRY_SDK_LANGUAGE:()=>Eoe,ATTR_TELEMETRY_SDK_NAME:()=>Poe,ATTR_TELEMETRY_SDK_VERSION:()=>Moe,ATTR_URL_FRAGMENT:()=>sie,ATTR_URL_FULL:()=>iie,ATTR_URL_PATH:()=>aie,ATTR_URL_QUERY:()=>cie,ATTR_URL_SCHEME:()=>uie,ATTR_USER_AGENT_ORIGINAL:()=>lie,AWSECSLAUNCHTYPEVALUES_EC2:()=>yre,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>vre,AwsEcsLaunchtypeValues:()=>bre,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>pre,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>dre,CLOUDPLATFORMVALUES_AWS_EC2:()=>_re,CLOUDPLATFORMVALUES_AWS_ECS:()=>Ere,CLOUDPLATFORMVALUES_AWS_EKS:()=>fre,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>Tre,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>Sre,CLOUDPLATFORMVALUES_AZURE_AKS:()=>gre,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>Rre,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>hre,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>Are,CLOUDPLATFORMVALUES_AZURE_VM:()=>mre,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>Pre,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>Cre,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>Nre,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>Ore,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>Ire,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>ire,CLOUDPROVIDERVALUES_AWS:()=>are,CLOUDPROVIDERVALUES_AZURE:()=>cre,CLOUDPROVIDERVALUES_GCP:()=>ure,CloudPlatformValues:()=>Mre,CloudProviderValues:()=>lre,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>$7,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>Q7,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>Y7,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>J7,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>K7,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>eee,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>W7,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>q7,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>Z7,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>z7,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>X7,DBSYSTEMVALUES_ADABAS:()=>_7,DBSYSTEMVALUES_CACHE:()=>d7,DBSYSTEMVALUES_CASSANDRA:()=>v7,DBSYSTEMVALUES_CLOUDSCAPE:()=>o7,DBSYSTEMVALUES_COCKROACHDB:()=>F7,DBSYSTEMVALUES_COLDFUSION:()=>y7,DBSYSTEMVALUES_COSMOSDB:()=>w7,DBSYSTEMVALUES_COUCHBASE:()=>x7,DBSYSTEMVALUES_COUCHDB:()=>U7,DBSYSTEMVALUES_DB2:()=>e7,DBSYSTEMVALUES_DERBY:()=>f7,DBSYSTEMVALUES_DYNAMODB:()=>V7,DBSYSTEMVALUES_EDB:()=>p7,DBSYSTEMVALUES_ELASTICSEARCH:()=>H7,DBSYSTEMVALUES_FILEMAKER:()=>S7,DBSYSTEMVALUES_FIREBIRD:()=>E7,DBSYSTEMVALUES_FIRSTSQL:()=>l7,DBSYSTEMVALUES_GEODE:()=>G7,DBSYSTEMVALUES_H2:()=>M7,DBSYSTEMVALUES_HANADB:()=>c7,DBSYSTEMVALUES_HBASE:()=>b7,DBSYSTEMVALUES_HIVE:()=>r7,DBSYSTEMVALUES_HSQLDB:()=>s7,DBSYSTEMVALUES_INFORMIX:()=>T7,DBSYSTEMVALUES_INGRES:()=>u7,DBSYSTEMVALUES_INSTANTDB:()=>m7,DBSYSTEMVALUES_INTERBASE:()=>h7,DBSYSTEMVALUES_MARIADB:()=>g7,DBSYSTEMVALUES_MAXDB:()=>a7,DBSYSTEMVALUES_MEMCACHED:()=>k7,DBSYSTEMVALUES_MONGODB:()=>L7,DBSYSTEMVALUES_MSSQL:()=>JZ,DBSYSTEMVALUES_MYSQL:()=>QZ,DBSYSTEMVALUES_NEO4J:()=>B7,DBSYSTEMVALUES_NETEZZA:()=>A7,DBSYSTEMVALUES_ORACLE:()=>ZZ,DBSYSTEMVALUES_OTHER_SQL:()=>zZ,DBSYSTEMVALUES_PERVASIVE:()=>R7,DBSYSTEMVALUES_POINTBASE:()=>O7,DBSYSTEMVALUES_POSTGRESQL:()=>t7,DBSYSTEMVALUES_PROGRESS:()=>i7,DBSYSTEMVALUES_REDIS:()=>D7,DBSYSTEMVALUES_REDSHIFT:()=>n7,DBSYSTEMVALUES_SQLITE:()=>N7,DBSYSTEMVALUES_SYBASE:()=>I7,DBSYSTEMVALUES_TERADATA:()=>C7,DBSYSTEMVALUES_VERTICA:()=>P7,DbCassandraConsistencyLevelValues:()=>tee,DbSystemValues:()=>j7,ERROR_TYPE_VALUE_OTHER:()=>$oe,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>lee,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>uee,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>cee,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>dee,FAASINVOKEDPROVIDERVALUES_AWS:()=>_ee,FAASINVOKEDPROVIDERVALUES_AZURE:()=>Eee,FAASINVOKEDPROVIDERVALUES_GCP:()=>fee,FAASTRIGGERVALUES_DATASOURCE:()=>nee,FAASTRIGGERVALUES_HTTP:()=>ree,FAASTRIGGERVALUES_OTHER:()=>iee,FAASTRIGGERVALUES_PUBSUB:()=>oee,FAASTRIGGERVALUES_TIMER:()=>see,FaasDocumentOperationValues:()=>pee,FaasInvokedProviderValues:()=>See,FaasTriggerValues:()=>aee,HOSTARCHVALUES_AMD64:()=>Lre,HOSTARCHVALUES_ARM32:()=>Dre,HOSTARCHVALUES_ARM64:()=>xre,HOSTARCHVALUES_IA64:()=>Ure,HOSTARCHVALUES_PPC32:()=>wre,HOSTARCHVALUES_PPC64:()=>Vre,HOSTARCHVALUES_X86:()=>Bre,HTTPFLAVORVALUES_HTTP_1_0:()=>Zee,HTTPFLAVORVALUES_HTTP_1_1:()=>ete,HTTPFLAVORVALUES_HTTP_2_0:()=>tte,HTTPFLAVORVALUES_QUIC:()=>rte,HTTPFLAVORVALUES_SPDY:()=>nte,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>Qoe,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>Zoe,HTTP_REQUEST_METHOD_VALUE_GET:()=>ese,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>tse,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>nse,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>Joe,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>rse,HTTP_REQUEST_METHOD_VALUE_POST:()=>ose,HTTP_REQUEST_METHOD_VALUE_PUT:()=>sse,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>ise,HostArchValues:()=>Gre,HttpFlavorValues:()=>ote,JVM_MEMORY_TYPE_VALUE_HEAP:()=>Sse,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>Tse,JVM_THREAD_STATE_VALUE_BLOCKED:()=>gse,JVM_THREAD_STATE_VALUE_NEW:()=>Ase,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>Rse,JVM_THREAD_STATE_VALUE_TERMINATED:()=>Ose,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>Nse,JVM_THREAD_STATE_VALUE_WAITING:()=>Ise,MESSAGETYPEVALUES_RECEIVED:()=>vte,MESSAGETYPEVALUES_SENT:()=>yte,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>ste,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>ite,MESSAGINGOPERATIONVALUES_PROCESS:()=>ute,MESSAGINGOPERATIONVALUES_RECEIVE:()=>cte,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>pie,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>die,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>_ie,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>Sie,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>fie,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>Eie,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>Tie,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>mie,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>hie,METRIC_JVM_CLASS_COUNT:()=>gie,METRIC_JVM_CLASS_LOADED:()=>Aie,METRIC_JVM_CLASS_UNLOADED:()=>Rie,METRIC_JVM_CPU_COUNT:()=>Oie,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Nie,METRIC_JVM_CPU_TIME:()=>Iie,METRIC_JVM_GC_DURATION:()=>Cie,METRIC_JVM_MEMORY_COMMITTED:()=>Pie,METRIC_JVM_MEMORY_LIMIT:()=>Mie,METRIC_JVM_MEMORY_USED:()=>yie,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>vie,METRIC_JVM_THREAD_COUNT:()=>bie,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Lie,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Die,METRIC_KESTREL_CONNECTION_DURATION:()=>xie,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Uie,METRIC_KESTREL_QUEUED_REQUESTS:()=>wie,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>Vie,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>Bie,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>Gie,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>Hie,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>kie,MessageTypeValues:()=>bte,MessagingDestinationKindValues:()=>ate,MessagingOperationValues:()=>lte,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>xee,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>Vee,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>Lee,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>$ee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>Uee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>wee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>Fee,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>bee,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>qee,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>Bee,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>Hee,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>Yee,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>Gee,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>kee,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>Wee,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>jee,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>Jee,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>Xee,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>zee,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>Kee,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>Dee,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>Pee,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>Mee,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>yee,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>Iee,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>Cee,NETTRANSPORTVALUES_INPROC:()=>Ree,NETTRANSPORTVALUES_IP:()=>hee,NETTRANSPORTVALUES_IP_TCP:()=>Tee,NETTRANSPORTVALUES_IP_UDP:()=>mee,NETTRANSPORTVALUES_OTHER:()=>Oee,NETTRANSPORTVALUES_PIPE:()=>Aee,NETTRANSPORTVALUES_UNIX:()=>gee,NETWORK_TRANSPORT_VALUE_PIPE:()=>Dse,NETWORK_TRANSPORT_VALUE_QUIC:()=>xse,NETWORK_TRANSPORT_VALUE_TCP:()=>Use,NETWORK_TRANSPORT_VALUE_UDP:()=>wse,NETWORK_TRANSPORT_VALUE_UNIX:()=>Vse,NETWORK_TYPE_VALUE_IPV4:()=>Gse,NETWORK_TYPE_VALUE_IPV6:()=>Hse,NetHostConnectionSubtypeValues:()=>Qee,NetHostConnectionTypeValues:()=>vee,NetTransportValues:()=>Nee,OSTYPEVALUES_AIX:()=>Wre,OSTYPEVALUES_DARWIN:()=>Fre,OSTYPEVALUES_DRAGONFLYBSD:()=>qre,OSTYPEVALUES_FREEBSD:()=>jre,OSTYPEVALUES_HPUX:()=>Kre,OSTYPEVALUES_LINUX:()=>kre,OSTYPEVALUES_NETBSD:()=>$re,OSTYPEVALUES_OPENBSD:()=>Yre,OSTYPEVALUES_SOLARIS:()=>Xre,OSTYPEVALUES_WINDOWS:()=>Hre,OSTYPEVALUES_Z_OS:()=>zre,OTEL_STATUS_CODE_VALUE_ERROR:()=>$se,OTEL_STATUS_CODE_VALUE_OK:()=>Yse,OsTypeValues:()=>Jre,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>Ate,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>Tte,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>dte,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>Cte,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>fte,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>gte,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>Nte,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>Ete,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>Ste,RPCGRPCSTATUSCODEVALUES_OK:()=>pte,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>Rte,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>mte,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>hte,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>Pte,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>Ite,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>Ote,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>_te,RpcGrpcStatusCodeValues:()=>Mte,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>oZ,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>SZ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>tZ,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>J9,SEMATTRS_AWS_DYNAMODB_COUNT:()=>EZ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>uZ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>aZ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>TZ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>sZ,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>Q9,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>rZ,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>cZ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>nZ,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>Z9,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>eZ,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>fZ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>pZ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>dZ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>iZ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>lZ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>z9,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>_Z,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>yQ,SEMATTRS_CODE_FILEPATH:()=>D9,SEMATTRS_CODE_FUNCTION:()=>b9,SEMATTRS_CODE_LINENO:()=>x9,SEMATTRS_CODE_NAMESPACE:()=>L9,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>HQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>YQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>$Q,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>FQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>BQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>GQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>jQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>kQ,SEMATTRS_DB_CONNECTION_STRING:()=>bQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>qQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>DQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>WQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>VQ,SEMATTRS_DB_NAME:()=>xQ,SEMATTRS_DB_OPERATION:()=>wQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>KQ,SEMATTRS_DB_SQL_TABLE:()=>XQ,SEMATTRS_DB_STATEMENT:()=>UQ,SEMATTRS_DB_SYSTEM:()=>vQ,SEMATTRS_DB_USER:()=>LQ,SEMATTRS_ENDUSER_ID:()=>C9,SEMATTRS_ENDUSER_ROLE:()=>P9,SEMATTRS_ENDUSER_SCOPE:()=>M9,SEMATTRS_EXCEPTION_ESCAPED:()=>ZQ,SEMATTRS_EXCEPTION_MESSAGE:()=>JQ,SEMATTRS_EXCEPTION_STACKTRACE:()=>QQ,SEMATTRS_EXCEPTION_TYPE:()=>zQ,SEMATTRS_FAAS_COLDSTART:()=>c9,SEMATTRS_FAAS_CRON:()=>a9,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>n9,SEMATTRS_FAAS_DOCUMENT_NAME:()=>s9,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>r9,SEMATTRS_FAAS_DOCUMENT_TIME:()=>o9,SEMATTRS_FAAS_EXECUTION:()=>t9,SEMATTRS_FAAS_INVOKED_NAME:()=>u9,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>l9,SEMATTRS_FAAS_INVOKED_REGION:()=>p9,SEMATTRS_FAAS_TIME:()=>i9,SEMATTRS_FAAS_TRIGGER:()=>e9,SEMATTRS_HTTP_CLIENT_IP:()=>X9,SEMATTRS_HTTP_FLAVOR:()=>k9,SEMATTRS_HTTP_HOST:()=>B9,SEMATTRS_HTTP_METHOD:()=>U9,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>j9,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>$9,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>Y9,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>q9,SEMATTRS_HTTP_ROUTE:()=>W9,SEMATTRS_HTTP_SCHEME:()=>G9,SEMATTRS_HTTP_SERVER_NAME:()=>K9,SEMATTRS_HTTP_STATUS_CODE:()=>H9,SEMATTRS_HTTP_TARGET:()=>V9,SEMATTRS_HTTP_URL:()=>w9,SEMATTRS_HTTP_USER_AGENT:()=>F9,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>KZ,SEMATTRS_MESSAGE_ID:()=>qZ,SEMATTRS_MESSAGE_TYPE:()=>YZ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>WZ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>vZ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>CZ,SEMATTRS_MESSAGING_DESTINATION:()=>hZ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>gZ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>xZ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>DZ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>LZ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>UZ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>wZ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>IZ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>MZ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>PZ,SEMATTRS_MESSAGING_OPERATION:()=>yZ,SEMATTRS_MESSAGING_PROTOCOL:()=>RZ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>OZ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>bZ,SEMATTRS_MESSAGING_SYSTEM:()=>mZ,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>AZ,SEMATTRS_MESSAGING_URL:()=>NZ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>N9,SEMATTRS_NET_HOST_CARRIER_MCC:()=>R9,SEMATTRS_NET_HOST_CARRIER_MNC:()=>O9,SEMATTRS_NET_HOST_CARRIER_NAME:()=>A9,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>g9,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>h9,SEMATTRS_NET_HOST_IP:()=>S9,SEMATTRS_NET_HOST_NAME:()=>m9,SEMATTRS_NET_HOST_PORT:()=>T9,SEMATTRS_NET_PEER_IP:()=>_9,SEMATTRS_NET_PEER_NAME:()=>f9,SEMATTRS_NET_PEER_PORT:()=>E9,SEMATTRS_NET_TRANSPORT:()=>d9,SEMATTRS_PEER_SERVICE:()=>I9,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>HZ,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>jZ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>$Z,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>FZ,SEMATTRS_RPC_JSONRPC_VERSION:()=>kZ,SEMATTRS_RPC_METHOD:()=>GZ,SEMATTRS_RPC_SERVICE:()=>BZ,SEMATTRS_RPC_SYSTEM:()=>VZ,SEMATTRS_THREAD_ID:()=>y9,SEMATTRS_THREAD_NAME:()=>v9,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>Bte,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>Vte,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>Gte,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>Hte,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>kte,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>Fte,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>jte,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>Yte,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>$te,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>Kte,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>qte,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>Dte,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>Ute,SEMRESATTRS_CLOUD_PLATFORM:()=>wte,SEMRESATTRS_CLOUD_PROVIDER:()=>Lte,SEMRESATTRS_CLOUD_REGION:()=>xte,SEMRESATTRS_CONTAINER_ID:()=>Xte,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>Jte,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>Qte,SEMRESATTRS_CONTAINER_NAME:()=>Wte,SEMRESATTRS_CONTAINER_RUNTIME:()=>zte,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>Zte,SEMRESATTRS_DEVICE_ID:()=>ene,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>tne,SEMRESATTRS_DEVICE_MODEL_NAME:()=>nne,SEMRESATTRS_FAAS_ID:()=>one,SEMRESATTRS_FAAS_INSTANCE:()=>ine,SEMRESATTRS_FAAS_MAX_MEMORY:()=>ane,SEMRESATTRS_FAAS_NAME:()=>rne,SEMRESATTRS_FAAS_VERSION:()=>sne,SEMRESATTRS_HOST_ARCH:()=>pne,SEMRESATTRS_HOST_ID:()=>cne,SEMRESATTRS_HOST_IMAGE_ID:()=>_ne,SEMRESATTRS_HOST_IMAGE_NAME:()=>dne,SEMRESATTRS_HOST_IMAGE_VERSION:()=>Ene,SEMRESATTRS_HOST_NAME:()=>une,SEMRESATTRS_HOST_TYPE:()=>lne,SEMRESATTRS_K8S_CLUSTER_NAME:()=>fne,SEMRESATTRS_K8S_CONTAINER_NAME:()=>Ane,SEMRESATTRS_K8S_CRONJOB_NAME:()=>Dne,SEMRESATTRS_K8S_CRONJOB_UID:()=>Lne,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>yne,SEMRESATTRS_K8S_DAEMONSET_UID:()=>Mne,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>Ine,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>Nne,SEMRESATTRS_K8S_JOB_NAME:()=>bne,SEMRESATTRS_K8S_JOB_UID:()=>vne,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>mne,SEMRESATTRS_K8S_NODE_NAME:()=>Sne,SEMRESATTRS_K8S_NODE_UID:()=>Tne,SEMRESATTRS_K8S_POD_NAME:()=>gne,SEMRESATTRS_K8S_POD_UID:()=>hne,SEMRESATTRS_K8S_REPLICASET_NAME:()=>One,SEMRESATTRS_K8S_REPLICASET_UID:()=>Rne,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>Pne,SEMRESATTRS_K8S_STATEFULSET_UID:()=>Cne,SEMRESATTRS_OS_DESCRIPTION:()=>Une,SEMRESATTRS_OS_NAME:()=>wne,SEMRESATTRS_OS_TYPE:()=>xne,SEMRESATTRS_OS_VERSION:()=>Vne,SEMRESATTRS_PROCESS_COMMAND:()=>kne,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>jne,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>Fne,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>Gne,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>Hne,SEMRESATTRS_PROCESS_OWNER:()=>$ne,SEMRESATTRS_PROCESS_PID:()=>Bne,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>Kne,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>Yne,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>qne,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>zne,SEMRESATTRS_SERVICE_NAME:()=>Wne,SEMRESATTRS_SERVICE_NAMESPACE:()=>Xne,SEMRESATTRS_SERVICE_VERSION:()=>Jne,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>tre,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>Zne,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>Qne,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>ere,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>ore,SEMRESATTRS_WEBENGINE_NAME:()=>nre,SEMRESATTRS_WEBENGINE_VERSION:()=>rre,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>Qse,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>Zse,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>eie,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>nie,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>rie,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>oie,SemanticAttributes:()=>XZ,SemanticResourceAttributes:()=>sre,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>Qre,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>Zre,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>eoe,TELEMETRYSDKLANGUAGEVALUES_GO:()=>toe,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>noe,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>roe,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>ooe,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>soe,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>ioe,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>aoe,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>foe,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>Soe,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>Toe,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>moe,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>hoe,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>goe,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Aoe,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Roe,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Ooe,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Noe,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>Ioe,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>Coe,TelemetrySdkLanguageValues:()=>coe});var hn=U(()=>{Ub();ax();cx();ux()});var lx=f(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.SDK_INFO=void 0;var Fie=ZT(),Dc=(hn(),I(mn));Bp.SDK_INFO={[Dc.SEMRESATTRS_TELEMETRY_SDK_NAME]:"opentelemetry",[Dc.SEMRESATTRS_PROCESS_RUNTIME_NAME]:"node",[Dc.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]:Dc.TELEMETRYSDKLANGUAGEVALUES_NODEJS,[Dc.SEMRESATTRS_TELEMETRY_SDK_VERSION]:Fie.VERSION}});var px=f(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.unrefTimer=void 0;function jie(t){t.unref()}Gp.unrefTimer=jie});var _x=f(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.unrefTimer=rt.SDK_INFO=rt.otperformance=rt.RandomIdGenerator=rt.hexToBase64=rt._globalThis=rt.getEnv=rt.getEnvWithoutDefaults=void 0;var dx=VC();Object.defineProperty(rt,"getEnvWithoutDefaults",{enumerable:!0,get:function(){return dx.getEnvWithoutDefaults}});Object.defineProperty(rt,"getEnv",{enumerable:!0,get:function(){return dx.getEnv}});var $ie=BC();Object.defineProperty(rt,"_globalThis",{enumerable:!0,get:function(){return $ie._globalThis}});var Yie=HC();Object.defineProperty(rt,"hexToBase64",{enumerable:!0,get:function(){return Yie.hexToBase64}});var qie=jC();Object.defineProperty(rt,"RandomIdGenerator",{enumerable:!0,get:function(){return qie.RandomIdGenerator}});var Kie=$C();Object.defineProperty(rt,"otperformance",{enumerable:!0,get:function(){return Kie.otperformance}});var Wie=lx();Object.defineProperty(rt,"SDK_INFO",{enumerable:!0,get:function(){return Wie.SDK_INFO}});var Xie=px();Object.defineProperty(rt,"unrefTimer",{enumerable:!0,get:function(){return Xie.unrefTimer}})});var tm=f(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.unrefTimer=ot.otperformance=ot.hexToBase64=ot.getEnvWithoutDefaults=ot.getEnv=ot._globalThis=ot.SDK_INFO=ot.RandomIdGenerator=void 0;var ho=_x();Object.defineProperty(ot,"RandomIdGenerator",{enumerable:!0,get:function(){return ho.RandomIdGenerator}});Object.defineProperty(ot,"SDK_INFO",{enumerable:!0,get:function(){return ho.SDK_INFO}});Object.defineProperty(ot,"_globalThis",{enumerable:!0,get:function(){return ho._globalThis}});Object.defineProperty(ot,"getEnv",{enumerable:!0,get:function(){return ho.getEnv}});Object.defineProperty(ot,"getEnvWithoutDefaults",{enumerable:!0,get:function(){return ho.getEnvWithoutDefaults}});Object.defineProperty(ot,"hexToBase64",{enumerable:!0,get:function(){return ho.hexToBase64}});Object.defineProperty(ot,"otperformance",{enumerable:!0,get:function(){return ho.otperformance}});Object.defineProperty(ot,"unrefTimer",{enumerable:!0,get:function(){return ho.unrefTimer}})});var Tx=f(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.addHrTimes=fe.isTimeInput=fe.isTimeInputHrTime=fe.hrTimeToMicroseconds=fe.hrTimeToMilliseconds=fe.hrTimeToNanoseconds=fe.hrTimeToTimeStamp=fe.hrTimeDuration=fe.timeInputToHrTime=fe.hrTime=fe.getTimeOrigin=fe.millisToHrTime=void 0;var nm=tm(),Ex=9,zie=6,Jie=Math.pow(10,zie),Hp=Math.pow(10,Ex);function xc(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*Jie);return[n,r]}fe.millisToHrTime=xc;function rm(){let t=nm.otperformance.timeOrigin;if(typeof t!="number"){let e=nm.otperformance;t=e.timing&&e.timing.fetchStart}return t}fe.getTimeOrigin=rm;function fx(t){let e=xc(rm()),n=xc(typeof t=="number"?t:nm.otperformance.now());return Sx(e,n)}fe.hrTime=fx;function Qie(t){if(om(t))return t;if(typeof t=="number")return t<rm()?fx(t):xc(t);if(t instanceof Date)return xc(t.getTime());throw TypeError("Invalid input type")}fe.timeInputToHrTime=Qie;function Zie(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Hp),[n,r]}fe.hrTimeDuration=Zie;function eae(t){let e=Ex,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}fe.hrTimeToTimeStamp=eae;function tae(t){return t[0]*Hp+t[1]}fe.hrTimeToNanoseconds=tae;function nae(t){return t[0]*1e3+t[1]/1e6}fe.hrTimeToMilliseconds=nae;function rae(t){return t[0]*1e6+t[1]/1e3}fe.hrTimeToMicroseconds=rae;function om(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}fe.isTimeInputHrTime=om;function oae(t){return om(t)||typeof t=="number"||t instanceof Date}fe.isTimeInput=oae;function Sx(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=Hp&&(n[1]-=Hp,n[0]+=1),n}fe.addHrTimes=Sx});var mx=f(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ExportResultCode=void 0;var sae;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(sae=Uc.ExportResultCode||(Uc.ExportResultCode={}))});var gx=f(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.CompositePropagator=void 0;var hx=(y(),I(x)),sm=class{constructor(e={}){var n;this._propagators=(n=e.propagators)!==null&&n!==void 0?n:[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,o)=>r.concat(o),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){hx.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){hx.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};kp.CompositePropagator=sm});var Ax=f(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.validateValue=Ni.validateKey=void 0;var im="[_0-9a-z-*/]",iae=`[a-z]${im}{0,255}`,aae=`[a-z0-9]${im}{0,240}@[a-z]${im}{0,13}`,cae=new RegExp(`^(?:${iae}|${aae})$`),uae=/^[ -~]{0,255}[!-~]$/,lae=/,|=/;function pae(t){return cae.test(t)}Ni.validateKey=pae;function dae(t){return uae.test(t)&&!lae.test(t)}Ni.validateValue=dae});var cm=f(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.TraceState=void 0;var Rx=Ax(),Ox=32,_ae=512,Nx=",",Ix="=",am=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 this._keys().reduce((e,n)=>(e.push(n+Ix+this.get(n)),e),[]).join(Nx)}_parse(e){e.length>_ae||(this._internalState=e.split(Nx).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Ix);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Rx.validateKey)(i)&&(0,Rx.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>Ox&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Ox))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};Fp.TraceState=am});var Px=f(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.W3CTraceContextPropagator=gt.parseTraceParent=gt.TRACE_STATE_HEADER=gt.TRACE_PARENT_HEADER=void 0;var jp=(y(),I(x)),Eae=bc(),fae=cm();gt.TRACE_PARENT_HEADER="traceparent";gt.TRACE_STATE_HEADER="tracestate";var Sae="00",Tae="(?!ff)[\\da-f]{2}",mae="(?![0]{32})[\\da-f]{32}",hae="(?![0]{16})[\\da-f]{16}",gae="[\\da-f]{2}",Aae=new RegExp(`^\\s?(${Tae})-(${mae})-(${hae})-(${gae})(-.*)?\\s?$`);function Cx(t){let e=Aae.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}gt.parseTraceParent=Cx;var um=class{inject(e,n,r){let o=jp.trace.getSpanContext(e);if(!o||(0,Eae.isTracingSuppressed)(e)||!(0,jp.isSpanContextValid)(o))return;let s=`${Sae}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||jp.TraceFlags.NONE).toString(16)}`;r.set(n,gt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,gt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,gt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Cx(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,gt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new fae.TraceState(typeof c=="string"?c:void 0)}return jp.trace.setSpanContext(e,i)}fields(){return[gt.TRACE_PARENT_HEADER,gt.TRACE_STATE_HEADER]}};gt.W3CTraceContextPropagator=um});var Mx=f(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.getRPCMetadata=Gn.deleteRPCMetadata=Gn.setRPCMetadata=Gn.RPCType=void 0;var Rae=(y(),I(x)),lm=(0,Rae.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Oae;(function(t){t.HTTP="http"})(Oae=Gn.RPCType||(Gn.RPCType={}));function Nae(t,e){return t.setValue(lm,e)}Gn.setRPCMetadata=Nae;function Iae(t){return t.deleteValue(lm)}Gn.deleteRPCMetadata=Iae;function Cae(t){return t.getValue(lm)}Gn.getRPCMetadata=Cae});var dm=f($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.AlwaysOffSampler=void 0;var Pae=(y(),I(x)),pm=class{shouldSample(){return{decision:Pae.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};$p.AlwaysOffSampler=pm});var Em=f(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.AlwaysOnSampler=void 0;var Mae=(y(),I(x)),_m=class{shouldSample(){return{decision:Mae.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};Yp.AlwaysOnSampler=_m});var vx=f(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.ParentBasedSampler=void 0;var qp=(y(),I(x)),yae=KT(),yx=dm(),fm=Em(),Sm=class{constructor(e){var n,r,o,s;this._root=e.root,this._root||((0,yae.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new fm.AlwaysOnSampler),this._remoteParentSampled=(n=e.remoteParentSampled)!==null&&n!==void 0?n:new fm.AlwaysOnSampler,this._remoteParentNotSampled=(r=e.remoteParentNotSampled)!==null&&r!==void 0?r:new yx.AlwaysOffSampler,this._localParentSampled=(o=e.localParentSampled)!==null&&o!==void 0?o:new fm.AlwaysOnSampler,this._localParentNotSampled=(s=e.localParentNotSampled)!==null&&s!==void 0?s:new yx.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=qp.trace.getSpanContext(e);return!a||!(0,qp.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&qp.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&qp.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()}}`}};Kp.ParentBasedSampler=Sm});var bx=f(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.TraceIdRatioBasedSampler=void 0;var Tm=(y(),I(x)),mm=class{constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,Tm.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?Tm.SamplingDecision.RECORD_AND_SAMPLED:Tm.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}};Wp.TraceIdRatioBasedSampler=mm});var wx=f(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.isPlainObject=void 0;var vae="[object Object]",bae="[object Null]",Lae="[object Undefined]",Dae=Function.prototype,Lx=Dae.toString,xae=Lx.call(Object),Uae=wae(Object.getPrototypeOf,Object),Dx=Object.prototype,xx=Dx.hasOwnProperty,Is=Symbol?Symbol.toStringTag:void 0,Ux=Dx.toString;function wae(t,e){return function(n){return t(e(n))}}function Vae(t){if(!Bae(t)||Gae(t)!==vae)return!1;let e=Uae(t);if(e===null)return!0;let n=xx.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Lx.call(n)===xae}Xp.isPlainObject=Vae;function Bae(t){return t!=null&&typeof t=="object"}function Gae(t){return t==null?t===void 0?Lae:bae:Is&&Is in Object(t)?Hae(t):kae(t)}function Hae(t){let e=xx.call(t,Is),n=t[Is],r=!1;try{t[Is]=void 0,r=!0}catch{}let o=Ux.call(t);return r&&(e?t[Is]=n:delete t[Is]),o}function kae(t){return Ux.call(t)}});var kx=f(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.merge=void 0;var Vx=wx(),Fae=20;function jae(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=Gx(e,t.shift(),0,n);return e}Qp.merge=jae;function hm(t){return Jp(t)?t.slice():t}function Gx(t,e,n=0,r){let o;if(!(n>Fae)){if(n++,zp(t)||zp(e)||Hx(e))o=hm(e);else if(Jp(t)){if(o=t.slice(),Jp(e))for(let s=0,i=e.length;s<i;s++)o.push(hm(e[s]));else if(wc(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=hm(e[c])}}}else if(wc(t))if(wc(e)){if(!$ae(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],u=e[c];if(zp(u))typeof u>"u"?delete o[c]:o[c]=u;else{let l=o[c],p=u;if(Bx(t,c,r)||Bx(e,c,r))delete o[c];else{if(wc(l)&&wc(p)){let d=r.get(l)||[],_=r.get(p)||[];d.push({obj:t,key:c}),_.push({obj:e,key:c}),r.set(l,d),r.set(p,_)}o[c]=Gx(o[c],u,n,r)}}}}else o=e;return o}}function Bx(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 Jp(t){return Array.isArray(t)}function Hx(t){return typeof t=="function"}function wc(t){return!zp(t)&&!Jp(t)&&!Hx(t)&&typeof t=="object"}function zp(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function $ae(t,e){return!(!(0,Vx.isPlainObject)(t)||!(0,Vx.isPlainObject)(e))}});var Fx=f(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.callWithTimeout=Ii.TimeoutError=void 0;var Zp=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Ii.TimeoutError=Zp;function Yae(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new Zp("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}Ii.callWithTimeout=Yae});var $x=f(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.isUrlIgnored=Ci.urlMatches=void 0;function jx(t,e){return typeof e=="string"?t===e:!!t.match(e)}Ci.urlMatches=jx;function qae(t,e){if(!e)return!1;for(let n of e)if(jx(t,n))return!0;return!1}Ci.isUrlIgnored=qae});var Yx=f(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.isWrapped=void 0;function Kae(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ed.isWrapped=Kae});var qx=f(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.Deferred=void 0;var gm=class{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)}};td.Deferred=gm});var Kx=f(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.BindOnceFuture=void 0;var Wae=qx(),Am=class{constructor(e,n){this._callback=e,this._that=n,this._isCalled=!1,this._deferred=new Wae.Deferred}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}};nd.BindOnceFuture=Am});var Xx=f(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd._export=void 0;var Wx=(y(),I(x)),Xae=bc();function zae(t,e){return new Promise(n=>{Wx.context.with((0,Xae.suppressTracing)(Wx.context.active()),()=>{t.export(e,r=>{n(r)})})})}rd._export=zae});var oe=f(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=g.DEFAULT_ATTRIBUTE_COUNT_LIMIT=g.TraceState=g.unsuppressTracing=g.suppressTracing=g.isTracingSuppressed=g.TraceIdRatioBasedSampler=g.ParentBasedSampler=g.AlwaysOnSampler=g.AlwaysOffSampler=g.setRPCMetadata=g.getRPCMetadata=g.deleteRPCMetadata=g.RPCType=g.parseTraceParent=g.W3CTraceContextPropagator=g.TRACE_STATE_HEADER=g.TRACE_PARENT_HEADER=g.CompositePropagator=g.unrefTimer=g.otperformance=g.hexToBase64=g.getEnvWithoutDefaults=g.getEnv=g._globalThis=g.SDK_INFO=g.RandomIdGenerator=g.baggageUtils=g.ExportResultCode=g.hexToBinary=g.timeInputToHrTime=g.millisToHrTime=g.isTimeInputHrTime=g.isTimeInput=g.hrTimeToTimeStamp=g.hrTimeToNanoseconds=g.hrTimeToMilliseconds=g.hrTimeToMicroseconds=g.hrTimeDuration=g.hrTime=g.getTimeOrigin=g.addHrTimes=g.loggingErrorHandler=g.setGlobalErrorHandler=g.globalErrorHandler=g.sanitizeAttributes=g.isAttributeValue=g.isAttributeKey=g.AnchoredClock=g.W3CBaggagePropagator=void 0;g.internal=g.VERSION=g.BindOnceFuture=g.isWrapped=g.urlMatches=g.isUrlIgnored=g.callWithTimeout=g.TimeoutError=g.TracesSamplerValues=g.merge=g.parseEnvironment=g.DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT=g.DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT=g.DEFAULT_ENVIRONMENT=void 0;var Jae=yC();Object.defineProperty(g,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Jae.W3CBaggagePropagator}});var Qae=vC();Object.defineProperty(g,"AnchoredClock",{enumerable:!0,get:function(){return Qae.AnchoredClock}});var Rm=UC();Object.defineProperty(g,"isAttributeKey",{enumerable:!0,get:function(){return Rm.isAttributeKey}});Object.defineProperty(g,"isAttributeValue",{enumerable:!0,get:function(){return Rm.isAttributeValue}});Object.defineProperty(g,"sanitizeAttributes",{enumerable:!0,get:function(){return Rm.sanitizeAttributes}});var zx=KT();Object.defineProperty(g,"globalErrorHandler",{enumerable:!0,get:function(){return zx.globalErrorHandler}});Object.defineProperty(g,"setGlobalErrorHandler",{enumerable:!0,get:function(){return zx.setGlobalErrorHandler}});var Zae=qT();Object.defineProperty(g,"loggingErrorHandler",{enumerable:!0,get:function(){return Zae.loggingErrorHandler}});var gn=Tx();Object.defineProperty(g,"addHrTimes",{enumerable:!0,get:function(){return gn.addHrTimes}});Object.defineProperty(g,"getTimeOrigin",{enumerable:!0,get:function(){return gn.getTimeOrigin}});Object.defineProperty(g,"hrTime",{enumerable:!0,get:function(){return gn.hrTime}});Object.defineProperty(g,"hrTimeDuration",{enumerable:!0,get:function(){return gn.hrTimeDuration}});Object.defineProperty(g,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return gn.hrTimeToMicroseconds}});Object.defineProperty(g,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return gn.hrTimeToMilliseconds}});Object.defineProperty(g,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return gn.hrTimeToNanoseconds}});Object.defineProperty(g,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return gn.hrTimeToTimeStamp}});Object.defineProperty(g,"isTimeInput",{enumerable:!0,get:function(){return gn.isTimeInput}});Object.defineProperty(g,"isTimeInputHrTime",{enumerable:!0,get:function(){return gn.isTimeInputHrTime}});Object.defineProperty(g,"millisToHrTime",{enumerable:!0,get:function(){return gn.millisToHrTime}});Object.defineProperty(g,"timeInputToHrTime",{enumerable:!0,get:function(){return gn.timeInputToHrTime}});var ece=JT();Object.defineProperty(g,"hexToBinary",{enumerable:!0,get:function(){return ece.hexToBinary}});var tce=mx();Object.defineProperty(g,"ExportResultCode",{enumerable:!0,get:function(){return tce.ExportResultCode}});var od=kT();g.baggageUtils={getKeyPairs:od.getKeyPairs,serializeKeyPairs:od.serializeKeyPairs,parseKeyPairsIntoRecord:od.parseKeyPairsIntoRecord,parsePairKeyValue:od.parsePairKeyValue};var go=tm();Object.defineProperty(g,"RandomIdGenerator",{enumerable:!0,get:function(){return go.RandomIdGenerator}});Object.defineProperty(g,"SDK_INFO",{enumerable:!0,get:function(){return go.SDK_INFO}});Object.defineProperty(g,"_globalThis",{enumerable:!0,get:function(){return go._globalThis}});Object.defineProperty(g,"getEnv",{enumerable:!0,get:function(){return go.getEnv}});Object.defineProperty(g,"getEnvWithoutDefaults",{enumerable:!0,get:function(){return go.getEnvWithoutDefaults}});Object.defineProperty(g,"hexToBase64",{enumerable:!0,get:function(){return go.hexToBase64}});Object.defineProperty(g,"otperformance",{enumerable:!0,get:function(){return go.otperformance}});Object.defineProperty(g,"unrefTimer",{enumerable:!0,get:function(){return go.unrefTimer}});var nce=gx();Object.defineProperty(g,"CompositePropagator",{enumerable:!0,get:function(){return nce.CompositePropagator}});var sd=Px();Object.defineProperty(g,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return sd.TRACE_PARENT_HEADER}});Object.defineProperty(g,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return sd.TRACE_STATE_HEADER}});Object.defineProperty(g,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return sd.W3CTraceContextPropagator}});Object.defineProperty(g,"parseTraceParent",{enumerable:!0,get:function(){return sd.parseTraceParent}});var id=Mx();Object.defineProperty(g,"RPCType",{enumerable:!0,get:function(){return id.RPCType}});Object.defineProperty(g,"deleteRPCMetadata",{enumerable:!0,get:function(){return id.deleteRPCMetadata}});Object.defineProperty(g,"getRPCMetadata",{enumerable:!0,get:function(){return id.getRPCMetadata}});Object.defineProperty(g,"setRPCMetadata",{enumerable:!0,get:function(){return id.setRPCMetadata}});var rce=dm();Object.defineProperty(g,"AlwaysOffSampler",{enumerable:!0,get:function(){return rce.AlwaysOffSampler}});var oce=Em();Object.defineProperty(g,"AlwaysOnSampler",{enumerable:!0,get:function(){return oce.AlwaysOnSampler}});var sce=vx();Object.defineProperty(g,"ParentBasedSampler",{enumerable:!0,get:function(){return sce.ParentBasedSampler}});var ice=bx();Object.defineProperty(g,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return ice.TraceIdRatioBasedSampler}});var Om=bc();Object.defineProperty(g,"isTracingSuppressed",{enumerable:!0,get:function(){return Om.isTracingSuppressed}});Object.defineProperty(g,"suppressTracing",{enumerable:!0,get:function(){return Om.suppressTracing}});Object.defineProperty(g,"unsuppressTracing",{enumerable:!0,get:function(){return Om.unsuppressTracing}});var ace=cm();Object.defineProperty(g,"TraceState",{enumerable:!0,get:function(){return ace.TraceState}});var Pi=XT();Object.defineProperty(g,"DEFAULT_ATTRIBUTE_COUNT_LIMIT",{enumerable:!0,get:function(){return Pi.DEFAULT_ATTRIBUTE_COUNT_LIMIT}});Object.defineProperty(g,"DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT",{enumerable:!0,get:function(){return Pi.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT}});Object.defineProperty(g,"DEFAULT_ENVIRONMENT",{enumerable:!0,get:function(){return Pi.DEFAULT_ENVIRONMENT}});Object.defineProperty(g,"DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT",{enumerable:!0,get:function(){return Pi.DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT}});Object.defineProperty(g,"DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT",{enumerable:!0,get:function(){return Pi.DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT}});Object.defineProperty(g,"parseEnvironment",{enumerable:!0,get:function(){return Pi.parseEnvironment}});var cce=kx();Object.defineProperty(g,"merge",{enumerable:!0,get:function(){return cce.merge}});var uce=WT();Object.defineProperty(g,"TracesSamplerValues",{enumerable:!0,get:function(){return uce.TracesSamplerValues}});var Jx=Fx();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return Jx.TimeoutError}});Object.defineProperty(g,"callWithTimeout",{enumerable:!0,get:function(){return Jx.callWithTimeout}});var Qx=$x();Object.defineProperty(g,"isUrlIgnored",{enumerable:!0,get:function(){return Qx.isUrlIgnored}});Object.defineProperty(g,"urlMatches",{enumerable:!0,get:function(){return Qx.urlMatches}});var lce=Yx();Object.defineProperty(g,"isWrapped",{enumerable:!0,get:function(){return lce.isWrapped}});var pce=Kx();Object.defineProperty(g,"BindOnceFuture",{enumerable:!0,get:function(){return pce.BindOnceFuture}});var dce=ZT();Object.defineProperty(g,"VERSION",{enumerable:!0,get:function(){return dce.VERSION}});var _ce=Xx();g.internal={_export:_ce._export}});var Vc=f((HBe,Zx)=>{"use strict";var Ece="2.0.0",fce=Number.MAX_SAFE_INTEGER||9007199254740991,Sce=16,Tce=250,mce=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Zx.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Sce,MAX_SAFE_BUILD_LENGTH:Tce,MAX_SAFE_INTEGER:fce,RELEASE_TYPES:mce,SEMVER_SPEC_VERSION:Ece,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Bc=f((kBe,eU)=>{"use strict";var hce=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};eU.exports=hce});var Mi=f((lr,tU)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Nm,MAX_SAFE_BUILD_LENGTH:gce,MAX_LENGTH:Ace}=Vc(),Rce=Bc();lr=tU.exports={};var Oce=lr.re=[],Nce=lr.safeRe=[],b=lr.src=[],Ice=lr.safeSrc=[],L=lr.t={},Cce=0,Im="[a-zA-Z0-9-]",Pce=[["\\s",1],["\\d",Ace],[Im,gce]],Mce=t=>{for(let[e,n]of Pce)t=t.split(`${e}*`).join(`${e}{0,${n}}`).split(`${e}+`).join(`${e}{1,${n}}`);return t},Y=(t,e,n)=>{let r=Mce(e),o=Cce++;Rce(t,o,e),L[t]=o,b[o]=e,Ice[o]=r,Oce[o]=new RegExp(e,n?"g":void 0),Nce[o]=new RegExp(r,n?"g":void 0)};Y("NUMERICIDENTIFIER","0|[1-9]\\d*");Y("NUMERICIDENTIFIERLOOSE","\\d+");Y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Im}*`);Y("MAINVERSION",`(${b[L.NUMERICIDENTIFIER]})\\.(${b[L.NUMERICIDENTIFIER]})\\.(${b[L.NUMERICIDENTIFIER]})`);Y("MAINVERSIONLOOSE",`(${b[L.NUMERICIDENTIFIERLOOSE]})\\.(${b[L.NUMERICIDENTIFIERLOOSE]})\\.(${b[L.NUMERICIDENTIFIERLOOSE]})`);Y("PRERELEASEIDENTIFIER",`(?:${b[L.NONNUMERICIDENTIFIER]}|${b[L.NUMERICIDENTIFIER]})`);Y("PRERELEASEIDENTIFIERLOOSE",`(?:${b[L.NONNUMERICIDENTIFIER]}|${b[L.NUMERICIDENTIFIERLOOSE]})`);Y("PRERELEASE",`(?:-(${b[L.PRERELEASEIDENTIFIER]}(?:\\.${b[L.PRERELEASEIDENTIFIER]})*))`);Y("PRERELEASELOOSE",`(?:-?(${b[L.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[L.PRERELEASEIDENTIFIERLOOSE]})*))`);Y("BUILDIDENTIFIER",`${Im}+`);Y("BUILD",`(?:\\+(${b[L.BUILDIDENTIFIER]}(?:\\.${b[L.BUILDIDENTIFIER]})*))`);Y("FULLPLAIN",`v?${b[L.MAINVERSION]}${b[L.PRERELEASE]}?${b[L.BUILD]}?`);Y("FULL",`^${b[L.FULLPLAIN]}$`);Y("LOOSEPLAIN",`[v=\\s]*${b[L.MAINVERSIONLOOSE]}${b[L.PRERELEASELOOSE]}?${b[L.BUILD]}?`);Y("LOOSE",`^${b[L.LOOSEPLAIN]}$`);Y("GTLT","((?:<|>)?=?)");Y("XRANGEIDENTIFIERLOOSE",`${b[L.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Y("XRANGEIDENTIFIER",`${b[L.NUMERICIDENTIFIER]}|x|X|\\*`);Y("XRANGEPLAIN",`[v=\\s]*(${b[L.XRANGEIDENTIFIER]})(?:\\.(${b[L.XRANGEIDENTIFIER]})(?:\\.(${b[L.XRANGEIDENTIFIER]})(?:${b[L.PRERELEASE]})?${b[L.BUILD]}?)?)?`);Y("XRANGEPLAINLOOSE",`[v=\\s]*(${b[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[L.XRANGEIDENTIFIERLOOSE]})(?:${b[L.PRERELEASELOOSE]})?${b[L.BUILD]}?)?)?`);Y("XRANGE",`^${b[L.GTLT]}\\s*${b[L.XRANGEPLAIN]}$`);Y("XRANGELOOSE",`^${b[L.GTLT]}\\s*${b[L.XRANGEPLAINLOOSE]}$`);Y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Nm}})(?:\\.(\\d{1,${Nm}}))?(?:\\.(\\d{1,${Nm}}))?`);Y("COERCE",`${b[L.COERCEPLAIN]}(?:$|[^\\d])`);Y("COERCEFULL",b[L.COERCEPLAIN]+`(?:${b[L.PRERELEASE]})?(?:${b[L.BUILD]})?(?:$|[^\\d])`);Y("COERCERTL",b[L.COERCE],!0);Y("COERCERTLFULL",b[L.COERCEFULL],!0);Y("LONETILDE","(?:~>?)");Y("TILDETRIM",`(\\s*)${b[L.LONETILDE]}\\s+`,!0);lr.tildeTrimReplace="$1~";Y("TILDE",`^${b[L.LONETILDE]}${b[L.XRANGEPLAIN]}$`);Y("TILDELOOSE",`^${b[L.LONETILDE]}${b[L.XRANGEPLAINLOOSE]}$`);Y("LONECARET","(?:\\^)");Y("CARETTRIM",`(\\s*)${b[L.LONECARET]}\\s+`,!0);lr.caretTrimReplace="$1^";Y("CARET",`^${b[L.LONECARET]}${b[L.XRANGEPLAIN]}$`);Y("CARETLOOSE",`^${b[L.LONECARET]}${b[L.XRANGEPLAINLOOSE]}$`);Y("COMPARATORLOOSE",`^${b[L.GTLT]}\\s*(${b[L.LOOSEPLAIN]})$|^$`);Y("COMPARATOR",`^${b[L.GTLT]}\\s*(${b[L.FULLPLAIN]})$|^$`);Y("COMPARATORTRIM",`(\\s*)${b[L.GTLT]}\\s*(${b[L.LOOSEPLAIN]}|${b[L.XRANGEPLAIN]})`,!0);lr.comparatorTrimReplace="$1$2$3";Y("HYPHENRANGE",`^\\s*(${b[L.XRANGEPLAIN]})\\s+-\\s+(${b[L.XRANGEPLAIN]})\\s*$`);Y("HYPHENRANGELOOSE",`^\\s*(${b[L.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[L.XRANGEPLAINLOOSE]})\\s*$`);Y("STAR","(<|>)?=?\\s*\\*");Y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ad=f((FBe,nU)=>{"use strict";var yce=Object.freeze({loose:!0}),vce=Object.freeze({}),bce=t=>t?typeof t!="object"?yce:t:vce;nU.exports=bce});var Cm=f((jBe,sU)=>{"use strict";var rU=/^[0-9]+$/,oU=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let n=rU.test(t),r=rU.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},Lce=(t,e)=>oU(e,t);sU.exports={compareIdentifiers:oU,rcompareIdentifiers:Lce}});var At=f(($Be,aU)=>{"use strict";var cd=Bc(),{MAX_LENGTH:iU,MAX_SAFE_INTEGER:ud}=Vc(),{safeRe:ld,t:pd}=Mi(),Dce=ad(),{compareIdentifiers:Pm}=Cm(),Mm=class t{constructor(e,n){if(n=Dce(n),e instanceof t){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>iU)throw new TypeError(`version is longer than ${iU} characters`);cd("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?ld[pd.LOOSE]:ld[pd.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ud||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ud||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ud||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<ud)return s}return o}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(cd("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],o=e.prerelease[n];if(cd("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return Pm(r,o)}while(++n)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let n=0;do{let r=this.build[n],o=e.build[n];if(cd("build compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return Pm(r,o)}while(++n)}inc(e,n,r){if(e.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let o=`-${n}`.match(this.options.loose?ld[pd.PRERELEASELOOSE]:ld[pd.PRERELEASE]);if(!o||o[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];r===!1&&(s=[n]),Pm(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};aU.exports=Mm});var Cs=f((YBe,uU)=>{"use strict";var cU=At(),xce=(t,e,n=!1)=>{if(t instanceof cU)return t;try{return new cU(t,e)}catch(r){if(!n)return null;throw r}};uU.exports=xce});var pU=f((qBe,lU)=>{"use strict";var Uce=Cs(),wce=(t,e)=>{let n=Uce(t,e);return n?n.version:null};lU.exports=wce});var _U=f((KBe,dU)=>{"use strict";var Vce=Cs(),Bce=(t,e)=>{let n=Vce(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};dU.exports=Bce});var SU=f((WBe,fU)=>{"use strict";var EU=At(),Gce=(t,e,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new EU(t instanceof EU?t.version:t,n).inc(e,r,o).version}catch{return null}};fU.exports=Gce});var hU=f((XBe,mU)=>{"use strict";var TU=Cs(),Hce=(t,e)=>{let n=TU(t,null,!0),r=TU(e,null,!0),o=n.compare(r);if(o===0)return null;let s=o>0,i=s?n:r,a=s?r:n,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return n.major!==r.major?l+"major":n.minor!==r.minor?l+"minor":n.patch!==r.patch?l+"patch":"prerelease"};mU.exports=Hce});var AU=f((zBe,gU)=>{"use strict";var kce=At(),Fce=(t,e)=>new kce(t,e).major;gU.exports=Fce});var OU=f((JBe,RU)=>{"use strict";var jce=At(),$ce=(t,e)=>new jce(t,e).minor;RU.exports=$ce});var IU=f((QBe,NU)=>{"use strict";var Yce=At(),qce=(t,e)=>new Yce(t,e).patch;NU.exports=qce});var PU=f((ZBe,CU)=>{"use strict";var Kce=Cs(),Wce=(t,e)=>{let n=Kce(t,e);return n&&n.prerelease.length?n.prerelease:null};CU.exports=Wce});var An=f((eGe,yU)=>{"use strict";var MU=At(),Xce=(t,e,n)=>new MU(t,n).compare(new MU(e,n));yU.exports=Xce});var bU=f((tGe,vU)=>{"use strict";var zce=An(),Jce=(t,e,n)=>zce(e,t,n);vU.exports=Jce});var DU=f((nGe,LU)=>{"use strict";var Qce=An(),Zce=(t,e)=>Qce(t,e,!0);LU.exports=Zce});var dd=f((rGe,UU)=>{"use strict";var xU=At(),eue=(t,e,n)=>{let r=new xU(t,n),o=new xU(e,n);return r.compare(o)||r.compareBuild(o)};UU.exports=eue});var VU=f((oGe,wU)=>{"use strict";var tue=dd(),nue=(t,e)=>t.sort((n,r)=>tue(n,r,e));wU.exports=nue});var GU=f((sGe,BU)=>{"use strict";var rue=dd(),oue=(t,e)=>t.sort((n,r)=>rue(r,n,e));BU.exports=oue});var Gc=f((iGe,HU)=>{"use strict";var sue=An(),iue=(t,e,n)=>sue(t,e,n)>0;HU.exports=iue});var _d=f((aGe,kU)=>{"use strict";var aue=An(),cue=(t,e,n)=>aue(t,e,n)<0;kU.exports=cue});var ym=f((cGe,FU)=>{"use strict";var uue=An(),lue=(t,e,n)=>uue(t,e,n)===0;FU.exports=lue});var vm=f((uGe,jU)=>{"use strict";var pue=An(),due=(t,e,n)=>pue(t,e,n)!==0;jU.exports=due});var Ed=f((lGe,$U)=>{"use strict";var _ue=An(),Eue=(t,e,n)=>_ue(t,e,n)>=0;$U.exports=Eue});var fd=f((pGe,YU)=>{"use strict";var fue=An(),Sue=(t,e,n)=>fue(t,e,n)<=0;YU.exports=Sue});var bm=f((dGe,qU)=>{"use strict";var Tue=ym(),mue=vm(),hue=Gc(),gue=Ed(),Aue=_d(),Rue=fd(),Oue=(t,e,n,r)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t===n;case"!==":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t!==n;case"":case"=":case"==":return Tue(t,n,r);case"!=":return mue(t,n,r);case">":return hue(t,n,r);case">=":return gue(t,n,r);case"<":return Aue(t,n,r);case"<=":return Rue(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};qU.exports=Oue});var WU=f((_Ge,KU)=>{"use strict";var Nue=At(),Iue=Cs(),{safeRe:Sd,t:Td}=Mi(),Cue=(t,e)=>{if(t instanceof Nue)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let n=null;if(!e.rtl)n=t.match(e.includePrerelease?Sd[Td.COERCEFULL]:Sd[Td.COERCE]);else{let c=e.includePrerelease?Sd[Td.COERCERTLFULL]:Sd[Td.COERCERTL],u;for(;(u=c.exec(t))&&(!n||n.index+n[0].length!==t.length);)(!n||u.index+u[0].length!==n.index+n[0].length)&&(n=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(n===null)return null;let r=n[2],o=n[3]||"0",s=n[4]||"0",i=e.includePrerelease&&n[5]?`-${n[5]}`:"",a=e.includePrerelease&&n[6]?`+${n[6]}`:"";return Iue(`${r}.${o}.${s}${i}${a}`,e)};KU.exports=Cue});var zU=f((EGe,XU)=>{"use strict";var Lm=class{constructor(){this.max=1e3,this.map=new Map}get(e){let n=this.map.get(e);if(n!==void 0)return this.map.delete(e),this.map.set(e,n),n}delete(e){return this.map.delete(e)}set(e,n){if(!this.delete(e)&&n!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,n)}return this}};XU.exports=Lm});var Rn=f((fGe,e0)=>{"use strict";var Pue=/\s+/g,Dm=class t{constructor(e,n){if(n=yue(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof xm)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e.trim().replace(Pue," "),this.set=this.raw.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(o=>!QU(o[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&wue(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let n=this.set[e];for(let r=0;r<n.length;r++)r>0&&(this.formatted+=" "),this.formatted+=n[r].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let r=((this.options.includePrerelease&&xue)|(this.options.loose&&Uue))+":"+e,o=JU.get(r);if(o)return o;let s=this.options.loose,i=s?Ut[Rt.HYPHENRANGELOOSE]:Ut[Rt.HYPHENRANGE];e=e.replace(i,que(this.options.includePrerelease)),Te("hyphen replace",e),e=e.replace(Ut[Rt.COMPARATORTRIM],bue),Te("comparator trim",e),e=e.replace(Ut[Rt.TILDETRIM],Lue),Te("tilde trim",e),e=e.replace(Ut[Rt.CARETTRIM],Due),Te("caret trim",e);let a=e.split(" ").map(p=>Vue(p,this.options)).join(" ").split(/\s+/).map(p=>Yue(p,this.options));s&&(a=a.filter(p=>(Te("loose invalid filter",p,this.options),!!p.match(Ut[Rt.COMPARATORLOOSE])))),Te("range list",a);let c=new Map,u=a.map(p=>new xm(p,this.options));for(let p of u){if(QU(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return JU.set(r,l),l}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(r=>ZU(r,n)&&e.set.some(o=>ZU(o,n)&&r.every(s=>o.every(i=>s.intersects(i,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new vue(e,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(Kue(this.set[n],e,this.options))return!0;return!1}};e0.exports=Dm;var Mue=zU(),JU=new Mue,yue=ad(),xm=Hc(),Te=Bc(),vue=At(),{safeRe:Ut,t:Rt,comparatorTrimReplace:bue,tildeTrimReplace:Lue,caretTrimReplace:Due}=Mi(),{FLAG_INCLUDE_PRERELEASE:xue,FLAG_LOOSE:Uue}=Vc(),QU=t=>t.value==="<0.0.0-0",wue=t=>t.value==="",ZU=(t,e)=>{let n=!0,r=t.slice(),o=r.pop();for(;n&&r.length;)n=r.every(s=>o.intersects(s,e)),o=r.pop();return n},Vue=(t,e)=>(t=t.replace(Ut[Rt.BUILD],""),Te("comp",t,e),t=Hue(t,e),Te("caret",t),t=Bue(t,e),Te("tildes",t),t=Fue(t,e),Te("xrange",t),t=$ue(t,e),Te("stars",t),t),wt=t=>!t||t.toLowerCase()==="x"||t==="*",Bue=(t,e)=>t.trim().split(/\s+/).map(n=>Gue(n,e)).join(" "),Gue=(t,e)=>{let n=e.loose?Ut[Rt.TILDELOOSE]:Ut[Rt.TILDE];return t.replace(n,(r,o,s,i,a)=>{Te("tilde",t,r,o,s,i,a);let c;return wt(o)?c="":wt(s)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:wt(i)?c=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:a?(Te("replaceTilde pr",a),c=`>=${o}.${s}.${i}-${a} <${o}.${+s+1}.0-0`):c=`>=${o}.${s}.${i} <${o}.${+s+1}.0-0`,Te("tilde return",c),c})},Hue=(t,e)=>t.trim().split(/\s+/).map(n=>kue(n,e)).join(" "),kue=(t,e)=>{Te("caret",t,e);let n=e.loose?Ut[Rt.CARETLOOSE]:Ut[Rt.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{Te("caret",t,o,s,i,a,c);let u;return wt(s)?u="":wt(i)?u=`>=${s}.0.0${r} <${+s+1}.0.0-0`:wt(a)?s==="0"?u=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:u=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?(Te("replaceCaret pr",c),s==="0"?i==="0"?u=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:u=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`):(Te("no pr"),s==="0"?i==="0"?u=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:u=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:u=`>=${s}.${i}.${a} <${+s+1}.0.0-0`),Te("caret return",u),u})},Fue=(t,e)=>(Te("replaceXRanges",t,e),t.split(/\s+/).map(n=>jue(n,e)).join(" ")),jue=(t,e)=>{t=t.trim();let n=e.loose?Ut[Rt.XRANGELOOSE]:Ut[Rt.XRANGE];return t.replace(n,(r,o,s,i,a,c)=>{Te("xRange",t,r,o,s,i,a,c);let u=wt(s),l=u||wt(i),p=l||wt(a),d=p;return o==="="&&d&&(o=""),c=e.includePrerelease?"-0":"",u?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&d?(l&&(i=0),a=0,o===">"?(o=">=",l?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",l?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):l?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),Te("xRange return",r),r})},$ue=(t,e)=>(Te("replaceStars",t,e),t.trim().replace(Ut[Rt.STAR],"")),Yue=(t,e)=>(Te("replaceGTE0",t,e),t.trim().replace(Ut[e.includePrerelease?Rt.GTE0PRE:Rt.GTE0],"")),que=t=>(e,n,r,o,s,i,a,c,u,l,p,d)=>(wt(r)?n="":wt(o)?n=`>=${r}.0.0${t?"-0":""}`:wt(s)?n=`>=${r}.${o}.0${t?"-0":""}`:i?n=`>=${n}`:n=`>=${n}${t?"-0":""}`,wt(u)?c="":wt(l)?c=`<${+u+1}.0.0-0`:wt(p)?c=`<${u}.${+l+1}.0-0`:d?c=`<=${u}.${l}.${p}-${d}`:t?c=`<${u}.${l}.${+p+1}-0`:c=`<=${c}`,`${n} ${c}`.trim()),Kue=(t,e,n)=>{for(let r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length&&!n.includePrerelease){for(let r=0;r<t.length;r++)if(Te(t[r].semver),t[r].semver!==xm.ANY&&t[r].semver.prerelease.length>0){let o=t[r].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var Hc=f((SGe,i0)=>{"use strict";var kc=Symbol("SemVer ANY"),Vm=class t{static get ANY(){return kc}constructor(e,n){if(n=t0(n),e instanceof t){if(e.loose===!!n.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),wm("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===kc?this.value="":this.value=this.operator+this.semver.version,wm("comp",this)}parse(e){let n=this.options.loose?n0[r0.COMPARATORLOOSE]:n0[r0.COMPARATOR],r=e.match(n);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new o0(r[2],this.options.loose):this.semver=kc}toString(){return this.value}test(e){if(wm("Comparator.test",e,this.options.loose),this.semver===kc||e===kc)return!0;if(typeof e=="string")try{e=new o0(e,this.options)}catch{return!1}return Um(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new s0(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new s0(this.value,n).test(e.semver):(n=t0(n),n.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Um(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Um(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};i0.exports=Vm;var t0=ad(),{safeRe:n0,t:r0}=Mi(),Um=bm(),wm=Bc(),o0=At(),s0=Rn()});var Fc=f((TGe,a0)=>{"use strict";var Wue=Rn(),Xue=(t,e,n)=>{try{e=new Wue(e,n)}catch{return!1}return e.test(t)};a0.exports=Xue});var u0=f((mGe,c0)=>{"use strict";var zue=Rn(),Jue=(t,e)=>new zue(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));c0.exports=Jue});var p0=f((hGe,l0)=>{"use strict";var Que=At(),Zue=Rn(),ele=(t,e,n)=>{let r=null,o=null,s=null;try{s=new Zue(e,n)}catch{return null}return t.forEach(i=>{s.test(i)&&(!r||o.compare(i)===-1)&&(r=i,o=new Que(r,n))}),r};l0.exports=ele});var _0=f((gGe,d0)=>{"use strict";var tle=At(),nle=Rn(),rle=(t,e,n)=>{let r=null,o=null,s=null;try{s=new nle(e,n)}catch{return null}return t.forEach(i=>{s.test(i)&&(!r||o.compare(i)===1)&&(r=i,o=new tle(r,n))}),r};d0.exports=rle});var S0=f((AGe,f0)=>{"use strict";var Bm=At(),ole=Rn(),E0=Gc(),sle=(t,e)=>{t=new ole(t,e);let n=new Bm("0.0.0");if(t.test(n)||(n=new Bm("0.0.0-0"),t.test(n)))return n;n=null;for(let r=0;r<t.set.length;++r){let o=t.set[r],s=null;o.forEach(i=>{let a=new Bm(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||E0(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!n||E0(n,s))&&(n=s)}return n&&t.test(n)?n:null};f0.exports=sle});var m0=f((RGe,T0)=>{"use strict";var ile=Rn(),ale=(t,e)=>{try{return new ile(t,e).range||"*"}catch{return null}};T0.exports=ale});var md=f((OGe,R0)=>{"use strict";var cle=At(),A0=Hc(),{ANY:ule}=A0,lle=Rn(),ple=Fc(),h0=Gc(),g0=_d(),dle=fd(),_le=Ed(),Ele=(t,e,n,r)=>{t=new cle(t,r),e=new lle(e,r);let o,s,i,a,c;switch(n){case">":o=h0,s=dle,i=g0,a=">",c=">=";break;case"<":o=g0,s=_le,i=h0,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ple(t,e,r))return!1;for(let u=0;u<e.set.length;++u){let l=e.set[u],p=null,d=null;if(l.forEach(_=>{_.semver===ule&&(_=new A0(">=0.0.0")),p=p||_,d=d||_,o(_.semver,p.semver,r)?p=_:i(_.semver,d.semver,r)&&(d=_)}),p.operator===a||p.operator===c||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===c&&i(t,d.semver))return!1}return!0};R0.exports=Ele});var N0=f((NGe,O0)=>{"use strict";var fle=md(),Sle=(t,e,n)=>fle(t,e,">",n);O0.exports=Sle});var C0=f((IGe,I0)=>{"use strict";var Tle=md(),mle=(t,e,n)=>Tle(t,e,"<",n);I0.exports=mle});var y0=f((CGe,M0)=>{"use strict";var P0=Rn(),hle=(t,e,n)=>(t=new P0(t,n),e=new P0(e,n),t.intersects(e,n));M0.exports=hle});var b0=f((PGe,v0)=>{"use strict";var gle=Fc(),Ale=An();v0.exports=(t,e,n)=>{let r=[],o=null,s=null,i=t.sort((l,p)=>Ale(l,p,n));for(let l of i)gle(l,e,n)?(s=l,o||(o=l)):(s&&r.push([o,s]),s=null,o=null);o&&r.push([o,null]);let a=[];for(let[l,p]of r)l===p?a.push(l):!p&&l===i[0]?a.push("*"):p?l===i[0]?a.push(`<=${p}`):a.push(`${l} - ${p}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var V0=f((MGe,w0)=>{"use strict";var L0=Rn(),Hm=Hc(),{ANY:Gm}=Hm,jc=Fc(),km=An(),Rle=(t,e,n={})=>{if(t===e)return!0;t=new L0(t,n),e=new L0(e,n);let r=!1;e:for(let o of t.set){for(let s of e.set){let i=Nle(o,s,n);if(r=r||i!==null,i)continue e}if(r)return!1}return!0},Ole=[new Hm(">=0.0.0-0")],D0=[new Hm(">=0.0.0")],Nle=(t,e,n)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Gm){if(e.length===1&&e[0].semver===Gm)return!0;n.includePrerelease?t=Ole:t=D0}if(e.length===1&&e[0].semver===Gm){if(n.includePrerelease)return!0;e=D0}let r=new Set,o,s;for(let _ of t)_.operator===">"||_.operator===">="?o=x0(o,_,n):_.operator==="<"||_.operator==="<="?s=U0(s,_,n):r.add(_.semver);if(r.size>1)return null;let i;if(o&&s){if(i=km(o.semver,s.semver,n),i>0)return null;if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let _ of r){if(o&&!jc(_,String(o),n)||s&&!jc(_,String(s),n))return null;for(let E of e)if(!jc(_,String(E),n))return!1;return!0}let a,c,u,l,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let _ of e){if(l=l||_.operator===">"||_.operator===">=",u=u||_.operator==="<"||_.operator==="<=",o){if(d&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===d.major&&_.semver.minor===d.minor&&_.semver.patch===d.patch&&(d=!1),_.operator===">"||_.operator===">="){if(a=x0(o,_,n),a===_&&a!==o)return!1}else if(o.operator===">="&&!jc(o.semver,String(_),n))return!1}if(s){if(p&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===p.major&&_.semver.minor===p.minor&&_.semver.patch===p.patch&&(p=!1),_.operator==="<"||_.operator==="<="){if(c=U0(s,_,n),c===_&&c!==s)return!1}else if(s.operator==="<="&&!jc(s.semver,String(_),n))return!1}if(!_.operator&&(s||o)&&i!==0)return!1}return!(o&&u&&!s&&i!==0||s&&l&&!o&&i!==0||d||p)},x0=(t,e,n)=>{if(!t)return e;let r=km(t.semver,e.semver,n);return r>0?t:r<0||e.operator===">"&&t.operator===">="?e:t},U0=(t,e,n)=>{if(!t)return e;let r=km(t.semver,e.semver,n);return r<0?t:r>0||e.operator==="<"&&t.operator==="<="?e:t};w0.exports=Rle});var jm=f((yGe,H0)=>{"use strict";var Fm=Mi(),B0=Vc(),Ile=At(),G0=Cm(),Cle=Cs(),Ple=pU(),Mle=_U(),yle=SU(),vle=hU(),ble=AU(),Lle=OU(),Dle=IU(),xle=PU(),Ule=An(),wle=bU(),Vle=DU(),Ble=dd(),Gle=VU(),Hle=GU(),kle=Gc(),Fle=_d(),jle=ym(),$le=vm(),Yle=Ed(),qle=fd(),Kle=bm(),Wle=WU(),Xle=Hc(),zle=Rn(),Jle=Fc(),Qle=u0(),Zle=p0(),epe=_0(),tpe=S0(),npe=m0(),rpe=md(),ope=N0(),spe=C0(),ipe=y0(),ape=b0(),cpe=V0();H0.exports={parse:Cle,valid:Ple,clean:Mle,inc:yle,diff:vle,major:ble,minor:Lle,patch:Dle,prerelease:xle,compare:Ule,rcompare:wle,compareLoose:Vle,compareBuild:Ble,sort:Gle,rsort:Hle,gt:kle,lt:Fle,eq:jle,neq:$le,gte:Yle,lte:qle,cmp:Kle,coerce:Wle,Comparator:Xle,Range:zle,satisfies:Jle,toComparators:Qle,maxSatisfying:Zle,minSatisfying:epe,minVersion:tpe,validRange:npe,outside:rpe,gtr:ope,ltr:spe,intersects:ipe,simplifyRange:ape,subset:cpe,SemVer:Ile,re:Fm.re,src:Fm.src,tokens:Fm.t,SEMVER_SPEC_VERSION:B0.SEMVER_SPEC_VERSION,RELEASE_TYPES:B0.RELEASE_TYPES,compareIdentifiers:G0.compareIdentifiers,rcompareIdentifiers:G0.rcompareIdentifiers}});var k0=f(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.VERSION=void 0;hd.VERSION="0.57.2"});var F0=f($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.SeverityNumber=void 0;var upe;(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"})(upe=$c.SeverityNumber||($c.SeverityNumber={}))});var Ad=f(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.NOOP_LOGGER=yi.NoopLogger=void 0;var gd=class{emit(e){}};yi.NoopLogger=gd;yi.NOOP_LOGGER=new gd});var Od=f(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.NOOP_LOGGER_PROVIDER=vi.NoopLoggerProvider=void 0;var lpe=Ad(),Rd=class{getLogger(e,n,r){return new lpe.NoopLogger}};vi.NoopLoggerProvider=Rd;vi.NOOP_LOGGER_PROVIDER=new Rd});var Ym=f(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.ProxyLogger=void 0;var ppe=Ad(),$m=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):ppe.NOOP_LOGGER}};Nd.ProxyLogger=$m});var Km=f(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.ProxyLoggerProvider=void 0;var dpe=Od(),_pe=Ym(),qm=class{getLogger(e,n,r){var o;return(o=this.getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new _pe.ProxyLogger(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:dpe.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)}};Id.ProxyLoggerProvider=qm});var j0=f(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd._globalThis=void 0;Cd._globalThis=typeof globalThis=="object"?globalThis:global});var $0=f(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd._globalThis=void 0;var Epe=j0();Object.defineProperty(Pd,"_globalThis",{enumerable:!0,get:function(){return Epe._globalThis}})});var Y0=f(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md._globalThis=void 0;var fpe=$0();Object.defineProperty(Md,"_globalThis",{enumerable:!0,get:function(){return fpe._globalThis}})});var q0=f(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.API_BACKWARDS_COMPATIBILITY_VERSION=pr.makeGetter=pr._global=pr.GLOBAL_LOGS_API_KEY=void 0;var Spe=Y0();pr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");pr._global=Spe._globalThis;function Tpe(t,e,n){return r=>r===t?e:n}pr.makeGetter=Tpe;pr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var W0=f(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});yd.LogsAPI=void 0;var On=q0(),mpe=Od(),K0=Km(),Wm=class t{constructor(){this._proxyLoggerProvider=new K0.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return On._global[On.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(On._global[On.GLOBAL_LOGS_API_KEY]=(0,On.makeGetter)(On.API_BACKWARDS_COMPATIBILITY_VERSION,e,mpe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=On._global[On.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(On._global,On.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete On._global[On.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new K0.ProxyLoggerProvider}};yd.LogsAPI=Wm});var Xm=f(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.logs=st.ProxyLoggerProvider=st.ProxyLogger=st.NoopLoggerProvider=st.NOOP_LOGGER_PROVIDER=st.NoopLogger=st.NOOP_LOGGER=st.SeverityNumber=void 0;var hpe=F0();Object.defineProperty(st,"SeverityNumber",{enumerable:!0,get:function(){return hpe.SeverityNumber}});var X0=Ad();Object.defineProperty(st,"NOOP_LOGGER",{enumerable:!0,get:function(){return X0.NOOP_LOGGER}});Object.defineProperty(st,"NoopLogger",{enumerable:!0,get:function(){return X0.NoopLogger}});var z0=Od();Object.defineProperty(st,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return z0.NOOP_LOGGER_PROVIDER}});Object.defineProperty(st,"NoopLoggerProvider",{enumerable:!0,get:function(){return z0.NoopLoggerProvider}});var gpe=Ym();Object.defineProperty(st,"ProxyLogger",{enumerable:!0,get:function(){return gpe.ProxyLogger}});var Ape=Km();Object.defineProperty(st,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Ape.ProxyLoggerProvider}});var Rpe=W0();st.logs=Rpe.LogsAPI.getInstance()});var J0=f(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.disableInstrumentations=bi.enableInstrumentations=void 0;function Ope(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()}}bi.enableInstrumentations=Ope;function Npe(t){t.forEach(e=>e.disable())}bi.disableInstrumentations=Npe});var ew=f(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.registerInstrumentations=void 0;var Q0=(y(),I(x)),Ipe=Xm(),Z0=J0();function Cpe(t){var e,n;let r=t.tracerProvider||Q0.trace.getTracerProvider(),o=t.meterProvider||Q0.metrics.getMeterProvider(),s=t.loggerProvider||Ipe.logs.getLoggerProvider(),i=(n=(e=t.instrumentations)===null||e===void 0?void 0:e.flat())!==null&&n!==void 0?n:[];return(0,Z0.enableInstrumentations)(i,r,o,s),()=>{(0,Z0.disableInstrumentations)(i)}}vd.registerInstrumentations=Cpe});var Jm=f(($Ge,rw)=>{"use strict";function zm(t){return typeof t=="function"}var Vt=console.error.bind(console);function Yc(t,e,n){var r=!!t[e]&&t.propertyIsEnumerable(e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}function qc(t){t&&t.logger&&(zm(t.logger)?Vt=t.logger:Vt("new logger isn't a function, not replacing"))}function tw(t,e,n){if(!t||!t[e]){Vt("no original function "+e+" to wrap");return}if(!n){Vt("no wrapper function"),Vt(new Error().stack);return}if(!zm(t[e])||!zm(n)){Vt("original object and wrapper must be functions");return}var r=t[e],o=n(r,e);return Yc(o,"__original",r),Yc(o,"__unwrap",function(){t[e]===o&&Yc(t,e,r)}),Yc(o,"__wrapped",!0),Yc(t,e,o),o}function Ppe(t,e,n){if(t)Array.isArray(t)||(t=[t]);else{Vt("must provide one or more modules to patch"),Vt(new Error().stack);return}if(!(e&&Array.isArray(e))){Vt("must provide one or more functions to wrap on modules");return}t.forEach(function(r){e.forEach(function(o){tw(r,o,n)})})}function nw(t,e){if(!t||!t[e]){Vt("no function to unwrap."),Vt(new Error().stack);return}if(!t[e].__unwrap)Vt("no original to unwrap to -- has "+e+" already been unwrapped?");else return t[e].__unwrap()}function Mpe(t,e){if(t)Array.isArray(t)||(t=[t]);else{Vt("must provide one or more modules to patch"),Vt(new Error().stack);return}if(!(e&&Array.isArray(e))){Vt("must provide one or more functions to unwrap on modules");return}t.forEach(function(n){e.forEach(function(r){nw(n,r)})})}qc.wrap=tw;qc.massWrap=Ppe;qc.unwrap=nw;qc.massUnwrap=Mpe;rw.exports=qc});var ow=f(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.InstrumentationAbstract=void 0;var Qm=(y(),I(x)),ype=Xm(),bd=Jm(),Zm=class{constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this._config={},this._wrap=bd.wrap,this._unwrap=bd.unwrap,this._massWrap=bd.massWrap,this._massUnwrap=bd.massUnwrap,this.setConfig(r),this._diag=Qm.diag.createComponentLogger({namespace:e}),this._tracer=Qm.trace.getTracer(e,n),this._meter=Qm.metrics.getMeter(e,n),this._logger=ype.logs.getLogger(e,n),this._updateMetricInstruments()}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(){var e;let n=(e=this.init())!==null&&e!==void 0?e:[];return Array.isArray(n)?n:[n]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=Object.assign({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)}}};Ld.InstrumentationAbstract=Zm});var iw=f((qGe,sw)=>{var Li=1e3,Di=Li*60,xi=Di*60,Ps=xi*24,vpe=Ps*7,bpe=Ps*365.25;sw.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return Lpe(t);if(n==="number"&&isFinite(t))return e.long?xpe(t):Dpe(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Lpe(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*bpe;case"weeks":case"week":case"w":return n*vpe;case"days":case"day":case"d":return n*Ps;case"hours":case"hour":case"hrs":case"hr":case"h":return n*xi;case"minutes":case"minute":case"mins":case"min":case"m":return n*Di;case"seconds":case"second":case"secs":case"sec":case"s":return n*Li;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Dpe(t){var e=Math.abs(t);return e>=Ps?Math.round(t/Ps)+"d":e>=xi?Math.round(t/xi)+"h":e>=Di?Math.round(t/Di)+"m":e>=Li?Math.round(t/Li)+"s":t+"ms"}function xpe(t){var e=Math.abs(t);return e>=Ps?Dd(t,e,Ps,"day"):e>=xi?Dd(t,e,xi,"hour"):e>=Di?Dd(t,e,Di,"minute"):e>=Li?Dd(t,e,Li,"second"):t+" ms"}function Dd(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var eh=f((KGe,aw)=>{function Upe(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=iw(),n.destroy=u,Object.keys(t).forEach(l=>{n[l]=t[l]}),n.names=[],n.skips=[],n.formatters={};function e(l){let p=0;for(let d=0;d<l.length;d++)p=(p<<5)-p+l.charCodeAt(d),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=e;function n(l){let p,d=null,_,E;function S(...T){if(!S.enabled)return;let h=S,R=Number(new Date),O=R-(p||R);h.diff=O,h.prev=p,h.curr=R,p=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let N=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(M,v)=>{if(M==="%%")return"%";N++;let X=n.formatters[v];if(typeof X=="function"){let q=T[N];M=X.call(h,q),T.splice(N,1),N--}return M}),n.formatArgs.call(h,T),(h.log||n.log).apply(h,T)}return S.namespace=l,S.useColors=n.useColors(),S.color=n.selectColor(l),S.extend=r,S.destroy=n.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==n.namespaces&&(_=n.namespaces,E=n.enabled(l)),E),set:T=>{d=T}}),typeof n.init=="function"&&n.init(S),S}function r(l,p){let d=n(this.namespace+(typeof p>"u"?":":p)+l);return d.log=this.log,d}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];let p=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of p)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function s(l,p){let d=0,_=0,E=-1,S=0;for(;d<l.length;)if(_<p.length&&(p[_]===l[d]||p[_]==="*"))p[_]==="*"?(E=_,S=d,_++):(d++,_++);else if(E!==-1)_=E+1,S++,d=S;else return!1;for(;_<p.length&&p[_]==="*";)_++;return _===p.length}function i(){let l=[...n.names,...n.skips.map(p=>"-"+p)].join(",");return n.enable(""),l}function a(l){for(let p of n.skips)if(s(l,p))return!1;for(let p of n.names)if(s(l,p))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){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}aw.exports=Upe});var cw=f((Xt,xd)=>{Xt.formatArgs=Vpe;Xt.save=Bpe;Xt.load=Gpe;Xt.useColors=wpe;Xt.storage=Hpe();Xt.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`."))}})();Xt.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 wpe(){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 Vpe(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+xd.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)}Xt.log=console.debug||console.log||(()=>{});function Bpe(t){try{t?Xt.storage.setItem("debug",t):Xt.storage.removeItem("debug")}catch{}}function Gpe(){let t;try{t=Xt.storage.getItem("debug")||Xt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Hpe(){try{return localStorage}catch{}}xd.exports=eh()(Xt);var{formatters:kpe}=xd.exports;kpe.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var lw=f((WGe,uw)=>{"use strict";uw.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 _w=f((XGe,dw)=>{"use strict";var Fpe=require("os"),pw=require("tty"),Nn=lw(),{env:it}=process,Ao;Nn("no-color")||Nn("no-colors")||Nn("color=false")||Nn("color=never")?Ao=0:(Nn("color")||Nn("colors")||Nn("color=true")||Nn("color=always"))&&(Ao=1);"FORCE_COLOR"in it&&(it.FORCE_COLOR==="true"?Ao=1:it.FORCE_COLOR==="false"?Ao=0:Ao=it.FORCE_COLOR.length===0?1:Math.min(parseInt(it.FORCE_COLOR,10),3));function th(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function nh(t,e){if(Ao===0)return 0;if(Nn("color=16m")||Nn("color=full")||Nn("color=truecolor"))return 3;if(Nn("color=256"))return 2;if(t&&!e&&Ao===void 0)return 0;let n=Ao||0;if(it.TERM==="dumb")return n;if(process.platform==="win32"){let r=Fpe.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in it)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in it)||it.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in it)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(it.TEAMCITY_VERSION)?1:0;if(it.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in it){let r=parseInt((it.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(it.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(it.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(it.TERM)||"COLORTERM"in it?1:n}function jpe(t){let e=nh(t,t&&t.isTTY);return th(e)}dw.exports={supportsColor:jpe,stdout:th(nh(!0,pw.isatty(1))),stderr:th(nh(!0,pw.isatty(2)))}});var fw=f((at,wd)=>{var $pe=require("tty"),Ud=require("util");at.init=Jpe;at.log=Wpe;at.formatArgs=qpe;at.save=Xpe;at.load=zpe;at.useColors=Ype;at.destroy=Ud.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=_w();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 Ype(){return"colors"in at.inspectOpts?!!at.inspectOpts.colors:$pe.isatty(process.stderr.fd)}function qpe(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(`
|
|
2
|
-
`).
|
|
3
|
-
|
|
4
|
-
`)
|
|
5
|
-
`).map(e=>e.trim()).join(" ")};Ew.O=function(t){return this.inspectOpts.colors=this.useColors,Ud.inspect(t,this.inspectOpts)}});var Sw=f((zGe,rh)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?rh.exports=cw():rh.exports=fw()});var sh=f((JGe,Tw)=>{"use strict";var oh=require("path").sep;Tw.exports=function(t){var e=t.split(oh),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]+oh;for(var u="",l=e.length-1,p=n+s;p<=l;p++)p===l?u+=e[p]:u+=e[p]+oh;return{name:o,basedir:i,path:u}}}});var ih=f((QGe,mw)=>{"use strict";var Qpe=require("os");mw.exports=Qpe.homedir||function(){var e=process.env.HOME,n=process.env.LOGNAME||process.env.USER||process.env.LNAME||process.env.USERNAME;return process.platform==="win32"?process.env.USERPROFILE||process.env.HOMEDRIVE&&process.env.HOMEPATH&&process.env.HOMEDRIVE+process.env.HOMEPATH||e||null:process.platform==="darwin"?e||(n?"/Users/"+n:null):process.platform==="linux"?e||(process.getuid()===0?"/root":n?"/home/"+n:null):e||null}});var Vd=f((ZGe,hw)=>{"use strict";hw.exports=Error});var ah=f((eHe,gw)=>{"use strict";var Bd=Vd();gw.exports=function(){var t=Bd.prepareStackTrace;Bd.prepareStackTrace=function(n,r){return r};var e=new Bd().stack;return Bd.prepareStackTrace=t,e[2].getFileName()}});var Aw=f((tHe,Kc)=>{"use strict";var Zpe=process.platform==="win32",ede=/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/,ch={};function tde(t){return ede.exec(t).slice(1)}ch.parse=function(t){if(typeof t!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof t);var e=tde(t);if(!e||e.length!==5)throw new TypeError("Invalid path '"+t+"'");return{root:e[1],dir:e[0]===e[1]?e[0]:e[0].slice(0,-1),base:e[2],ext:e[4],name:e[3]}};var nde=/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,uh={};function rde(t){return nde.exec(t).slice(1)}uh.parse=function(t){if(typeof t!="string")throw new TypeError("Parameter 'pathString' must be a string, not "+typeof t);var e=rde(t);if(!e||e.length!==5)throw new TypeError("Invalid path '"+t+"'");return{root:e[1],dir:e[0].slice(0,-1),base:e[2],ext:e[4],name:e[3]}};Zpe?Kc.exports=ch.parse:Kc.exports=uh.parse;Kc.exports.posix=uh.parse;Kc.exports.win32=ch.parse});var lh=f((nHe,Iw)=>{var Nw=require("path"),Rw=Nw.parse||Aw(),ode=/^([A-Za-z]:)/,sde=/^\\\\/;function Ow(t,e){var n="/";ode.test(t)?n="":sde.test(t)&&(n="\\\\");for(var r=[t],o=Rw(t);o.dir!==r[r.length-1];)r.push(o.dir),o=Rw(o.dir);return r.reduce(function(s,i){return s.concat(e.map(function(a){return Nw.resolve(n,i,a)}))},[])}Iw.exports=function(e,n,r){var o=n&&n.moduleDirectory?[].concat(n.moduleDirectory):["node_modules"];if(n&&typeof n.paths=="function")return n.paths(r,e,function(){return Ow(e,o)},n);var s=Ow(e,o);return n&&n.paths?s.concat(n.paths):s}});var ph=f((rHe,Cw)=>{Cw.exports=function(t,e){return e||{}}});var yw=f((oHe,Mw)=>{"use strict";var ide="Function.prototype.bind called on incompatible ",ade=Object.prototype.toString,cde=Math.max,ude="[object Function]",Pw=function(e,n){for(var r=[],o=0;o<e.length;o+=1)r[o]=e[o];for(var s=0;s<n.length;s+=1)r[s+e.length]=n[s];return r},lde=function(e,n){for(var r=[],o=n||0,s=0;o<e.length;o+=1,s+=1)r[s]=e[o];return r},pde=function(t,e){for(var n="",r=0;r<t.length;r+=1)n+=t[r],r+1<t.length&&(n+=e);return n};Mw.exports=function(e){var n=this;if(typeof n!="function"||ade.apply(n)!==ude)throw new TypeError(ide+n);for(var r=lde(arguments,1),o,s=function(){if(this instanceof o){var l=n.apply(this,Pw(r,arguments));return Object(l)===l?l:this}return n.apply(e,Pw(r,arguments))},i=cde(0,n.length-r.length),a=[],c=0;c<i;c++)a[c]="$"+c;if(o=Function("binder","return function ("+pde(a,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var u=function(){};u.prototype=n.prototype,o.prototype=new u,u.prototype=null}return o}});var bw=f((sHe,vw)=>{"use strict";var dde=yw();vw.exports=Function.prototype.bind||dde});var Dw=f((iHe,Lw)=>{"use strict";var _de=Function.prototype.call,Ede=Object.prototype.hasOwnProperty,fde=bw();Lw.exports=fde.call(_de,Ede)});var xw=f((aHe,Sde)=>{Sde.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var Wc=f((cHe,Vw)=>{"use strict";var Tde=Dw();function mde(t,e){for(var n=t.split("."),r=e.split(" "),o=r.length>1?r[0]:"=",s=(r.length>1?r[1]:r[0]).split("."),i=0;i<3;++i){var a=parseInt(n[i]||0,10),c=parseInt(s[i]||0,10);if(a!==c)return o==="<"?a<c:o===">="?a>=c:!1}return o===">="}function Uw(t,e){var n=e.split(/ ?&& ?/);if(n.length===0)return!1;for(var r=0;r<n.length;++r)if(!mde(t,n[r]))return!1;return!0}function hde(t,e){if(typeof e=="boolean")return e;var n=typeof t>"u"?process.versions&&process.versions.node:t;if(typeof n!="string")throw new TypeError(typeof t>"u"?"Unable to determine current node version":"If provided, a valid node version is required");if(e&&typeof e=="object"){for(var r=0;r<e.length;++r)if(Uw(n,e[r]))return!0;return!1}return Uw(n,e)}var ww=xw();Vw.exports=function(e,n){return Tde(ww,e)&&hde(n,ww[e])}});var dh=f((uHe,Bw)=>{"use strict";Bw.exports=TypeError});var kw=f((lHe,Hw)=>{var Ms=require("fs"),gde=ih(),Ye=require("path"),Ade=ah(),Rde=lh(),Ode=ph(),Nde=Wc(),Gw=Vd(),_h=dh(),Ide=process.platform!=="win32"&&Ms.realpath&&typeof Ms.realpath.native=="function"?Ms.realpath.native:Ms.realpath,Cde=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,Pde=/^\w:[/\\]*$/,Mde=/[/\\]node_modules[/\\]*$/,Eh=gde();function yde(){return Eh?[Ye.join(Eh,".node_modules"),Ye.join(Eh,".node_libraries")]:[]}var vde=function(e,n){Ms.stat(e,function(r,o){return r?r.code==="ENOENT"||r.code==="ENOTDIR"?n(null,!1):n(r):n(null,o.isFile()||o.isFIFO())})},bde=function(e,n){Ms.stat(e,function(r,o){return r?r.code==="ENOENT"||r.code==="ENOTDIR"?n(null,!1):n(r):n(null,o.isDirectory())})},Lde=function(e,n){Ide(e,function(r,o){r&&r.code!=="ENOENT"?n(r):n(null,r?e:o)})};function Xc(t,e,n,r){n&&n.preserveSymlinks===!1?t(e,r):r(null,e)}function Dde(t,e,n){t(e,function(r,o){if(r)n(r);else try{var s=JSON.parse(o);n(null,s)}catch{n(null)}})}function xde(t,e,n){for(var r=Rde(e,n,t),o=0;o<r.length;o++)r[o]=Ye.join(r[o],t);return r}Hw.exports=function(e,n,r){var o=r,s=n;if(typeof n=="function"&&(o=s,s={}),typeof e!="string"){var i=new _h("Path must be a string.");return process.nextTick(function(){o(i)})}s=Ode(e,s);var a=s.isFile||vde,c=s.isDirectory||bde,u=s.readFile||Ms.readFile,l=s.realpath||Lde,p=s.readPackage||Dde;if(s.readFile&&s.readPackage){var d=new _h("`readFile` and `readPackage` are mutually exclusive.");return process.nextTick(function(){o(d)})}var _=s.packageIterator,E=s.extensions||[".js"],S=s.includeCoreModules!==!1,T=s.basedir||Ye.dirname(Ade()),h=s.filename||T;s.paths=s.paths||yde();var R=Ye.resolve(T);Xc(l,R,s,function(w,Q){w?o(w):N(Q)});var O;function N(w){if(Cde.test(e))O=Ye.resolve(w,e),(e==="."||e===".."||e.slice(-1)==="/")&&(O+="/"),e.slice(-1)==="/"&&O===w?X(O,s.package,A):M(O,s.package,A);else{if(S&&Nde(e))return o(null,e);Ue(e,w,function(Q,Re,ne){if(Q)o(Q);else{if(Re)return Xc(l,Re,s,function(fn,we){fn?o(fn):o(null,we,ne)});var Me=new Gw("Cannot find module '"+e+"' from '"+h+"'");Me.code="MODULE_NOT_FOUND",o(Me)}})}}function A(w,Q,Re){w?o(w):Q?o(null,Q,Re):X(O,function(ne,Me,fn){if(ne)o(ne);else if(Me)Xc(l,Me,s,function(ye,jt){ye?o(ye):o(null,jt,fn)});else{var we=new Gw("Cannot find module '"+e+"' from '"+h+"'");we.code="MODULE_NOT_FOUND",o(we)}})}function M(w,Q,Re){var ne=Q,Me=Re;typeof ne=="function"&&(Me=ne,ne=void 0);var fn=[""].concat(E);we(fn,w,ne);function we(ye,jt,Lr){if(ye.length===0)return Me(null,void 0,Lr);var Ss=jt+ye[0],tr=Lr;tr?St(null,tr):v(Ye.dirname(Ss),St);function St(lo,ui,Dr){if(tr=ui,lo)return Me(lo);if(Dr&&tr&&s.pathFilter){var Cl=Ye.relative(Dr,Ss),Pl=Cl.slice(0,Cl.length-ye[0].length),uc=s.pathFilter(tr,jt,Pl);if(uc)return we([""].concat(E),Ye.resolve(Dr,uc),tr)}a(Ss,Il)}function Il(lo,ui){if(lo)return Me(lo);if(ui)return Me(null,Ss,tr);we(ye.slice(1),jt,tr)}}}function v(w,Q){if(w===""||w==="/"||process.platform==="win32"&&Pde.test(w)||Mde.test(w))return Q(null);Xc(l,w,s,function(Re,ne){if(Re)return v(Ye.dirname(w),Q);var Me=Ye.join(ne,"package.json");a(Me,function(fn,we){if(!we)return v(Ye.dirname(w),Q);p(u,Me,function(ye,jt){if(ye)return Q(ye);var Lr=jt;Lr&&s.packageFilter&&(Lr=s.packageFilter(Lr,Me)),Q(null,Lr,w)})})})}function X(w,Q,Re){var ne=Re,Me=Q;typeof Me=="function"&&(ne=Me,Me=s.package),Xc(l,w,s,function(fn,we){if(fn)return ne(fn);var ye=Ye.join(we,"package.json");a(ye,function(jt,Lr){if(jt)return ne(jt);if(!Lr)return M(Ye.join(w,"index"),Me,ne);p(u,ye,function(Ss,tr){if(Ss)return ne(Ss);var St=tr;if(St&&s.packageFilter&&(St=s.packageFilter(St,ye)),St&&St.main){if(typeof St.main!="string"){var Il=new _h("package \u201C"+St.name+"\u201D `main` must be a string");return Il.code="INVALID_PACKAGE_MAIN",ne(Il)}(St.main==="."||St.main==="./")&&(St.main="index"),M(Ye.resolve(w,St.main),St,function(lo,ui,Dr){if(lo)return ne(lo);if(ui)return ne(null,ui,Dr);if(!Dr)return M(Ye.join(w,"index"),Dr,ne);var Cl=Ye.resolve(w,Dr.main);X(Cl,Dr,function(Pl,uc,aN){if(Pl)return ne(Pl);if(uc)return ne(null,uc,aN);M(Ye.join(w,"index"),aN,ne)})});return}M(Ye.join(w,"/index"),St,ne)})})})}function q(w,Q){if(Q.length===0)return w(null,void 0);var Re=Q[0];c(Ye.dirname(Re),ne);function ne(we,ye){if(we)return w(we);if(!ye)return q(w,Q.slice(1));M(Re,s.package,Me)}function Me(we,ye,jt){if(we)return w(we);if(ye)return w(null,ye,jt);X(Re,s.package,fn)}function fn(we,ye,jt){if(we)return w(we);if(ye)return w(null,ye,jt);q(w,Q.slice(1))}}function Ue(w,Q,Re){var ne=function(){return xde(w,Q,s)};q(Re,_?_(w,Q,ne,s):ne())}}});var Fw=f((pHe,Ude)=>{Ude.exports={assert:!0,"node:assert":[">= 14.18 && < 15",">= 16"],"assert/strict":">= 15","node:assert/strict":">= 16",async_hooks:">= 8","node:async_hooks":[">= 14.18 && < 15",">= 16"],buffer_ieee754:">= 0.5 && < 0.9.7",buffer:!0,"node:buffer":[">= 14.18 && < 15",">= 16"],child_process:!0,"node:child_process":[">= 14.18 && < 15",">= 16"],cluster:">= 0.5","node:cluster":[">= 14.18 && < 15",">= 16"],console:!0,"node:console":[">= 14.18 && < 15",">= 16"],constants:!0,"node:constants":[">= 14.18 && < 15",">= 16"],crypto:!0,"node:crypto":[">= 14.18 && < 15",">= 16"],_debug_agent:">= 1 && < 8",_debugger:"< 8",dgram:!0,"node:dgram":[">= 14.18 && < 15",">= 16"],diagnostics_channel:[">= 14.17 && < 15",">= 15.1"],"node:diagnostics_channel":[">= 14.18 && < 15",">= 16"],dns:!0,"node:dns":[">= 14.18 && < 15",">= 16"],"dns/promises":">= 15","node:dns/promises":">= 16",domain:">= 0.7.12","node:domain":[">= 14.18 && < 15",">= 16"],events:!0,"node:events":[">= 14.18 && < 15",">= 16"],freelist:"< 6",fs:!0,"node:fs":[">= 14.18 && < 15",">= 16"],"fs/promises":[">= 10 && < 10.1",">= 14"],"node:fs/promises":[">= 14.18 && < 15",">= 16"],_http_agent:">= 0.11.1","node:_http_agent":[">= 14.18 && < 15",">= 16"],_http_client:">= 0.11.1","node:_http_client":[">= 14.18 && < 15",">= 16"],_http_common:">= 0.11.1","node:_http_common":[">= 14.18 && < 15",">= 16"],_http_incoming:">= 0.11.1","node:_http_incoming":[">= 14.18 && < 15",">= 16"],_http_outgoing:">= 0.11.1","node:_http_outgoing":[">= 14.18 && < 15",">= 16"],_http_server:">= 0.11.1","node:_http_server":[">= 14.18 && < 15",">= 16"],http:!0,"node:http":[">= 14.18 && < 15",">= 16"],http2:">= 8.8","node:http2":[">= 14.18 && < 15",">= 16"],https:!0,"node:https":[">= 14.18 && < 15",">= 16"],inspector:">= 8","node:inspector":[">= 14.18 && < 15",">= 16"],"inspector/promises":[">= 19"],"node:inspector/promises":[">= 19"],_linklist:"< 8",module:!0,"node:module":[">= 14.18 && < 15",">= 16"],net:!0,"node:net":[">= 14.18 && < 15",">= 16"],"node-inspect/lib/_inspect":">= 7.6 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6 && < 12",os:!0,"node:os":[">= 14.18 && < 15",">= 16"],path:!0,"node:path":[">= 14.18 && < 15",">= 16"],"path/posix":">= 15.3","node:path/posix":">= 16","path/win32":">= 15.3","node:path/win32":">= 16",perf_hooks:">= 8.5","node:perf_hooks":[">= 14.18 && < 15",">= 16"],process:">= 1","node:process":[">= 14.18 && < 15",">= 16"],punycode:">= 0.5","node:punycode":[">= 14.18 && < 15",">= 16"],querystring:!0,"node:querystring":[">= 14.18 && < 15",">= 16"],readline:!0,"node:readline":[">= 14.18 && < 15",">= 16"],"readline/promises":">= 17","node:readline/promises":">= 17",repl:!0,"node:repl":[">= 14.18 && < 15",">= 16"],"node:sea":[">= 20.12 && < 21",">= 21.7"],smalloc:">= 0.11.5 && < 3","node:sqlite":[">= 22.13 && < 23",">= 23.4"],_stream_duplex:">= 0.9.4","node:_stream_duplex":[">= 14.18 && < 15",">= 16"],_stream_transform:">= 0.9.4","node:_stream_transform":[">= 14.18 && < 15",">= 16"],_stream_wrap:">= 1.4.1","node:_stream_wrap":[">= 14.18 && < 15",">= 16"],_stream_passthrough:">= 0.9.4","node:_stream_passthrough":[">= 14.18 && < 15",">= 16"],_stream_readable:">= 0.9.4","node:_stream_readable":[">= 14.18 && < 15",">= 16"],_stream_writable:">= 0.9.4","node:_stream_writable":[">= 14.18 && < 15",">= 16"],stream:!0,"node:stream":[">= 14.18 && < 15",">= 16"],"stream/consumers":">= 16.7","node:stream/consumers":">= 16.7","stream/promises":">= 15","node:stream/promises":">= 16","stream/web":">= 16.5","node:stream/web":">= 16.5",string_decoder:!0,"node:string_decoder":[">= 14.18 && < 15",">= 16"],sys:[">= 0.4 && < 0.7",">= 0.8"],"node:sys":[">= 14.18 && < 15",">= 16"],"test/reporters":">= 19.9 && < 20.2","node:test/reporters":[">= 18.17 && < 19",">= 19.9",">= 20"],"test/mock_loader":">= 22.3 && < 22.7","node:test/mock_loader":">= 22.3 && < 22.7","node:test":[">= 16.17 && < 17",">= 18"],timers:!0,"node:timers":[">= 14.18 && < 15",">= 16"],"timers/promises":">= 15","node:timers/promises":">= 16",_tls_common:">= 0.11.13","node:_tls_common":[">= 14.18 && < 15",">= 16"],_tls_legacy:">= 0.11.3 && < 10",_tls_wrap:">= 0.11.3","node:_tls_wrap":[">= 14.18 && < 15",">= 16"],tls:!0,"node:tls":[">= 14.18 && < 15",">= 16"],trace_events:">= 10","node:trace_events":[">= 14.18 && < 15",">= 16"],tty:!0,"node:tty":[">= 14.18 && < 15",">= 16"],url:!0,"node:url":[">= 14.18 && < 15",">= 16"],util:!0,"node:util":[">= 14.18 && < 15",">= 16"],"util/types":">= 15.3","node:util/types":">= 16","v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/consarray":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/csvparser":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/logreader":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/profile_view":[">= 4.4 && < 5",">= 5.2 && < 12"],"v8/tools/splaytree":[">= 4.4 && < 5",">= 5.2 && < 12"],v8:">= 1","node:v8":[">= 14.18 && < 15",">= 16"],vm:!0,"node:vm":[">= 14.18 && < 15",">= 16"],wasi:[">= 13.4 && < 13.5",">= 18.17 && < 19",">= 20"],"node:wasi":[">= 18.17 && < 19",">= 20"],worker_threads:">= 11.7","node:worker_threads":[">= 14.18 && < 15",">= 16"],zlib:">= 0.5","node:zlib":[">= 14.18 && < 15",">= 16"]}});var qw=f((dHe,Yw)=>{"use strict";var wde=Wc(),jw=Fw(),$w={};for(Gd in jw)Object.prototype.hasOwnProperty.call(jw,Gd)&&($w[Gd]=wde(Gd));var Gd;Yw.exports=$w});var Ww=f((_He,Kw)=>{var Vde=Wc();Kw.exports=function(e){return Vde(e)}});var zw=f((EHe,Xw)=>{var Bde=Wc(),ys=require("fs"),Ot=require("path"),Gde=Vd(),fh=dh(),Hde=ih(),kde=ah(),Fde=lh(),jde=ph(),$de=process.platform!=="win32"&&ys.realpathSync&&typeof ys.realpathSync.native=="function"?ys.realpathSync.native:ys.realpathSync,Yde=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,qde=/^\w:[/\\]*$/,Kde=/[/\\]node_modules[/\\]*$/,Sh=Hde();function Wde(){return Sh?[Ot.join(Sh,".node_modules"),Ot.join(Sh,".node_libraries")]:[]}var Xde=function(e){try{var n=ys.statSync(e,{throwIfNoEntry:!1})}catch(r){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return!1;throw r}return!!n&&(n.isFile()||n.isFIFO())},zde=function(e){try{var n=ys.statSync(e,{throwIfNoEntry:!1})}catch(r){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return!1;throw r}return!!n&&n.isDirectory()},Jde=function(e){try{return $de(e)}catch(n){if(n.code!=="ENOENT")throw n}return e};function zc(t,e,n){return n&&n.preserveSymlinks===!1?t(e):e}function Qde(t,e){var n=t(e);try{var r=JSON.parse(n);return r}catch{}}function Zde(t,e,n){for(var r=Fde(e,n,t),o=0;o<r.length;o++)r[o]=Ot.join(r[o],t);return r}Xw.exports=function(e,n){if(typeof e!="string")throw new fh("Path must be a string.");var r=jde(e,n),o=r.isFile||Xde,s=r.readFileSync||ys.readFileSync,i=r.isDirectory||zde,a=r.realpathSync||Jde,c=r.readPackageSync||Qde;if(r.readFileSync&&r.readPackageSync)throw new fh("`readFileSync` and `readPackageSync` are mutually exclusive.");var u=r.packageIterator,l=r.extensions||[".js"],p=r.includeCoreModules!==!1,d=r.basedir||Ot.dirname(kde()),_=r.filename||d;r.paths=r.paths||Wde();var E=zc(a,Ot.resolve(d),r);if(Yde.test(e)){var S=Ot.resolve(E,e);(e==="."||e===".."||e.slice(-1)==="/")&&(S+="/");var T=O(S)||A(S);if(T)return zc(a,T,r)}else{if(p&&Bde(e))return e;var h=M(e,E);if(h)return zc(a,h,r)}var R=new Gde("Cannot find module '"+e+"' from '"+_+"'");throw R.code="MODULE_NOT_FOUND",R;function O(v){var X=N(Ot.dirname(v));if(X&&X.dir&&X.pkg&&r.pathFilter){var q=Ot.relative(X.dir,v),Ue=r.pathFilter(X.pkg,v,q);Ue&&(v=Ot.resolve(X.dir,Ue))}if(o(v))return v;for(var w=0;w<l.length;w++){var Q=v+l[w];if(o(Q))return Q}}function N(v){if(!(v===""||v==="/")&&!(process.platform==="win32"&&qde.test(v))&&!Kde.test(v)){var X=Ot.join(zc(a,v,r),"package.json");if(!o(X))return N(Ot.dirname(v));var q=c(s,X);return q&&r.packageFilter&&(q=r.packageFilter(q,v)),{pkg:q,dir:v}}}function A(v){var X=Ot.join(zc(a,v,r),"/package.json");if(o(X)){try{var q=c(s,X)}catch{}if(q&&r.packageFilter&&(q=r.packageFilter(q,v)),q&&q.main){if(typeof q.main!="string"){var Ue=new fh("package \u201C"+q.name+"\u201D `main` must be a string");throw Ue.code="INVALID_PACKAGE_MAIN",Ue}(q.main==="."||q.main==="./")&&(q.main="index");try{var w=O(Ot.resolve(v,q.main));if(w)return w;var Q=A(Ot.resolve(v,q.main));if(Q)return Q}catch{}}}return O(Ot.join(v,"/index"))}function M(v,X){for(var q=function(){return Zde(v,X,r)},Ue=u?u(v,X,q,r):q(),w=0;w<Ue.length;w++){var Q=Ue[w];if(i(Ot.dirname(Q))){var Re=O(Q);if(Re)return Re;var ne=A(Q);if(ne)return ne}}}}});var Th=f((fHe,Jw)=>{var Hd=kw();Hd.core=qw();Hd.isCore=Ww();Hd.sync=zw();Jw.exports=Hd});var Qw=f((SHe,e_e)=>{e_e.exports={name:"require-in-the-middle",version:"7.5.2",description:"Module to hook into the Node.js require function",main:"index.js",types:"types/index.d.ts",dependencies:{debug:"^4.3.5","module-details-from-path":"^1.0.3",resolve:"^1.22.8"},devDependencies:{"@babel/core":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@babel/register":"^7.9.0","ipp-printer":"^1.0.0",patterns:"^1.0.3",roundround:"^0.2.0",semver:"^6.3.0",standard:"^14.3.1",tape:"^4.11.0"},scripts:{test:"npm run test:lint && npm run test:tape && npm run test:babel","test:lint":"standard","test:tape":"tape test/*.js","test:babel":"node test/babel/babel-register.js"},repository:{type:"git",url:"git+https://github.com/nodejs/require-in-the-middle.git"},keywords:["require","hook","shim","shimmer","shimming","patch","monkey","monkeypatch","module","load"],files:["types"],author:"Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",license:"MIT",bugs:{url:"https://github.com/nodejs/require-in-the-middle/issues"},homepage:"https://github.com/nodejs/require-in-the-middle#readme",engines:{node:">=8.6.0"}}});var Ah=f((THe,gh)=>{"use strict";var wi=require("path"),Hn=require("module"),Ge=Sw()("require-in-the-middle"),t_e=sh();gh.exports=Jc;gh.exports.Hook=Jc;var mh,Ui;if(Hn.isBuiltin)Ui=Hn.isBuiltin;else if(Hn.builtinModules)Ui=t=>t.startsWith("node:")?!0:(mh===void 0&&(mh=new Set(Hn.builtinModules)),mh.has(t));else{let t=Th(),[e,n]=process.versions.node.split(".").map(Number);e===8&&n<8?Ui=r=>r==="http2"?!0:!!t.core[r]:Ui=r=>!!t.core[r]}var kd;function n_e(t,e){if(!kd)if(require.resolve&&require.resolve.paths)kd=function(n,r){return require.resolve(n,{paths:[r]})};else{let n=Th();kd=function(r,o){return n.sync(r,{basedir:o})}}return kd(t,e)}var r_e=/([/\\]index)?(\.js)?$/,hh=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=require.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=require.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in require.cache?require.cache[e][this._kRitmExports]=n:(Ge('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function Jc(t,e,n){if(!(this instanceof Jc))return new Jc(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof Hn._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof Hn._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at %s",process.version,Qw().bugs.url);return}this._cache=new hh,this._unhooked=!1,this._origRequire=Hn.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);Ge("registering require hook"),this._require=Hn.prototype.require=function(c){return r._unhooked===!0?(Ge("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?(Ge("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,u){let l=c[0],p=Ui(l),d;if(p){if(d=l,l.startsWith("node:")){let R=l.slice(5);Ui(R)&&(d=R)}}else{if(u)return Ge("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{d=Hn._resolveFilename(l,this)}catch(R){return Ge('Module._resolveFilename("%s") threw %j, calling original Module.require',l,R.message),r._origRequire.apply(this,c)}}let _,E;if(Ge("processing %s module require('%s'): %s",p===!0?"core":"non-core",l,d),r._cache.has(d,p)===!0)return Ge("returning already patched cached module: %s",d),r._cache.get(d,p);let S=o.has(d);S===!1&&o.add(d);let T=u?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(S===!0)return Ge("module is in the process of being patched already - ignoring: %s",d),T;if(o.delete(d),p===!0){if(i===!0&&t.includes(d)===!1)return Ge("ignoring core module not on whitelist: %s",d),T;_=d}else if(i===!0&&t.includes(d)){let R=wi.parse(d);_=R.name,E=R.dir}else{let R=t_e(d);if(R===void 0)return Ge("could not parse filename: %s",d),T;_=R.name,E=R.basedir;let O=o_e(R);Ge("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",_,l,O,E);let N=!1;if(i){if(!l.startsWith(".")&&t.includes(l)&&(_=l,N=!0),!t.includes(_)&&!t.includes(O))return T;t.includes(O)&&O!==_&&(_=O,N=!0)}if(!N){let A;try{A=n_e(_,E)}catch{return Ge("could not resolve module: %s",_),r._cache.set(d,T,p),T}if(A!==d)if(s===!0)_=_+wi.sep+wi.relative(E,d),Ge("preparing to process require of internal file: %s",_);else return Ge("ignoring require of non-main module file: %s",A),r._cache.set(d,T,p),T}}r._cache.set(d,T,p),Ge("calling require hook: %s",_);let h=n(T,_,E);return r._cache.set(d,h,p),Ge("returning module: %s",_),h}}Jc.prototype.unhook=function(){this._unhooked=!0,this._require===Hn.prototype.require?(Hn.prototype.require=this._origRequire,Ge("require unhook successful")):Ge("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,Ge("process.getBuiltinModule unhook successful")):Ge("process.getBuiltinModule unhook unsuccessful"))};function o_e(t){let e=wi.sep!=="/"?t.path.split(wi.sep).join("/"):t.path;return wi.posix.join(t.name,e).replace(r_e,"")}});var Zw=f(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.ModuleNameTrie=Ro.ModuleNameSeparator=void 0;Ro.ModuleNameSeparator="/";var Fd=class{constructor(){this.hooks=[],this.children=new Map}},Rh=class{constructor(){this._trie=new Fd,this._counter=0}insert(e){let n=this._trie;for(let r of e.moduleName.split(Ro.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Fd,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(Ro.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))}};Ro.ModuleNameTrie=Rh});var t1=f(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.RequireInTheMiddleSingleton=void 0;var s_e=Ah(),e1=require("path"),Oh=Zw(),i_e=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Nh=class t{constructor(){this._moduleNameTrie=new Oh.ModuleNameTrie,this._initialize()}_initialize(){new s_e.Hook(null,{internals:!0},(e,n,r)=>{let o=a_e(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(){var e;return i_e?new t:this._instance=(e=this._instance)!==null&&e!==void 0?e:new t}};jd.RequireInTheMiddleSingleton=Nh;function a_e(t){return e1.sep!==Oh.ModuleNameSeparator?t.split(e1.sep).join(Oh.ModuleNameSeparator):t}});var a1=f(vs=>{var n1=[],Ih=new WeakMap,r1=new WeakMap,o1=new Map,s1=[],c_e={set(t,e,n){return Ih.get(t)[e](n)},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=r1.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.");return Ih.get(t)[e](n.value)}};function u_e(t,e,n,r,o){o1.set(t,o),Ih.set(e,n),r1.set(e,r);let s=new Proxy(e,c_e);n1.forEach(i=>i(t,s)),s1.push([t,s])}var i1=!1;function l_e(){return i1}function p_e(t){i1=t}vs.register=u_e;vs.importHooks=n1;vs.specifiers=o1;vs.toHook=s1;vs.getExperimentalPatchInternals=l_e;vs.setExperimentalPatchInternals=p_e});var $d=f((AHe,Vi)=>{var c1=require("path"),d_e=sh(),{fileURLToPath:u1}=require("url"),{MessageChannel:__e}=require("worker_threads"),{importHooks:Ch,specifiers:E_e,toHook:f_e,getExperimentalPatchInternals:S_e}=a1();function p1(t){Ch.push(t),f_e.forEach(([e,n])=>t(e,n))}function d1(t){let e=Ch.indexOf(t);e>-1&&Ch.splice(e,1)}function l1(t,e,n,r){let o=t(e,n,r);o&&o!==e&&(e.default=o)}var Ph;function T_e(){let{port1:t,port2:e}=new __e,n=0,r;Ph=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(u=>{r=u}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Qc(t,e,n){if(!(this instanceof Qc))return new Qc(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;Ph&&Array.isArray(t)&&Ph(t),this._iitmHook=(o,s)=>{let i=o,a=o.startsWith("node:"),c;if(a)o=o.replace(/^node:/,"");else{if(o.startsWith("file://"))try{o=u1(o)}catch{}let u=d_e(o);u&&(o=u.name,c=u.basedir)}if(t){for(let u of t)if(u===o){if(c){if(r)o=o+c1.sep+c1.relative(c,u1(i));else if(!S_e()&&!c.endsWith(E_e.get(i)))continue}l1(n,s,o,c)}}else l1(n,s,o,c)},p1(this._iitmHook)}Qc.prototype.unhook=function(){d1(this._iitmHook)};Vi.exports=Qc;Vi.exports.Hook=Qc;Vi.exports.addHook=p1;Vi.exports.removeHook=d1;Vi.exports.createAddHookMessageChannel=T_e});var Mh=f(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isWrapped=Oo.safeExecuteInTheMiddleAsync=Oo.safeExecuteInTheMiddle=void 0;function m_e(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Oo.safeExecuteInTheMiddle=m_e;async function h_e(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}}Oo.safeExecuteInTheMiddleAsync=h_e;function g_e(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Oo.isWrapped=g_e});var f1=f(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.InstrumentationBase=void 0;var Zc=require("path"),_1=require("util"),A_e=jm(),yh=Jm(),R_e=ow(),O_e=t1(),N_e=$d(),eu=(y(),I(x)),I_e=Ah(),C_e=require("fs"),P_e=Mh(),vh=class extends R_e.InstrumentationAbstract{constructor(e,n,r){super(e,n,r),this._hooks=[],this._requireInTheMiddleSingleton=O_e.RequireInTheMiddleSingleton.getInstance(),this._enabled=!1,this._wrap=(s,i,a)=>{if((0,P_e.isWrapped)(s[i])&&this._unwrap(s,i),_1.types.isProxy(s)){let c=(0,yh.wrap)(Object.assign({},s),i,a);return Object.defineProperty(s,i,{value:c}),c}else return(0,yh.wrap)(s,i,a)},this._unwrap=(s,i)=>_1.types.isProxy(s)?Object.defineProperty(s,i,{value:s[i]}):(0,yh.unwrap)(s,i),this._massWrap=(s,i,a)=>{if(s)Array.isArray(s)||(s=[s]);else{eu.diag.error("must provide one or more modules to patch");return}if(!(i&&Array.isArray(i))){eu.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(c=>{i.forEach(u=>{this._wrap(c,u,a)})})},this._massUnwrap=(s,i)=>{if(s)Array.isArray(s)||(s=[s]);else{eu.diag.error("must provide one or more modules to patch");return}if(!(i&&Array.isArray(i))){eu.diag.error("must provide one or more functions to wrap on modules");return}s.forEach(a=>{i.forEach(c=>{this._unwrap(a,c)})})};let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=require.resolve(n);require.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,C_e.readFileSync)(Zc.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{eu.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){var s;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 i=this._extractPackageVersion(o);if(e.moduleVersion=i,e.name===r)return E1(e.supportedVersions,i,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 a=(s=e.files)!==null&&s!==void 0?s:[],c=Zc.normalize(r);return a.filter(l=>l.name===c).filter(l=>E1(l.supportedVersions,i,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&&Zc.isAbsolute(a)){let u=Zc.parse(a);a=u.name,c=u.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Zc.isAbsolute(e.name)?new I_e.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new N_e.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}};Yd.InstrumentationBase=vh;function E1(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,A_e.satisfies)(e,r,{includePrerelease:n}))}});var S1=f(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.normalize=void 0;var M_e=require("path");Object.defineProperty(qd,"normalize",{enumerable:!0,get:function(){return M_e.normalize}})});var T1=f(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.normalize=Bi.InstrumentationBase=void 0;var y_e=f1();Object.defineProperty(Bi,"InstrumentationBase",{enumerable:!0,get:function(){return y_e.InstrumentationBase}});var v_e=S1();Object.defineProperty(Bi,"normalize",{enumerable:!0,get:function(){return v_e.normalize}})});var bh=f(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.normalize=Gi.InstrumentationBase=void 0;var m1=T1();Object.defineProperty(Gi,"InstrumentationBase",{enumerable:!0,get:function(){return m1.InstrumentationBase}});Object.defineProperty(Gi,"normalize",{enumerable:!0,get:function(){return m1.normalize}})});var h1=f(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.InstrumentationNodeModuleDefinition=void 0;var Lh=class{constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};Kd.InstrumentationNodeModuleDefinition=Lh});var g1=f(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.InstrumentationNodeModuleFile=void 0;var b_e=bh(),Dh=class{constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,b_e.normalize)(e)}};Wd.InstrumentationNodeModuleFile=Dh});var te=f(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.safeExecuteInTheMiddleAsync=Nt.safeExecuteInTheMiddle=Nt.isWrapped=Nt.InstrumentationNodeModuleFile=Nt.InstrumentationNodeModuleDefinition=Nt.InstrumentationBase=Nt.registerInstrumentations=void 0;var L_e=ew();Object.defineProperty(Nt,"registerInstrumentations",{enumerable:!0,get:function(){return L_e.registerInstrumentations}});var D_e=bh();Object.defineProperty(Nt,"InstrumentationBase",{enumerable:!0,get:function(){return D_e.InstrumentationBase}});var x_e=h1();Object.defineProperty(Nt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return x_e.InstrumentationNodeModuleDefinition}});var U_e=g1();Object.defineProperty(Nt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return U_e.InstrumentationNodeModuleFile}});var xh=Mh();Object.defineProperty(Nt,"isWrapped",{enumerable:!0,get:function(){return xh.isWrapped}});Object.defineProperty(Nt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return xh.safeExecuteInTheMiddle}});Object.defineProperty(Nt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return xh.safeExecuteInTheMiddleAsync}})});var A1=f(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.AttributeNames=void 0;var w_e;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(w_e=tu.AttributeNames||(tu.AttributeNames={}))});var O1=f((bHe,R1)=>{"use strict";var V_e=require("util");function Uh(t,e){Error.captureStackTrace(this,Uh),this.name=this.constructor.name,this.message=t,this.input=e}V_e.inherits(Uh,Error);R1.exports=Uh});var I1=f((LHe,N1)=>{"use strict";function B_e(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 G_e(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 H_e(t){return t>=32&&t<=126}function k_e(t){return t>=128&&t<=255}N1.exports={isDelimiter:B_e,isTokenChar:G_e,isExtended:k_e,isPrint:H_e}});var v1=f((DHe,y1)=>{"use strict";var F_e=require("util"),Hi=O1(),Xd=I1(),j_e=Xd.isDelimiter,C1=Xd.isTokenChar,P1=Xd.isExtended,$_e=Xd.isPrint;function M1(t){return t.replace(/\\(.)/g,"$1")}function nu(t,e){return F_e.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function Y_e(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,u,l=0;l<t.length;l++)if(u=t.charCodeAt(l),c===void 0){if(l!==0&&i===-1&&(u===32||u===9))continue;if(C1(u))i===-1&&(i=l);else if(u===61&&i!==-1)c=t.slice(i,l).toLowerCase(),i=-1;else throw new Hi(nu(t,l),t)}else if(n&&(u===9||$_e(u)||P1(u)))n=!1;else if(C1(u)){if(a!==-1)throw new Hi(nu(t,l),t);i===-1&&(i=l)}else if(j_e(u)||P1(u))if(r)u===34?(r=!1,a=l):u===92?(i===-1&&(i=l),n=e=!0):i===-1&&(i=l);else if(u===34&&t.charCodeAt(l-1)===61)r=!0;else if((u===44||u===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=l),o[c]=e?M1(t.slice(i,a)):t.slice(i,a)):o[c]="",u===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new Hi(nu(t,l),t);else if(u===32||u===9){if(a!==-1)continue;if(r)i===-1&&(i=l);else if(i!==-1)a=l;else throw new Hi(nu(t,l),t)}else throw new Hi(nu(t,l),t);if(c===void 0||r||i===-1&&a===-1||u===32||u===9)throw new Hi("Unexpected end of input",t);return i!==-1?(a===-1&&(a=l),o[c]=e?M1(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}y1.exports=Y_e});var w1=f(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.headerCapture=B.getIncomingStableRequestMetricAttributesOnResponse=B.getIncomingRequestMetricAttributesOnResponse=B.getIncomingRequestAttributesOnResponse=B.getIncomingRequestMetricAttributes=B.getIncomingRequestAttributes=B.getRemoteClientAddress=B.getOutgoingRequestMetricAttributesOnResponse=B.getOutgoingRequestAttributesOnResponse=B.setAttributesFromHttpKind=B.getOutgoingRequestMetricAttributes=B.getOutgoingRequestAttributes=B.extractHostnameAndPort=B.isValidOptionsType=B.getRequestInfo=B.isCompressed=B.setResponseContentLengthAttribute=B.setRequestContentLengthAttribute=B.setSpanWithError=B.satisfiesPattern=B.parseResponseStatus=B.getAbsoluteUrl=void 0;var ru=(y(),I(x)),P=(hn(),I(mn)),b1=oe(),q_e=require("url"),zd=A1(),K_e=v1(),W_e=(t,e,n="http:")=>{let r=t||{},o=r.protocol||n,s=(r.port||"").toString(),i=r.path||"/",a=r.host||r.hostname||e.host||"localhost";return a.indexOf(":")===-1&&s&&s!=="80"&&s!=="443"&&(a+=`:${s}`),`${o}//${a}${i}`};B.getAbsoluteUrl=W_e;var X_e=(t,e)=>{let n=t===ru.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?ru.SpanStatusCode.UNSET:ru.SpanStatusCode.ERROR};B.parseResponseStatus=X_e;var z_e=(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")};B.satisfiesPattern=z_e;var J_e=(t,e,n)=>{let r=e.message;(n&2)===2&&(t.setAttribute(zd.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(zd.AttributeNames.HTTP_ERROR_MESSAGE,r)),(n&1)===1&&t.setAttribute(P.ATTR_ERROR_TYPE,e.name),t.setStatus({code:ru.SpanStatusCode.ERROR,message:r}),t.recordException(e)};B.setSpanWithError=J_e;var Q_e=(t,e)=>{let n=L1(t.headers);n!==null&&((0,B.isCompressed)(t.headers)?e[P.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH]=n:e[P.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};B.setRequestContentLengthAttribute=Q_e;var Z_e=(t,e)=>{let n=L1(t.headers);n!==null&&((0,B.isCompressed)(t.headers)?e[P.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[P.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};B.setResponseContentLengthAttribute=Z_e;function L1(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var eEe=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};B.isCompressed=eEe;function tEe(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:u,origin:l,host:p}=new URL(t),d={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:u,origin:l,host:p};return r!==""&&(d.port=Number(r)),(o||s)&&(d.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),d}var nEe=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=tEe(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 q_e.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}};B.getRequestInfo=nEe;var rEe=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};B.isValidOptionsType=rEe;var oEe=t=>{var e;if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let n=((e=t.host)===null||e===void 0?void 0:e.match(/^([^:/ ]+)(:\d{1,5})?/))||null,r=t.hostname||(n===null?"localhost":n[1]),o=t.port;return o||(n&&n[2]?o=n[2].substring(1):o=t.protocol==="https:"?"443":"80"),{hostname:r,port:o}};B.extractHostnameAndPort=oEe;var sEe=(t,e,n)=>{var r,o;let s=e.hostname,i=e.port,a=(r=t.method)!==null&&r!==void 0?r:"GET",c=x1(a),u=t.headers||{},l=u["user-agent"],p=(0,B.getAbsoluteUrl)(t,u,`${e.component}:`),d={[P.SEMATTRS_HTTP_URL]:p,[P.SEMATTRS_HTTP_METHOD]:a,[P.SEMATTRS_HTTP_TARGET]:t.path||"/",[P.SEMATTRS_NET_PEER_NAME]:s,[P.SEMATTRS_HTTP_HOST]:(o=u.host)!==null&&o!==void 0?o:`${s}:${i}`},_={[P.ATTR_HTTP_REQUEST_METHOD]:c,[P.ATTR_SERVER_ADDRESS]:s,[P.ATTR_SERVER_PORT]:Number(i),[P.ATTR_URL_FULL]:p};switch(a!==c&&(_[P.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=a),l!==void 0&&(d[P.SEMATTRS_HTTP_USER_AGENT]=l),n){case 1:return Object.assign(_,e.hookAttributes);case 2:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};B.getOutgoingRequestAttributes=sEe;var iEe=t=>{let e={};return e[P.SEMATTRS_HTTP_METHOD]=t[P.SEMATTRS_HTTP_METHOD],e[P.SEMATTRS_NET_PEER_NAME]=t[P.SEMATTRS_NET_PEER_NAME],e};B.getOutgoingRequestMetricAttributes=iEe;var aEe=(t,e)=>{t&&(e[P.SEMATTRS_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[P.SEMATTRS_NET_TRANSPORT]=P.NETTRANSPORTVALUES_IP_TCP:e[P.SEMATTRS_NET_TRANSPORT]=P.NETTRANSPORTVALUES_IP_UDP)};B.setAttributesFromHttpKind=aEe;var cEe=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[P.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:u}=s;i[P.SEMATTRS_NET_PEER_IP]=c,i[P.SEMATTRS_NET_PEER_PORT]=u,a[P.ATTR_NETWORK_PEER_ADDRESS]=c,a[P.ATTR_NETWORK_PEER_PORT]=u,a[P.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,B.setResponseContentLengthAttribute)(t,i),n&&(i[P.SEMATTRS_HTTP_STATUS_CODE]=n,i[zd.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,B.setAttributesFromHttpKind)(o,i),e){case 1:return a;case 2:return i}return Object.assign(i,a)};B.getOutgoingRequestAttributesOnResponse=cEe;var uEe=t=>{let e={};return e[P.SEMATTRS_NET_PEER_PORT]=t[P.SEMATTRS_NET_PEER_PORT],e[P.SEMATTRS_HTTP_STATUS_CODE]=t[P.SEMATTRS_HTTP_STATUS_CODE],e[P.SEMATTRS_HTTP_FLAVOR]=t[P.SEMATTRS_HTTP_FLAVOR],e};B.getOutgoingRequestMetricAttributesOnResponse=uEe;function No(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 lEe(t,e){let n=t.headers.forwarded;if(n){for(let s of U1(n))if(s.host)return No(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?No(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?No(r,t.headers["x-forwarded-proto"][0]):No(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?No(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?No(r[0],t.headers["x-forwarded-proto"][0]):No(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?No(o,e):null}function D1(t){let e=t.headers.forwarded;if(e){for(let o of U1(e))if(o.for)return o.for}let n=t.headers["x-forwarded-for"];if(typeof n=="string")return n;if(Array.isArray(n))return n[0];let r=t.socket.remoteAddress;return r||null}B.getRemoteClientAddress=D1;function pEe(t,e,n){var r,o;try{if(e.headers.host)return new URL((r=e.url)!==null&&r!==void 0?r:"/",`${t}://${e.headers.host}`);{let s=new URL((o=e.url)!==null&&o!==void 0?o:"/",`${t}://localhost`);return{pathname:s.pathname,search:s.search,toString:function(){return s.pathname+s.search}}}}catch(s){return n.verbose("Unable to get URL from request",s),{}}}var dEe=(t,e,n)=>{let r=t.headers,o=r["user-agent"],s=r["x-forwarded-for"],i=t.httpVersion,a=r.host,c=a?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",u=t.method,l=x1(u),p=lEe(t,e.component),d=e.serverName,_=D1(t),E={[P.ATTR_HTTP_REQUEST_METHOD]:l,[P.ATTR_URL_SCHEME]:e.component,[P.ATTR_SERVER_ADDRESS]:p?.host,[P.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[P.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[P.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[P.ATTR_USER_AGENT_ORIGINAL]:o},S=pEe(e.component,t,n);S?.pathname!=null&&(E[P.ATTR_URL_PATH]=S.pathname),_!=null&&(E[P.ATTR_CLIENT_ADDRESS]=_),p?.port!=null&&(E[P.ATTR_SERVER_PORT]=Number(p.port)),u!==l&&(E[P.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=u);let T={[P.SEMATTRS_HTTP_URL]:S.toString(),[P.SEMATTRS_HTTP_HOST]:a,[P.SEMATTRS_NET_HOST_NAME]:c,[P.SEMATTRS_HTTP_METHOD]:u,[P.SEMATTRS_HTTP_SCHEME]:e.component};switch(typeof s=="string"&&(T[P.SEMATTRS_HTTP_CLIENT_IP]=s.split(",")[0]),typeof d=="string"&&(T[P.SEMATTRS_HTTP_SERVER_NAME]=d),S?.pathname&&(T[P.SEMATTRS_HTTP_TARGET]=S?.pathname+S?.search||"/"),o!==void 0&&(T[P.SEMATTRS_HTTP_USER_AGENT]=o),(0,B.setRequestContentLengthAttribute)(t,T),(0,B.setAttributesFromHttpKind)(i,T),e.semconvStability){case 1:return Object.assign(E,e.hookAttributes);case 2:return Object.assign(T,e.hookAttributes)}return Object.assign(T,E,e.hookAttributes)};B.getIncomingRequestAttributes=dEe;var _Ee=t=>{let e={};return e[P.SEMATTRS_HTTP_SCHEME]=t[P.SEMATTRS_HTTP_SCHEME],e[P.SEMATTRS_HTTP_METHOD]=t[P.SEMATTRS_HTTP_METHOD],e[P.SEMATTRS_NET_HOST_NAME]=t[P.SEMATTRS_NET_HOST_NAME],e[P.SEMATTRS_HTTP_FLAVOR]=t[P.SEMATTRS_HTTP_FLAVOR],e};B.getIncomingRequestMetricAttributes=_Ee;var EEe=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[P.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,b1.getRPCMetadata)(ru.context.active()),c={};if(r){let{localAddress:u,localPort:l,remoteAddress:p,remotePort:d}=r;c[P.SEMATTRS_NET_HOST_IP]=u,c[P.SEMATTRS_NET_HOST_PORT]=l,c[P.SEMATTRS_NET_PEER_IP]=p,c[P.SEMATTRS_NET_PEER_PORT]=d}switch(c[P.SEMATTRS_HTTP_STATUS_CODE]=o,c[zd.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===b1.RPCType.HTTP&&a.route!==void 0&&(c[P.SEMATTRS_HTTP_ROUTE]=a.route,i[P.ATTR_HTTP_ROUTE]=a.route),n){case 1:return i;case 2:return c}return Object.assign(c,i)};B.getIncomingRequestAttributesOnResponse=EEe;var fEe=t=>{let e={};return e[P.SEMATTRS_HTTP_STATUS_CODE]=t[P.SEMATTRS_HTTP_STATUS_CODE],e[P.SEMATTRS_NET_HOST_PORT]=t[P.SEMATTRS_NET_HOST_PORT],t[P.SEMATTRS_HTTP_ROUTE]!==void 0&&(e[P.SEMATTRS_HTTP_ROUTE]=t[P.SEMATTRS_HTTP_ROUTE]),e};B.getIncomingRequestMetricAttributesOnResponse=fEe;var SEe=t=>{let e={};return t[P.ATTR_HTTP_ROUTE]!==void 0&&(e[P.ATTR_HTTP_ROUTE]=t[P.SEMATTRS_HTTP_ROUTE]),t[P.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[P.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[P.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};B.getIncomingStableRequestMetricAttributesOnResponse=SEe;function TEe(t,e){let n=new Map;for(let r=0,o=e.length;r<o;r++){let s=e[r].toLowerCase();n.set(s,s.replace(/-/g,"_"))}return(r,o)=>{for(let s of n.keys()){let i=o(s);if(i===void 0)continue;let a=n.get(s),c=`http.${t}.header.${a}`;typeof i=="string"?r.setAttribute(c,[i]):Array.isArray(i)?r.setAttribute(c,i):r.setAttribute(c,[i])}}}B.headerCapture=TEe;var mEe=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]);function x1(t){if(t==null)return"GET";let e=t.toUpperCase();return mEe.has(e)?e:"_OTHER"}function U1(t){try{return K_e(t)}catch{return[]}}});var B1=f(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.HttpInstrumentation=void 0;var F=(y(),I(x)),ki=oe(),V1=jm(),hEe=require("url"),gEe=k0(),In=te(),wh=oe(),Vh=require("events"),ve=(hn(),I(mn)),Ie=w1(),Bh=class extends In.InstrumentationBase{constructor(e={}){super("@opentelemetry/instrumentation-http",gEe.VERSION,e),this._spanNotEnded=new WeakSet,this._semconvStability=2,this._headerCapture=this._createHeaderCapture();for(let n of(0,wh.getEnv)().OTEL_SEMCONV_STABILITY_OPT_IN)if(n.toLowerCase()==="http/dup"){this._semconvStability=3;break}else n.toLowerCase()==="http"&&(this._semconvStability=1)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:F.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:F.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(ve.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:F.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(ve.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:F.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&2)===2&&this._oldHttpServerDurationHistogram.record(e,n),(this._semconvStability&1)===1&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){(this._semconvStability&2)===2&&this._oldHttpClientDurationHistogram.record(e,n),(this._semconvStability&1)===1&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture()}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new In.InstrumentationNodeModuleDefinition("http",["*"],e=>{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=>{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 In.InstrumentationNodeModuleDefinition("https",["*"],e=>{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=>{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){var a;return e==="https"&&typeof s=="object"&&((a=s?.constructor)===null||a===void 0?void 0:a.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,Ie.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ie.getOutgoingRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),this._headerCapture.client.captureRequestHeaders(n,l=>e.getHeader(l)),this._headerCapture.client.captureResponseHeaders(n,l=>a.headers[l]),F.context.bind(F.context.active(),a);let u=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let l;a.aborted&&!a.complete?l={code:F.SpanStatusCode.ERROR}:l={code:(0,Ie.parseResponseStatus)(F.SpanKind.CLIENT,a.statusCode)},n.setStatus(l),this.getConfig().applyCustomAttributesOnSpan&&(0,In.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,F.SpanKind.CLIENT,r,o,s)};a.on("end",u),V1.lt(process.version,"16.0.0")&&a.on("close",u),a.on(Vh.errorMonitor,l=>{this._diag.debug("outgoingRequest on error()",l),!i&&(i=!0,(0,Ie.setSpanWithError)(n,l,this._semconvStability),n.setStatus({code:F.SpanStatusCode.ERROR,message:l.message}),this._closeHttpSpan(n,F.SpanKind.CLIENT,r,o,s))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,F.SpanKind.CLIENT,r,o,s))}),e.on(Vh.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,(0,Ie.setSpanWithError)(n,a,this._semconvStability),this._closeHttpSpan(n,F.SpanKind.CLIENT,r,o,s))}),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],u=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,In.safeExecuteInTheMiddle)(()=>{var O,N;return(N=(O=r.getConfig()).ignoreIncomingRequestHook)===null||N===void 0?void 0:N.call(O,a)},O=>{O!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",O)},!0))return F.context.with((0,ki.suppressTracing)(F.context.active()),()=>(F.context.bind(F.context.active(),a),F.context.bind(F.context.active(),c),n.apply(this,[s,...i])));let l=a.headers,p=(0,Ie.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability},r._diag),d={kind:F.SpanKind.SERVER,attributes:p},_=(0,ki.hrTime)(),E=(0,Ie.getIncomingRequestMetricAttributes)(p),S={[ve.ATTR_HTTP_REQUEST_METHOD]:p[ve.ATTR_HTTP_REQUEST_METHOD],[ve.ATTR_URL_SCHEME]:p[ve.ATTR_URL_SCHEME]};p[ve.ATTR_NETWORK_PROTOCOL_VERSION]&&(S[ve.ATTR_NETWORK_PROTOCOL_VERSION]=p[ve.ATTR_NETWORK_PROTOCOL_VERSION]);let T=F.propagation.extract(F.ROOT_CONTEXT,l),h=r._startHttpSpan(u,d,T),R={type:wh.RPCType.HTTP,span:h};return F.context.with((0,wh.setRPCMetadata)(F.trace.setSpan(T,h),R),()=>{F.context.bind(F.context.active(),a),F.context.bind(F.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(h,a),r.getConfig().responseHook&&r._callResponseHook(h,c),r._headerCapture.server.captureRequestHeaders(h,N=>a.headers[N]);let O=!1;return c.on("close",()=>{O||r._onServerResponseFinish(a,c,h,E,S,_)}),c.on(Vh.errorMonitor,N=>{O=!0,r._onServerResponseError(h,E,S,_,N)}),(0,In.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),N=>{if(N)throw(0,Ie.setSpanWithError)(h,N,r._semconvStability),r._closeHttpSpan(h,F.SpanKind.SERVER,_,E,S),N})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ie.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof hEe.URL)?i.shift():void 0,{method:c,invalidUrl:u,optionsParsed:l}=(0,Ie.getRequestInfo)(r._diag,s,a);if(e==="http"&&V1.lt(process.version,"9.0.0")&&l.protocol==="https:")return n.apply(this,[l,...i]);if((0,In.safeExecuteInTheMiddle)(()=>{var A,M;return(M=(A=r.getConfig()).ignoreOutgoingRequestHook)===null||M===void 0?void 0:M.call(A,l)},A=>{A!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",A)},!0))return n.apply(this,[l,...i]);let{hostname:p,port:d}=(0,Ie.extractHostnameAndPort)(l),_=(0,Ie.getOutgoingRequestAttributes)(l,{component:e,port:d,hostname:p,hookAttributes:r._callStartSpanHook(l,r.getConfig().startOutgoingSpanHook)},r._semconvStability),E=(0,ki.hrTime)(),S=(0,Ie.getOutgoingRequestMetricAttributes)(_),T={[ve.ATTR_HTTP_REQUEST_METHOD]:_[ve.ATTR_HTTP_REQUEST_METHOD],[ve.ATTR_SERVER_ADDRESS]:_[ve.ATTR_SERVER_ADDRESS],[ve.ATTR_SERVER_PORT]:_[ve.ATTR_SERVER_PORT]};_[ve.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[ve.ATTR_HTTP_RESPONSE_STATUS_CODE]=_[ve.ATTR_HTTP_RESPONSE_STATUS_CODE]),_[ve.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[ve.ATTR_NETWORK_PROTOCOL_VERSION]=_[ve.ATTR_NETWORK_PROTOCOL_VERSION]);let h={kind:F.SpanKind.CLIENT,attributes:_},R=r._startHttpSpan(c,h),O=F.context.active(),N=F.trace.setSpan(O,R);return l.headers?l.headers=Object.assign({},l.headers):l.headers={},F.propagation.inject(N,l.headers),F.context.with(N,()=>{let A=i[i.length-1];typeof A=="function"&&(i[i.length-1]=F.context.bind(O,A));let M=(0,In.safeExecuteInTheMiddle)(()=>u?n.apply(this,[s,...i]):n.apply(this,[l,...i]),v=>{if(v)throw(0,Ie.setSpanWithError)(R,v,r._semconvStability),r._closeHttpSpan(R,F.SpanKind.CLIENT,E,S,T),v});return r._diag.debug(`${e} instrumentation outgoingRequest`),F.context.bind(O,M),r._traceClientRequest(M,R,E,S,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ie.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ie.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ie.getIncomingStableRequestMetricAttributesOnResponse)(a)),this._headerCapture.server.captureResponseHeaders(r,u=>n.getHeader(u)),r.setAttributes(a).setStatus({code:(0,Ie.parseResponseStatus)(F.SpanKind.SERVER,n.statusCode)});let c=a[ve.SEMATTRS_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,In.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,F.SpanKind.SERVER,i,o,s)}_onServerResponseError(e,n,r,o,s){(0,Ie.setSpanWithError)(e,s,this._semconvStability),this._closeHttpSpan(e,F.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=F.context.active()){let o=n.kind===F.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=F.trace.getSpan(r);return o===!0&&i===void 0?s=F.trace.wrapSpanContext(F.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,ki.hrTimeToMilliseconds)((0,ki.hrTimeDuration)(r,(0,ki.hrTime)()));n===F.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===F.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,In.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,In.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,In.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(){var e,n,r,o,s,i,a,c,u,l,p,d;let _=this.getConfig();return{client:{captureRequestHeaders:(0,Ie.headerCapture)("request",(r=(n=(e=_.headersToSpanAttributes)===null||e===void 0?void 0:e.client)===null||n===void 0?void 0:n.requestHeaders)!==null&&r!==void 0?r:[]),captureResponseHeaders:(0,Ie.headerCapture)("response",(i=(s=(o=_.headersToSpanAttributes)===null||o===void 0?void 0:o.client)===null||s===void 0?void 0:s.responseHeaders)!==null&&i!==void 0?i:[])},server:{captureRequestHeaders:(0,Ie.headerCapture)("request",(u=(c=(a=_.headersToSpanAttributes)===null||a===void 0?void 0:a.server)===null||c===void 0?void 0:c.requestHeaders)!==null&&u!==void 0?u:[]),captureResponseHeaders:(0,Ie.headerCapture)("response",(d=(p=(l=_.headersToSpanAttributes)===null||l===void 0?void 0:l.server)===null||p===void 0?void 0:p.responseHeaders)!==null&&d!==void 0?d:[])}}}};Jd.HttpInstrumentation=Bh});var G1=f(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.HttpInstrumentation=void 0;var AEe=B1();Object.defineProperty(Qd,"HttpInstrumentation",{enumerable:!0,get:function(){return AEe.HttpInstrumentation}})});function Fe(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 Kg=U(()=>{});var lG,pG,dG,_G,EG,fG,SG,TG,mG,hG,gG,AG,RG,OG,NG,IG,CG,PG,MG,yG,vG,bG,LG,DG,xG,UG,wG,VG,BG,GG,HG,kG,FG,jG,$G,YG,qG,KG,WG,XG,zG,JG,QG,ZG,eH,tH,nH,rH,oH,sH,iH,aH,cH,uH,lH,pH,dH,_H,EH,fH,SH,TH,mH,hH,gH,AH,RH,OH,NH,IH,CH,PH,MH,yH,vH,bH,LH,DH,xH,UH,wH,VH,BH,GH,HH,kH,FH,jH,$H,YH,qH,KH,WH,XH,zH,JH,QH,ZH,ek,tk,nk,rk,ok,sk,ik,ak,ck,uk,lk,pk,dk,_k,Ek,fk,Sk,Tk,mk,hk,gk,Ak,Rk,Ok,Nk,Ik,Ck,Pk,Mk,yk,rTe,Wg,oTe,sTe,iTe,aTe,Xg,cTe,uTe,lTe,pTe,dTe,_Te,ETe,fTe,STe,TTe,mTe,hTe,gTe,ATe,RTe,OTe,NTe,ITe,zg,CTe,PTe,MTe,yTe,vTe,bTe,LTe,DTe,xTe,UTe,wTe,VTe,BTe,GTe,HTe,kTe,FTe,jTe,$Te,YTe,qTe,KTe,WTe,XTe,zTe,JTe,QTe,ZTe,eme,tme,nme,rme,ome,sme,Iu,ia,Jg,ime,ame,Y_,cme,ume,lme,pme,dme,_me,Eme,Cu,fme,Sme,Tme,mme,hme,gme,Ame,Rme,Ome,Nme,Ime,Cme,Pme,Mme,yme,vme,bme,Lme,Dme,xme,Ume,wme,Vme,Qg,Bme,Gme,Hme,kme,Fme,jme,$me,Yme,qme,Kme,Wme,Xme,zme,Jme,Qme,Zme,ehe,the,nhe,Zg,rhe,eA,ohe,she,ihe,ahe,che,uhe,lhe,phe,dhe,vk,bk,Lk,Dk,xk,Uk,wk,Vk,Bk,Gk,Hk,kk,Fk,jk,$k,Yk,qk,Kk,Wk,Xk,zk,Jk,Qk,Zk,eF,tF,nF,rF,oF,sF,iF,aF,cF,uF,lF,pF,dF,_F,EF,fF,SF,TF,mF,hF,gF,AF,RF,_he,Ehe,fhe,She,The,mhe,hhe,ghe,Ahe,Rhe,Ohe,Nhe,Ihe,Che,Phe,Mhe,yhe,vhe,bhe,Lhe,Dhe,xhe,Uhe,whe,Vhe,Bhe,Ghe,Hhe,khe,Fhe,jhe,$he,Yhe,qhe,Khe,Whe,Xhe,zhe,Jhe,Qhe,Zhe,ege,tge,nge,rge,oge,sge,ige,OF,NF,IF,CF,PF,MF,yF,vF,bF,LF,DF,age,cge,uge,lge,pge,dge,_ge,Ege,fge,Sge,Tge,mge,xF,UF,wF,VF,BF,hge,gge,Age,Rge,Oge,Nge,GF,HF,kF,Ige,Cge,Pge,Mge,FF,jF,$F,YF,yge,vge,bge,Lge,Dge,qF,KF,WF,XF,zF,JF,QF,xge,Uge,wge,Vge,Bge,Gge,Hge,kge,ZF,ej,tj,nj,rj,Fge,jge,$ge,Yge,qge,Kge,oj,sj,ij,aj,cj,uj,lj,pj,dj,_j,Ej,fj,Sj,Tj,mj,hj,gj,Aj,Rj,Oj,Nj,Wge,Xge,zge,Jge,Qge,Zge,eAe,tAe,nAe,rAe,oAe,sAe,iAe,aAe,cAe,uAe,lAe,pAe,dAe,_Ae,EAe,fAe,Ij,Cj,Pj,Mj,yj,SAe,TAe,mAe,hAe,gAe,AAe,vj,bj,RAe,OAe,NAe,Lj,Dj,IAe,CAe,PAe,xj,Uj,wj,Vj,Bj,Gj,Hj,kj,Fj,jj,$j,Yj,qj,Kj,Wj,Xj,zj,MAe,yAe,vAe,bAe,LAe,DAe,xAe,UAe,wAe,VAe,BAe,GAe,HAe,kAe,FAe,jAe,$Ae,YAe,Jj,Qj,qAe,KAe,WAe,Zj=U(()=>{Kg();lG="aws.lambda.invoked_arn",pG="db.system",dG="db.connection_string",_G="db.user",EG="db.jdbc.driver_classname",fG="db.name",SG="db.statement",TG="db.operation",mG="db.mssql.instance_name",hG="db.cassandra.keyspace",gG="db.cassandra.page_size",AG="db.cassandra.consistency_level",RG="db.cassandra.table",OG="db.cassandra.idempotence",NG="db.cassandra.speculative_execution_count",IG="db.cassandra.coordinator.id",CG="db.cassandra.coordinator.dc",PG="db.hbase.namespace",MG="db.redis.database_index",yG="db.mongodb.collection",vG="db.sql.table",bG="exception.type",LG="exception.message",DG="exception.stacktrace",xG="exception.escaped",UG="faas.trigger",wG="faas.execution",VG="faas.document.collection",BG="faas.document.operation",GG="faas.document.time",HG="faas.document.name",kG="faas.time",FG="faas.cron",jG="faas.coldstart",$G="faas.invoked_name",YG="faas.invoked_provider",qG="faas.invoked_region",KG="net.transport",WG="net.peer.ip",XG="net.peer.port",zG="net.peer.name",JG="net.host.ip",QG="net.host.port",ZG="net.host.name",eH="net.host.connection.type",tH="net.host.connection.subtype",nH="net.host.carrier.name",rH="net.host.carrier.mcc",oH="net.host.carrier.mnc",sH="net.host.carrier.icc",iH="peer.service",aH="enduser.id",cH="enduser.role",uH="enduser.scope",lH="thread.id",pH="thread.name",dH="code.function",_H="code.namespace",EH="code.filepath",fH="code.lineno",SH="http.method",TH="http.url",mH="http.target",hH="http.host",gH="http.scheme",AH="http.status_code",RH="http.flavor",OH="http.user_agent",NH="http.request_content_length",IH="http.request_content_length_uncompressed",CH="http.response_content_length",PH="http.response_content_length_uncompressed",MH="http.server_name",yH="http.route",vH="http.client_ip",bH="aws.dynamodb.table_names",LH="aws.dynamodb.consumed_capacity",DH="aws.dynamodb.item_collection_metrics",xH="aws.dynamodb.provisioned_read_capacity",UH="aws.dynamodb.provisioned_write_capacity",wH="aws.dynamodb.consistent_read",VH="aws.dynamodb.projection",BH="aws.dynamodb.limit",GH="aws.dynamodb.attributes_to_get",HH="aws.dynamodb.index_name",kH="aws.dynamodb.select",FH="aws.dynamodb.global_secondary_indexes",jH="aws.dynamodb.local_secondary_indexes",$H="aws.dynamodb.exclusive_start_table",YH="aws.dynamodb.table_count",qH="aws.dynamodb.scan_forward",KH="aws.dynamodb.segment",WH="aws.dynamodb.total_segments",XH="aws.dynamodb.count",zH="aws.dynamodb.scanned_count",JH="aws.dynamodb.attribute_definitions",QH="aws.dynamodb.global_secondary_index_updates",ZH="messaging.system",ek="messaging.destination",tk="messaging.destination_kind",nk="messaging.temp_destination",rk="messaging.protocol",ok="messaging.protocol_version",sk="messaging.url",ik="messaging.message_id",ak="messaging.conversation_id",ck="messaging.message_payload_size_bytes",uk="messaging.message_payload_compressed_size_bytes",lk="messaging.operation",pk="messaging.consumer_id",dk="messaging.rabbitmq.routing_key",_k="messaging.kafka.message_key",Ek="messaging.kafka.consumer_group",fk="messaging.kafka.client_id",Sk="messaging.kafka.partition",Tk="messaging.kafka.tombstone",mk="rpc.system",hk="rpc.service",gk="rpc.method",Ak="rpc.grpc.status_code",Rk="rpc.jsonrpc.version",Ok="rpc.jsonrpc.request_id",Nk="rpc.jsonrpc.error_code",Ik="rpc.jsonrpc.error_message",Ck="message.type",Pk="message.id",Mk="message.compressed_size",yk="message.uncompressed_size",rTe=lG,Wg=pG,oTe=dG,sTe=_G,iTe=EG,aTe=fG,Xg=SG,cTe=TG,uTe=mG,lTe=hG,pTe=gG,dTe=AG,_Te=RG,ETe=OG,fTe=NG,STe=IG,TTe=CG,mTe=PG,hTe=MG,gTe=yG,ATe=vG,RTe=bG,OTe=LG,NTe=DG,ITe=xG,zg=UG,CTe=wG,PTe=VG,MTe=BG,yTe=GG,vTe=HG,bTe=kG,LTe=FG,DTe=jG,xTe=$G,UTe=YG,wTe=qG,VTe=KG,BTe=WG,GTe=XG,HTe=zG,kTe=JG,FTe=QG,jTe=ZG,$Te=eH,YTe=tH,qTe=nH,KTe=rH,WTe=oH,XTe=sH,zTe=iH,JTe=aH,QTe=cH,ZTe=uH,eme=lH,tme=pH,nme=dH,rme=_H,ome=EH,sme=fH,Iu=SH,ia=TH,Jg=mH,ime=hH,ame=gH,Y_=AH,cme=RH,ume=OH,lme=NH,pme=IH,dme=CH,_me=PH,Eme=MH,Cu=yH,fme=vH,Sme=bH,Tme=LH,mme=DH,hme=xH,gme=UH,Ame=wH,Rme=VH,Ome=BH,Nme=GH,Ime=HH,Cme=kH,Pme=FH,Mme=jH,yme=$H,vme=YH,bme=qH,Lme=KH,Dme=WH,xme=XH,Ume=zH,wme=JH,Vme=QH,Qg=ZH,Bme=ek,Gme=tk,Hme=nk,kme=rk,Fme=ok,jme=sk,$me=ik,Yme=ak,qme=ck,Kme=uk,Wme=lk,Xme=pk,zme=dk,Jme=_k,Qme=Ek,Zme=fk,ehe=Sk,the=Tk,nhe=mk,Zg=hk,rhe=gk,eA=Ak,ohe=Rk,she=Ok,ihe=Nk,ahe=Ik,che=Ck,uhe=Pk,lhe=Mk,phe=yk,dhe=Fe([lG,pG,dG,_G,EG,fG,SG,TG,mG,hG,gG,AG,RG,OG,NG,IG,CG,PG,MG,yG,vG,bG,LG,DG,xG,UG,wG,VG,BG,GG,HG,kG,FG,jG,$G,YG,qG,KG,WG,XG,zG,JG,QG,ZG,eH,tH,nH,rH,oH,sH,iH,aH,cH,uH,lH,pH,dH,_H,EH,fH,SH,TH,mH,hH,gH,AH,RH,OH,NH,IH,CH,PH,MH,yH,vH,bH,LH,DH,xH,UH,wH,VH,BH,GH,HH,kH,FH,jH,$H,YH,qH,KH,WH,XH,zH,JH,QH,ZH,ek,tk,nk,rk,ok,sk,ik,ak,ck,uk,lk,pk,dk,_k,Ek,fk,Sk,Tk,mk,hk,gk,Ak,Rk,Ok,Nk,Ik,Ck,Pk,Mk,yk]),vk="other_sql",bk="mssql",Lk="mysql",Dk="oracle",xk="db2",Uk="postgresql",wk="redshift",Vk="hive",Bk="cloudscape",Gk="hsqldb",Hk="progress",kk="maxdb",Fk="hanadb",jk="ingres",$k="firstsql",Yk="edb",qk="cache",Kk="adabas",Wk="firebird",Xk="derby",zk="filemaker",Jk="informix",Qk="instantdb",Zk="interbase",eF="mariadb",tF="netezza",nF="pervasive",rF="pointbase",oF="sqlite",sF="sybase",iF="teradata",aF="vertica",cF="h2",uF="coldfusion",lF="cassandra",pF="hbase",dF="mongodb",_F="redis",EF="couchbase",fF="couchdb",SF="cosmosdb",TF="dynamodb",mF="neo4j",hF="geode",gF="elasticsearch",AF="memcached",RF="cockroachdb",_he=vk,Ehe=bk,fhe=Lk,She=Dk,The=xk,mhe=Uk,hhe=wk,ghe=Vk,Ahe=Bk,Rhe=Gk,Ohe=Hk,Nhe=kk,Ihe=Fk,Che=jk,Phe=$k,Mhe=Yk,yhe=qk,vhe=Kk,bhe=Wk,Lhe=Xk,Dhe=zk,xhe=Jk,Uhe=Qk,whe=Zk,Vhe=eF,Bhe=tF,Ghe=nF,Hhe=rF,khe=oF,Fhe=sF,jhe=iF,$he=aF,Yhe=cF,qhe=uF,Khe=lF,Whe=pF,Xhe=dF,zhe=_F,Jhe=EF,Qhe=fF,Zhe=SF,ege=TF,tge=mF,nge=hF,rge=gF,oge=AF,sge=RF,ige=Fe([vk,bk,Lk,Dk,xk,Uk,wk,Vk,Bk,Gk,Hk,kk,Fk,jk,$k,Yk,qk,Kk,Wk,Xk,zk,Jk,Qk,Zk,eF,tF,nF,rF,oF,sF,iF,aF,cF,uF,lF,pF,dF,_F,EF,fF,SF,TF,mF,hF,gF,AF,RF]),OF="all",NF="each_quorum",IF="quorum",CF="local_quorum",PF="one",MF="two",yF="three",vF="local_one",bF="any",LF="serial",DF="local_serial",age=OF,cge=NF,uge=IF,lge=CF,pge=PF,dge=MF,_ge=yF,Ege=vF,fge=bF,Sge=LF,Tge=DF,mge=Fe([OF,NF,IF,CF,PF,MF,yF,vF,bF,LF,DF]),xF="datasource",UF="http",wF="pubsub",VF="timer",BF="other",hge=xF,gge=UF,Age=wF,Rge=VF,Oge=BF,Nge=Fe([xF,UF,wF,VF,BF]),GF="insert",HF="edit",kF="delete",Ige=GF,Cge=HF,Pge=kF,Mge=Fe([GF,HF,kF]),FF="alibaba_cloud",jF="aws",$F="azure",YF="gcp",yge=FF,vge=jF,bge=$F,Lge=YF,Dge=Fe([FF,jF,$F,YF]),qF="ip_tcp",KF="ip_udp",WF="ip",XF="unix",zF="pipe",JF="inproc",QF="other",xge=qF,Uge=KF,wge=WF,Vge=XF,Bge=zF,Gge=JF,Hge=QF,kge=Fe([qF,KF,WF,XF,zF,JF,QF]),ZF="wifi",ej="wired",tj="cell",nj="unavailable",rj="unknown",Fge=ZF,jge=ej,$ge=tj,Yge=nj,qge=rj,Kge=Fe([ZF,ej,tj,nj,rj]),oj="gprs",sj="edge",ij="umts",aj="cdma",cj="evdo_0",uj="evdo_a",lj="cdma2000_1xrtt",pj="hsdpa",dj="hsupa",_j="hspa",Ej="iden",fj="evdo_b",Sj="lte",Tj="ehrpd",mj="hspap",hj="gsm",gj="td_scdma",Aj="iwlan",Rj="nr",Oj="nrnsa",Nj="lte_ca",Wge=oj,Xge=sj,zge=ij,Jge=aj,Qge=cj,Zge=uj,eAe=lj,tAe=pj,nAe=dj,rAe=_j,oAe=Ej,sAe=fj,iAe=Sj,aAe=Tj,cAe=mj,uAe=hj,lAe=gj,pAe=Aj,dAe=Rj,_Ae=Oj,EAe=Nj,fAe=Fe([oj,sj,ij,aj,cj,uj,lj,pj,dj,_j,Ej,fj,Sj,Tj,mj,hj,gj,Aj,Rj,Oj,Nj]),Ij="1.0",Cj="1.1",Pj="2.0",Mj="SPDY",yj="QUIC",SAe=Ij,TAe=Cj,mAe=Pj,hAe=Mj,gAe=yj,AAe={HTTP_1_0:Ij,HTTP_1_1:Cj,HTTP_2_0:Pj,SPDY:Mj,QUIC:yj},vj="queue",bj="topic",RAe=vj,OAe=bj,NAe=Fe([vj,bj]),Lj="receive",Dj="process",IAe=Lj,CAe=Dj,PAe=Fe([Lj,Dj]),xj=0,Uj=1,wj=2,Vj=3,Bj=4,Gj=5,Hj=6,kj=7,Fj=8,jj=9,$j=10,Yj=11,qj=12,Kj=13,Wj=14,Xj=15,zj=16,MAe=xj,yAe=Uj,vAe=wj,bAe=Vj,LAe=Bj,DAe=Gj,xAe=Hj,UAe=kj,wAe=Fj,VAe=jj,BAe=$j,GAe=Yj,HAe=qj,kAe=Kj,FAe=Wj,jAe=Xj,$Ae=zj,YAe={OK:xj,CANCELLED:Uj,UNKNOWN:wj,INVALID_ARGUMENT:Vj,DEADLINE_EXCEEDED:Bj,NOT_FOUND:Gj,ALREADY_EXISTS:Hj,PERMISSION_DENIED:kj,RESOURCE_EXHAUSTED:Fj,FAILED_PRECONDITION:jj,ABORTED:$j,OUT_OF_RANGE:Yj,UNIMPLEMENTED:qj,INTERNAL:Kj,UNAVAILABLE:Wj,DATA_LOSS:Xj,UNAUTHENTICATED:zj},Jj="SENT",Qj="RECEIVED",qAe=Jj,KAe=Qj,WAe=Fe([Jj,Qj])});var e$=U(()=>{Zj()});var t$,n$,r$,o$,s$,i$,a$,c$,u$,l$,p$,d$,_$,E$,f$,S$,T$,m$,h$,g$,A$,R$,O$,N$,I$,C$,P$,M$,y$,v$,b$,L$,D$,x$,U$,w$,V$,B$,G$,H$,k$,F$,j$,$$,Y$,q$,K$,W$,X$,z$,J$,Q$,Z$,eY,tY,nY,rY,oY,sY,iY,aY,cY,uY,lY,pY,dY,_Y,EY,fY,SY,TY,mY,hY,gY,AY,RY,OY,NY,IY,CY,PY,XAe,zAe,JAe,QAe,ZAe,eRe,tRe,nRe,rRe,oRe,sRe,iRe,aRe,cRe,uRe,lRe,pRe,dRe,_Re,ERe,fRe,SRe,TRe,mRe,hRe,gRe,ARe,RRe,ORe,NRe,IRe,CRe,PRe,MRe,yRe,vRe,bRe,LRe,DRe,xRe,URe,wRe,VRe,BRe,GRe,HRe,kRe,FRe,jRe,$Re,YRe,qRe,KRe,WRe,XRe,zRe,JRe,QRe,ZRe,eOe,tOe,nOe,rOe,oOe,sOe,iOe,aOe,cOe,uOe,lOe,pOe,tA,dOe,_Oe,EOe,fOe,SOe,TOe,mOe,hOe,gOe,AOe,MY,yY,vY,bY,ROe,OOe,NOe,IOe,COe,LY,DY,xY,UY,wY,VY,BY,GY,HY,kY,FY,jY,$Y,YY,qY,KY,WY,POe,MOe,yOe,vOe,bOe,LOe,DOe,xOe,UOe,wOe,VOe,BOe,GOe,HOe,kOe,FOe,jOe,$Oe,XY,zY,YOe,qOe,KOe,JY,QY,ZY,eq,tq,nq,rq,WOe,XOe,zOe,JOe,QOe,ZOe,eNe,tNe,oq,sq,iq,aq,cq,uq,lq,pq,dq,_q,Eq,nNe,rNe,oNe,sNe,iNe,aNe,cNe,uNe,lNe,pNe,dNe,_Ne,fq,Sq,Tq,mq,hq,gq,Aq,Rq,Oq,Nq,ENe,fNe,SNe,TNe,mNe,hNe,gNe,ANe,RNe,ONe,NNe,Iq=U(()=>{Kg();t$="cloud.provider",n$="cloud.account.id",r$="cloud.region",o$="cloud.availability_zone",s$="cloud.platform",i$="aws.ecs.container.arn",a$="aws.ecs.cluster.arn",c$="aws.ecs.launchtype",u$="aws.ecs.task.arn",l$="aws.ecs.task.family",p$="aws.ecs.task.revision",d$="aws.eks.cluster.arn",_$="aws.log.group.names",E$="aws.log.group.arns",f$="aws.log.stream.names",S$="aws.log.stream.arns",T$="container.name",m$="container.id",h$="container.runtime",g$="container.image.name",A$="container.image.tag",R$="deployment.environment",O$="device.id",N$="device.model.identifier",I$="device.model.name",C$="faas.name",P$="faas.id",M$="faas.version",y$="faas.instance",v$="faas.max_memory",b$="host.id",L$="host.name",D$="host.type",x$="host.arch",U$="host.image.name",w$="host.image.id",V$="host.image.version",B$="k8s.cluster.name",G$="k8s.node.name",H$="k8s.node.uid",k$="k8s.namespace.name",F$="k8s.pod.uid",j$="k8s.pod.name",$$="k8s.container.name",Y$="k8s.replicaset.uid",q$="k8s.replicaset.name",K$="k8s.deployment.uid",W$="k8s.deployment.name",X$="k8s.statefulset.uid",z$="k8s.statefulset.name",J$="k8s.daemonset.uid",Q$="k8s.daemonset.name",Z$="k8s.job.uid",eY="k8s.job.name",tY="k8s.cronjob.uid",nY="k8s.cronjob.name",rY="os.type",oY="os.description",sY="os.name",iY="os.version",aY="process.pid",cY="process.executable.name",uY="process.executable.path",lY="process.command",pY="process.command_line",dY="process.command_args",_Y="process.owner",EY="process.runtime.name",fY="process.runtime.version",SY="process.runtime.description",TY="service.name",mY="service.namespace",hY="service.instance.id",gY="service.version",AY="telemetry.sdk.name",RY="telemetry.sdk.language",OY="telemetry.sdk.version",NY="telemetry.auto.version",IY="webengine.name",CY="webengine.version",PY="webengine.description",XAe=t$,zAe=n$,JAe=r$,QAe=o$,ZAe=s$,eRe=i$,tRe=a$,nRe=c$,rRe=u$,oRe=l$,sRe=p$,iRe=d$,aRe=_$,cRe=E$,uRe=f$,lRe=S$,pRe=T$,dRe=m$,_Re=h$,ERe=g$,fRe=A$,SRe=R$,TRe=O$,mRe=N$,hRe=I$,gRe=C$,ARe=P$,RRe=M$,ORe=y$,NRe=v$,IRe=b$,CRe=L$,PRe=D$,MRe=x$,yRe=U$,vRe=w$,bRe=V$,LRe=B$,DRe=G$,xRe=H$,URe=k$,wRe=F$,VRe=j$,BRe=$$,GRe=Y$,HRe=q$,kRe=K$,FRe=W$,jRe=X$,$Re=z$,YRe=J$,qRe=Q$,KRe=Z$,WRe=eY,XRe=tY,zRe=nY,JRe=rY,QRe=oY,ZRe=sY,eOe=iY,tOe=aY,nOe=cY,rOe=uY,oOe=lY,sOe=pY,iOe=dY,aOe=_Y,cOe=EY,uOe=fY,lOe=SY,pOe=TY,tA=mY,dOe=hY,_Oe=gY,EOe=AY,fOe=RY,SOe=OY,TOe=NY,mOe=IY,hOe=CY,gOe=PY,AOe=Fe([t$,n$,r$,o$,s$,i$,a$,c$,u$,l$,p$,d$,_$,E$,f$,S$,T$,m$,h$,g$,A$,R$,O$,N$,I$,C$,P$,M$,y$,v$,b$,L$,D$,x$,U$,w$,V$,B$,G$,H$,k$,F$,j$,$$,Y$,q$,K$,W$,X$,z$,J$,Q$,Z$,eY,tY,nY,rY,oY,sY,iY,aY,cY,uY,lY,pY,dY,_Y,EY,fY,SY,TY,mY,hY,gY,AY,RY,OY,NY,IY,CY,PY]),MY="alibaba_cloud",yY="aws",vY="azure",bY="gcp",ROe=MY,OOe=yY,NOe=vY,IOe=bY,COe=Fe([MY,yY,vY,bY]),LY="alibaba_cloud_ecs",DY="alibaba_cloud_fc",xY="aws_ec2",UY="aws_ecs",wY="aws_eks",VY="aws_lambda",BY="aws_elastic_beanstalk",GY="azure_vm",HY="azure_container_instances",kY="azure_aks",FY="azure_functions",jY="azure_app_service",$Y="gcp_compute_engine",YY="gcp_cloud_run",qY="gcp_kubernetes_engine",KY="gcp_cloud_functions",WY="gcp_app_engine",POe=LY,MOe=DY,yOe=xY,vOe=UY,bOe=wY,LOe=VY,DOe=BY,xOe=GY,UOe=HY,wOe=kY,VOe=FY,BOe=jY,GOe=$Y,HOe=YY,kOe=qY,FOe=KY,jOe=WY,$Oe=Fe([LY,DY,xY,UY,wY,VY,BY,GY,HY,kY,FY,jY,$Y,YY,qY,KY,WY]),XY="ec2",zY="fargate",YOe=XY,qOe=zY,KOe=Fe([XY,zY]),JY="amd64",QY="arm32",ZY="arm64",eq="ia64",tq="ppc32",nq="ppc64",rq="x86",WOe=JY,XOe=QY,zOe=ZY,JOe=eq,QOe=tq,ZOe=nq,eNe=rq,tNe=Fe([JY,QY,ZY,eq,tq,nq,rq]),oq="windows",sq="linux",iq="darwin",aq="freebsd",cq="netbsd",uq="openbsd",lq="dragonflybsd",pq="hpux",dq="aix",_q="solaris",Eq="z_os",nNe=oq,rNe=sq,oNe=iq,sNe=aq,iNe=cq,aNe=uq,cNe=lq,uNe=pq,lNe=dq,pNe=_q,dNe=Eq,_Ne=Fe([oq,sq,iq,aq,cq,uq,lq,pq,dq,_q,Eq]),fq="cpp",Sq="dotnet",Tq="erlang",mq="go",hq="java",gq="nodejs",Aq="php",Rq="python",Oq="ruby",Nq="webjs",ENe=fq,fNe=Sq,SNe=Tq,TNe=mq,mNe=hq,hNe=gq,gNe=Aq,ANe=Rq,RNe=Oq,ONe=Nq,NNe=Fe([fq,Sq,Tq,mq,hq,gq,Aq,Rq,Oq,Nq])});var Cq=U(()=>{Iq()});var INe,CNe,PNe,MNe,yNe,vNe,bNe,LNe,DNe,xNe,UNe,wNe,VNe,BNe,GNe,HNe,kNe,FNe,jNe,$Ne,YNe,qNe,KNe,WNe,XNe,zNe,nA,JNe,rA,QNe,oA,sA,ZNe,iA,eIe,tIe,nIe,rIe,oIe,sIe,iIe,aIe,YWe,qWe,aA,cIe,uIe,lIe,pIe,dIe,_Ie,ks,EIe,fIe,SIe,KWe,TIe,mIe,hIe,gIe,WWe,AIe,RIe,OIe,NIe,Bo,Ar,IIe,CIe,PIe,MIe,yIe,vIe,bIe,LIe,DIe,XWe,xIe,UIe,wIe,VIe,BIe,GIe,HIe,kIe,FIe,jIe,$Ie,YIe,qIe,zWe,JWe,KIe,WIe,XIe,zIe,JIe,QIe,ZIe,eCe,QWe,tCe,cA,uA,nCe,dn,rCe,lA,oCe,sCe,iCe,aCe,cCe,uCe,lCe,pCe,dCe,ZWe,_Ce,ECe,e2e,fCe,SCe,t2e,TCe,mCe,hCe,gCe,ACe,RCe,OCe,NCe,aa,ICe,CCe,PCe,MCe,Pq=U(()=>{INe="aspnetcore.diagnostics.exception.result",CNe="aborted",PNe="handled",MNe="skipped",yNe="unhandled",vNe="aspnetcore.diagnostics.handler.type",bNe="aspnetcore.rate_limiting.policy",LNe="aspnetcore.rate_limiting.result",DNe="acquired",xNe="endpoint_limiter",UNe="global_limiter",wNe="request_canceled",VNe="aspnetcore.request.is_unhandled",BNe="aspnetcore.routing.is_fallback",GNe="aspnetcore.routing.match_status",HNe="failure",kNe="success",FNe="aspnetcore.user.is_authenticated",jNe="client.address",$Ne="client.port",YNe="code.column.number",qNe="code.file.path",KNe="code.function.name",WNe="code.line.number",XNe="code.stacktrace",zNe="db.collection.name",nA="db.namespace",JNe="db.operation.batch.size",rA="db.operation.name",QNe="db.query.summary",oA="db.query.text",sA="db.response.status_code",ZNe="db.stored_procedure.name",iA="db.system.name",eIe="mariadb",tIe="microsoft.sql_server",nIe="mysql",rIe="postgresql",oIe="dotnet.gc.heap.generation",sIe="gen0",iIe="gen1",aIe="gen2",YWe="loh",qWe="poh",aA="error.type",cIe="_OTHER",uIe="exception.escaped",lIe="exception.message",pIe="exception.stacktrace",dIe="exception.type",_Ie=t=>`http.request.header.${t}`,ks="http.request.method",EIe="_OTHER",fIe="CONNECT",SIe="DELETE",KWe="GET",TIe="HEAD",mIe="OPTIONS",hIe="PATCH",gIe="POST",WWe="PUT",AIe="TRACE",RIe="http.request.method_original",OIe="http.request.resend_count",NIe=t=>`http.response.header.${t}`,Bo="http.response.status_code",Ar="http.route",IIe="jvm.gc.action",CIe="jvm.gc.name",PIe="jvm.memory.pool.name",MIe="jvm.memory.type",yIe="heap",vIe="non_heap",bIe="jvm.thread.daemon",LIe="jvm.thread.state",DIe="blocked",XWe="new",xIe="runnable",UIe="terminated",wIe="timed_waiting",VIe="waiting",BIe="network.local.address",GIe="network.local.port",HIe="network.peer.address",kIe="network.peer.port",FIe="network.protocol.name",jIe="network.protocol.version",$Ie="network.transport",YIe="pipe",qIe="quic",zWe="tcp",JWe="udp",KIe="unix",WIe="network.type",XIe="ipv4",zIe="ipv6",JIe="otel.scope.name",QIe="otel.scope.version",ZIe="otel.status_code",eCe="ERROR",QWe="OK",tCe="otel.status_description",cA="server.address",uA="server.port",nCe="service.instance.id",dn="service.name",rCe="service.namespace",lA="service.version",oCe="signalr.connection.status",sCe="app_shutdown",iCe="normal_closure",aCe="timeout",cCe="signalr.transport",uCe="long_polling",lCe="server_sent_events",pCe="web_sockets",dCe="telemetry.sdk.language",ZWe="cpp",_Ce="dotnet",ECe="erlang",e2e="go",fCe="java",SCe="nodejs",t2e="php",TCe="python",mCe="ruby",hCe="rust",gCe="swift",ACe="webjs",RCe="telemetry.sdk.name",OCe="telemetry.sdk.version",NCe="url.fragment",aa="url.full",ICe="url.path",CCe="url.query",PCe="url.scheme",MCe="user_agent.original"});var yCe,vCe,bCe,LCe,DCe,xCe,UCe,wCe,VCe,BCe,GCe,HCe,kCe,FCe,jCe,$Ce,YCe,qCe,KCe,WCe,XCe,zCe,JCe,QCe,ZCe,ePe,tPe,nPe,rPe,oPe,sPe,iPe,aPe,cPe,uPe,lPe,pPe,dPe,_Pe,EPe,fPe,SPe,TPe,mPe,hPe,gPe,APe,RPe,OPe,NPe,IPe,Mq=U(()=>{yCe="aspnetcore.diagnostics.exceptions",vCe="aspnetcore.rate_limiting.active_request_leases",bCe="aspnetcore.rate_limiting.queued_requests",LCe="aspnetcore.rate_limiting.request.time_in_queue",DCe="aspnetcore.rate_limiting.request_lease.duration",xCe="aspnetcore.rate_limiting.requests",UCe="aspnetcore.routing.match_attempts",wCe="db.client.operation.duration",VCe="dotnet.assembly.count",BCe="dotnet.exceptions",GCe="dotnet.gc.collections",HCe="dotnet.gc.heap.total_allocated",kCe="dotnet.gc.last_collection.heap.fragmentation.size",FCe="dotnet.gc.last_collection.heap.size",jCe="dotnet.gc.last_collection.memory.committed_size",$Ce="dotnet.gc.pause.time",YCe="dotnet.jit.compilation.time",qCe="dotnet.jit.compiled_il.size",KCe="dotnet.jit.compiled_methods",WCe="dotnet.monitor.lock_contentions",XCe="dotnet.process.cpu.count",zCe="dotnet.process.cpu.time",JCe="dotnet.process.memory.working_set",QCe="dotnet.thread_pool.queue.length",ZCe="dotnet.thread_pool.thread.count",ePe="dotnet.thread_pool.work_item.count",tPe="dotnet.timer.count",nPe="http.client.request.duration",rPe="http.server.request.duration",oPe="jvm.class.count",sPe="jvm.class.loaded",iPe="jvm.class.unloaded",aPe="jvm.cpu.count",cPe="jvm.cpu.recent_utilization",uPe="jvm.cpu.time",lPe="jvm.gc.duration",pPe="jvm.memory.committed",dPe="jvm.memory.limit",_Pe="jvm.memory.used",EPe="jvm.memory.used_after_last_gc",fPe="jvm.thread.count",SPe="kestrel.active_connections",TPe="kestrel.active_tls_handshakes",mPe="kestrel.connection.duration",hPe="kestrel.queued_connections",gPe="kestrel.queued_requests",APe="kestrel.rejected_connections",RPe="kestrel.tls_handshake.duration",OPe="kestrel.upgraded_connections",NPe="signalr.server.active_connections",IPe="signalr.server.connection.duration"});var CPe,yq=U(()=>{CPe="exception"});var je={};mS(je,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>CNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>PNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>MNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>yNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>DNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>xNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>UNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>wNe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>HNe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>kNe,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>INe,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>vNe,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>bNe,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>LNe,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>VNe,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>BNe,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>GNe,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>FNe,ATTR_CLIENT_ADDRESS:()=>jNe,ATTR_CLIENT_PORT:()=>$Ne,ATTR_CODE_COLUMN_NUMBER:()=>YNe,ATTR_CODE_FILE_PATH:()=>qNe,ATTR_CODE_FUNCTION_NAME:()=>KNe,ATTR_CODE_LINE_NUMBER:()=>WNe,ATTR_CODE_STACKTRACE:()=>XNe,ATTR_DB_COLLECTION_NAME:()=>zNe,ATTR_DB_NAMESPACE:()=>nA,ATTR_DB_OPERATION_BATCH_SIZE:()=>JNe,ATTR_DB_OPERATION_NAME:()=>rA,ATTR_DB_QUERY_SUMMARY:()=>QNe,ATTR_DB_QUERY_TEXT:()=>oA,ATTR_DB_RESPONSE_STATUS_CODE:()=>sA,ATTR_DB_STORED_PROCEDURE_NAME:()=>ZNe,ATTR_DB_SYSTEM_NAME:()=>iA,ATTR_DOTNET_GC_HEAP_GENERATION:()=>oIe,ATTR_ERROR_TYPE:()=>aA,ATTR_EXCEPTION_ESCAPED:()=>uIe,ATTR_EXCEPTION_MESSAGE:()=>lIe,ATTR_EXCEPTION_STACKTRACE:()=>pIe,ATTR_EXCEPTION_TYPE:()=>dIe,ATTR_HTTP_REQUEST_HEADER:()=>_Ie,ATTR_HTTP_REQUEST_METHOD:()=>ks,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>RIe,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>OIe,ATTR_HTTP_RESPONSE_HEADER:()=>NIe,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>Bo,ATTR_HTTP_ROUTE:()=>Ar,ATTR_JVM_GC_ACTION:()=>IIe,ATTR_JVM_GC_NAME:()=>CIe,ATTR_JVM_MEMORY_POOL_NAME:()=>PIe,ATTR_JVM_MEMORY_TYPE:()=>MIe,ATTR_JVM_THREAD_DAEMON:()=>bIe,ATTR_JVM_THREAD_STATE:()=>LIe,ATTR_NETWORK_LOCAL_ADDRESS:()=>BIe,ATTR_NETWORK_LOCAL_PORT:()=>GIe,ATTR_NETWORK_PEER_ADDRESS:()=>HIe,ATTR_NETWORK_PEER_PORT:()=>kIe,ATTR_NETWORK_PROTOCOL_NAME:()=>FIe,ATTR_NETWORK_PROTOCOL_VERSION:()=>jIe,ATTR_NETWORK_TRANSPORT:()=>$Ie,ATTR_NETWORK_TYPE:()=>WIe,ATTR_OTEL_SCOPE_NAME:()=>JIe,ATTR_OTEL_SCOPE_VERSION:()=>QIe,ATTR_OTEL_STATUS_CODE:()=>ZIe,ATTR_OTEL_STATUS_DESCRIPTION:()=>tCe,ATTR_SERVER_ADDRESS:()=>cA,ATTR_SERVER_PORT:()=>uA,ATTR_SERVICE_INSTANCE_ID:()=>nCe,ATTR_SERVICE_NAME:()=>dn,ATTR_SERVICE_NAMESPACE:()=>rCe,ATTR_SERVICE_VERSION:()=>lA,ATTR_SIGNALR_CONNECTION_STATUS:()=>oCe,ATTR_SIGNALR_TRANSPORT:()=>cCe,ATTR_TELEMETRY_SDK_LANGUAGE:()=>dCe,ATTR_TELEMETRY_SDK_NAME:()=>RCe,ATTR_TELEMETRY_SDK_VERSION:()=>OCe,ATTR_URL_FRAGMENT:()=>NCe,ATTR_URL_FULL:()=>aa,ATTR_URL_PATH:()=>ICe,ATTR_URL_QUERY:()=>CCe,ATTR_URL_SCHEME:()=>PCe,ATTR_USER_AGENT_ORIGINAL:()=>MCe,AWSECSLAUNCHTYPEVALUES_EC2:()=>YOe,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>qOe,AwsEcsLaunchtypeValues:()=>KOe,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>POe,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>MOe,CLOUDPLATFORMVALUES_AWS_EC2:()=>yOe,CLOUDPLATFORMVALUES_AWS_ECS:()=>vOe,CLOUDPLATFORMVALUES_AWS_EKS:()=>bOe,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>DOe,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>LOe,CLOUDPLATFORMVALUES_AZURE_AKS:()=>wOe,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>BOe,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>UOe,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>VOe,CLOUDPLATFORMVALUES_AZURE_VM:()=>xOe,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>jOe,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>FOe,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>HOe,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>GOe,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>kOe,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>ROe,CLOUDPROVIDERVALUES_AWS:()=>OOe,CLOUDPROVIDERVALUES_AZURE:()=>NOe,CLOUDPROVIDERVALUES_GCP:()=>IOe,CloudPlatformValues:()=>$Oe,CloudProviderValues:()=>COe,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>age,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>fge,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>cge,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>Ege,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>lge,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>Tge,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>pge,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>uge,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>Sge,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>_ge,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>dge,DBSYSTEMVALUES_ADABAS:()=>vhe,DBSYSTEMVALUES_CACHE:()=>yhe,DBSYSTEMVALUES_CASSANDRA:()=>Khe,DBSYSTEMVALUES_CLOUDSCAPE:()=>Ahe,DBSYSTEMVALUES_COCKROACHDB:()=>sge,DBSYSTEMVALUES_COLDFUSION:()=>qhe,DBSYSTEMVALUES_COSMOSDB:()=>Zhe,DBSYSTEMVALUES_COUCHBASE:()=>Jhe,DBSYSTEMVALUES_COUCHDB:()=>Qhe,DBSYSTEMVALUES_DB2:()=>The,DBSYSTEMVALUES_DERBY:()=>Lhe,DBSYSTEMVALUES_DYNAMODB:()=>ege,DBSYSTEMVALUES_EDB:()=>Mhe,DBSYSTEMVALUES_ELASTICSEARCH:()=>rge,DBSYSTEMVALUES_FILEMAKER:()=>Dhe,DBSYSTEMVALUES_FIREBIRD:()=>bhe,DBSYSTEMVALUES_FIRSTSQL:()=>Phe,DBSYSTEMVALUES_GEODE:()=>nge,DBSYSTEMVALUES_H2:()=>Yhe,DBSYSTEMVALUES_HANADB:()=>Ihe,DBSYSTEMVALUES_HBASE:()=>Whe,DBSYSTEMVALUES_HIVE:()=>ghe,DBSYSTEMVALUES_HSQLDB:()=>Rhe,DBSYSTEMVALUES_INFORMIX:()=>xhe,DBSYSTEMVALUES_INGRES:()=>Che,DBSYSTEMVALUES_INSTANTDB:()=>Uhe,DBSYSTEMVALUES_INTERBASE:()=>whe,DBSYSTEMVALUES_MARIADB:()=>Vhe,DBSYSTEMVALUES_MAXDB:()=>Nhe,DBSYSTEMVALUES_MEMCACHED:()=>oge,DBSYSTEMVALUES_MONGODB:()=>Xhe,DBSYSTEMVALUES_MSSQL:()=>Ehe,DBSYSTEMVALUES_MYSQL:()=>fhe,DBSYSTEMVALUES_NEO4J:()=>tge,DBSYSTEMVALUES_NETEZZA:()=>Bhe,DBSYSTEMVALUES_ORACLE:()=>She,DBSYSTEMVALUES_OTHER_SQL:()=>_he,DBSYSTEMVALUES_PERVASIVE:()=>Ghe,DBSYSTEMVALUES_POINTBASE:()=>Hhe,DBSYSTEMVALUES_POSTGRESQL:()=>mhe,DBSYSTEMVALUES_PROGRESS:()=>Ohe,DBSYSTEMVALUES_REDIS:()=>zhe,DBSYSTEMVALUES_REDSHIFT:()=>hhe,DBSYSTEMVALUES_SQLITE:()=>khe,DBSYSTEMVALUES_SYBASE:()=>Fhe,DBSYSTEMVALUES_TERADATA:()=>jhe,DBSYSTEMVALUES_VERTICA:()=>$he,DB_SYSTEM_NAME_VALUE_MARIADB:()=>eIe,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>tIe,DB_SYSTEM_NAME_VALUE_MYSQL:()=>nIe,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>rIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>sIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>iIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>aIe,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>YWe,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>qWe,DbCassandraConsistencyLevelValues:()=>mge,DbSystemValues:()=>ige,ERROR_TYPE_VALUE_OTHER:()=>cIe,EVENT_EXCEPTION:()=>CPe,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>Pge,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>Cge,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>Ige,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>yge,FAASINVOKEDPROVIDERVALUES_AWS:()=>vge,FAASINVOKEDPROVIDERVALUES_AZURE:()=>bge,FAASINVOKEDPROVIDERVALUES_GCP:()=>Lge,FAASTRIGGERVALUES_DATASOURCE:()=>hge,FAASTRIGGERVALUES_HTTP:()=>gge,FAASTRIGGERVALUES_OTHER:()=>Oge,FAASTRIGGERVALUES_PUBSUB:()=>Age,FAASTRIGGERVALUES_TIMER:()=>Rge,FaasDocumentOperationValues:()=>Mge,FaasInvokedProviderValues:()=>Dge,FaasTriggerValues:()=>Nge,HOSTARCHVALUES_AMD64:()=>WOe,HOSTARCHVALUES_ARM32:()=>XOe,HOSTARCHVALUES_ARM64:()=>zOe,HOSTARCHVALUES_IA64:()=>JOe,HOSTARCHVALUES_PPC32:()=>QOe,HOSTARCHVALUES_PPC64:()=>ZOe,HOSTARCHVALUES_X86:()=>eNe,HTTPFLAVORVALUES_HTTP_1_0:()=>SAe,HTTPFLAVORVALUES_HTTP_1_1:()=>TAe,HTTPFLAVORVALUES_HTTP_2_0:()=>mAe,HTTPFLAVORVALUES_QUIC:()=>gAe,HTTPFLAVORVALUES_SPDY:()=>hAe,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>fIe,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>SIe,HTTP_REQUEST_METHOD_VALUE_GET:()=>KWe,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>TIe,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>mIe,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>EIe,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>hIe,HTTP_REQUEST_METHOD_VALUE_POST:()=>gIe,HTTP_REQUEST_METHOD_VALUE_PUT:()=>WWe,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>AIe,HostArchValues:()=>tNe,HttpFlavorValues:()=>AAe,JVM_MEMORY_TYPE_VALUE_HEAP:()=>yIe,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>vIe,JVM_THREAD_STATE_VALUE_BLOCKED:()=>DIe,JVM_THREAD_STATE_VALUE_NEW:()=>XWe,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>xIe,JVM_THREAD_STATE_VALUE_TERMINATED:()=>UIe,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>wIe,JVM_THREAD_STATE_VALUE_WAITING:()=>VIe,MESSAGETYPEVALUES_RECEIVED:()=>KAe,MESSAGETYPEVALUES_SENT:()=>qAe,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>RAe,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>OAe,MESSAGINGOPERATIONVALUES_PROCESS:()=>CAe,MESSAGINGOPERATIONVALUES_RECEIVE:()=>IAe,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>yCe,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>vCe,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>bCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>xCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>DCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>LCe,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>UCe,METRIC_DB_CLIENT_OPERATION_DURATION:()=>wCe,METRIC_DOTNET_ASSEMBLY_COUNT:()=>VCe,METRIC_DOTNET_EXCEPTIONS:()=>BCe,METRIC_DOTNET_GC_COLLECTIONS:()=>GCe,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>HCe,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>kCe,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>FCe,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>jCe,METRIC_DOTNET_GC_PAUSE_TIME:()=>$Ce,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>YCe,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>qCe,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>KCe,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>WCe,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>XCe,METRIC_DOTNET_PROCESS_CPU_TIME:()=>zCe,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>JCe,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>QCe,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>ZCe,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>ePe,METRIC_DOTNET_TIMER_COUNT:()=>tPe,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>nPe,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>rPe,METRIC_JVM_CLASS_COUNT:()=>oPe,METRIC_JVM_CLASS_LOADED:()=>sPe,METRIC_JVM_CLASS_UNLOADED:()=>iPe,METRIC_JVM_CPU_COUNT:()=>aPe,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>cPe,METRIC_JVM_CPU_TIME:()=>uPe,METRIC_JVM_GC_DURATION:()=>lPe,METRIC_JVM_MEMORY_COMMITTED:()=>pPe,METRIC_JVM_MEMORY_LIMIT:()=>dPe,METRIC_JVM_MEMORY_USED:()=>_Pe,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>EPe,METRIC_JVM_THREAD_COUNT:()=>fPe,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>SPe,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>TPe,METRIC_KESTREL_CONNECTION_DURATION:()=>mPe,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>hPe,METRIC_KESTREL_QUEUED_REQUESTS:()=>gPe,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>APe,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>RPe,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>OPe,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>NPe,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>IPe,MessageTypeValues:()=>WAe,MessagingDestinationKindValues:()=>NAe,MessagingOperationValues:()=>PAe,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>Jge,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>eAe,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>Xge,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>aAe,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>Qge,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>Zge,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>sAe,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>Wge,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>uAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>tAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>rAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>cAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>nAe,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>oAe,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>pAe,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>iAe,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>EAe,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>dAe,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>_Ae,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>lAe,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>zge,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>$ge,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>Yge,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>qge,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>Fge,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>jge,NETTRANSPORTVALUES_INPROC:()=>Gge,NETTRANSPORTVALUES_IP:()=>wge,NETTRANSPORTVALUES_IP_TCP:()=>xge,NETTRANSPORTVALUES_IP_UDP:()=>Uge,NETTRANSPORTVALUES_OTHER:()=>Hge,NETTRANSPORTVALUES_PIPE:()=>Bge,NETTRANSPORTVALUES_UNIX:()=>Vge,NETWORK_TRANSPORT_VALUE_PIPE:()=>YIe,NETWORK_TRANSPORT_VALUE_QUIC:()=>qIe,NETWORK_TRANSPORT_VALUE_TCP:()=>zWe,NETWORK_TRANSPORT_VALUE_UDP:()=>JWe,NETWORK_TRANSPORT_VALUE_UNIX:()=>KIe,NETWORK_TYPE_VALUE_IPV4:()=>XIe,NETWORK_TYPE_VALUE_IPV6:()=>zIe,NetHostConnectionSubtypeValues:()=>fAe,NetHostConnectionTypeValues:()=>Kge,NetTransportValues:()=>kge,OSTYPEVALUES_AIX:()=>lNe,OSTYPEVALUES_DARWIN:()=>oNe,OSTYPEVALUES_DRAGONFLYBSD:()=>cNe,OSTYPEVALUES_FREEBSD:()=>sNe,OSTYPEVALUES_HPUX:()=>uNe,OSTYPEVALUES_LINUX:()=>rNe,OSTYPEVALUES_NETBSD:()=>iNe,OSTYPEVALUES_OPENBSD:()=>aNe,OSTYPEVALUES_SOLARIS:()=>pNe,OSTYPEVALUES_WINDOWS:()=>nNe,OSTYPEVALUES_Z_OS:()=>dNe,OTEL_STATUS_CODE_VALUE_ERROR:()=>eCe,OTEL_STATUS_CODE_VALUE_OK:()=>QWe,OsTypeValues:()=>_Ne,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>BAe,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>xAe,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>yAe,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>jAe,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>LAe,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>VAe,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>kAe,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>bAe,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>DAe,RPCGRPCSTATUSCODEVALUES_OK:()=>MAe,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>GAe,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>UAe,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>wAe,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>$Ae,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>FAe,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>HAe,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>vAe,RpcGrpcStatusCodeValues:()=>YAe,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>Nme,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>wme,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>Ame,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>Tme,SEMATTRS_AWS_DYNAMODB_COUNT:()=>xme,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>yme,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>Pme,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>Vme,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>Ime,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>mme,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>Ome,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>Mme,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>Rme,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>hme,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>gme,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>Ume,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>bme,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>Lme,SEMATTRS_AWS_DYNAMODB_SELECT:()=>Cme,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>vme,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>Sme,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>Dme,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>rTe,SEMATTRS_CODE_FILEPATH:()=>ome,SEMATTRS_CODE_FUNCTION:()=>nme,SEMATTRS_CODE_LINENO:()=>sme,SEMATTRS_CODE_NAMESPACE:()=>rme,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>dTe,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>TTe,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>STe,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>ETe,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>lTe,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>pTe,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>fTe,SEMATTRS_DB_CASSANDRA_TABLE:()=>_Te,SEMATTRS_DB_CONNECTION_STRING:()=>oTe,SEMATTRS_DB_HBASE_NAMESPACE:()=>mTe,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>iTe,SEMATTRS_DB_MONGODB_COLLECTION:()=>gTe,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>uTe,SEMATTRS_DB_NAME:()=>aTe,SEMATTRS_DB_OPERATION:()=>cTe,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>hTe,SEMATTRS_DB_SQL_TABLE:()=>ATe,SEMATTRS_DB_STATEMENT:()=>Xg,SEMATTRS_DB_SYSTEM:()=>Wg,SEMATTRS_DB_USER:()=>sTe,SEMATTRS_ENDUSER_ID:()=>JTe,SEMATTRS_ENDUSER_ROLE:()=>QTe,SEMATTRS_ENDUSER_SCOPE:()=>ZTe,SEMATTRS_EXCEPTION_ESCAPED:()=>ITe,SEMATTRS_EXCEPTION_MESSAGE:()=>OTe,SEMATTRS_EXCEPTION_STACKTRACE:()=>NTe,SEMATTRS_EXCEPTION_TYPE:()=>RTe,SEMATTRS_FAAS_COLDSTART:()=>DTe,SEMATTRS_FAAS_CRON:()=>LTe,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>PTe,SEMATTRS_FAAS_DOCUMENT_NAME:()=>vTe,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>MTe,SEMATTRS_FAAS_DOCUMENT_TIME:()=>yTe,SEMATTRS_FAAS_EXECUTION:()=>CTe,SEMATTRS_FAAS_INVOKED_NAME:()=>xTe,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>UTe,SEMATTRS_FAAS_INVOKED_REGION:()=>wTe,SEMATTRS_FAAS_TIME:()=>bTe,SEMATTRS_FAAS_TRIGGER:()=>zg,SEMATTRS_HTTP_CLIENT_IP:()=>fme,SEMATTRS_HTTP_FLAVOR:()=>cme,SEMATTRS_HTTP_HOST:()=>ime,SEMATTRS_HTTP_METHOD:()=>Iu,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>lme,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>pme,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>dme,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>_me,SEMATTRS_HTTP_ROUTE:()=>Cu,SEMATTRS_HTTP_SCHEME:()=>ame,SEMATTRS_HTTP_SERVER_NAME:()=>Eme,SEMATTRS_HTTP_STATUS_CODE:()=>Y_,SEMATTRS_HTTP_TARGET:()=>Jg,SEMATTRS_HTTP_URL:()=>ia,SEMATTRS_HTTP_USER_AGENT:()=>ume,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>lhe,SEMATTRS_MESSAGE_ID:()=>uhe,SEMATTRS_MESSAGE_TYPE:()=>che,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>phe,SEMATTRS_MESSAGING_CONSUMER_ID:()=>Xme,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>Yme,SEMATTRS_MESSAGING_DESTINATION:()=>Bme,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>Gme,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>Zme,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>Qme,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>Jme,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>ehe,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>the,SEMATTRS_MESSAGING_MESSAGE_ID:()=>$me,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>Kme,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>qme,SEMATTRS_MESSAGING_OPERATION:()=>Wme,SEMATTRS_MESSAGING_PROTOCOL:()=>kme,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>Fme,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>zme,SEMATTRS_MESSAGING_SYSTEM:()=>Qg,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>Hme,SEMATTRS_MESSAGING_URL:()=>jme,SEMATTRS_NET_HOST_CARRIER_ICC:()=>XTe,SEMATTRS_NET_HOST_CARRIER_MCC:()=>KTe,SEMATTRS_NET_HOST_CARRIER_MNC:()=>WTe,SEMATTRS_NET_HOST_CARRIER_NAME:()=>qTe,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>YTe,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>$Te,SEMATTRS_NET_HOST_IP:()=>kTe,SEMATTRS_NET_HOST_NAME:()=>jTe,SEMATTRS_NET_HOST_PORT:()=>FTe,SEMATTRS_NET_PEER_IP:()=>BTe,SEMATTRS_NET_PEER_NAME:()=>HTe,SEMATTRS_NET_PEER_PORT:()=>GTe,SEMATTRS_NET_TRANSPORT:()=>VTe,SEMATTRS_PEER_SERVICE:()=>zTe,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>eA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>ihe,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>ahe,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>she,SEMATTRS_RPC_JSONRPC_VERSION:()=>ohe,SEMATTRS_RPC_METHOD:()=>rhe,SEMATTRS_RPC_SERVICE:()=>Zg,SEMATTRS_RPC_SYSTEM:()=>nhe,SEMATTRS_THREAD_ID:()=>eme,SEMATTRS_THREAD_NAME:()=>tme,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>tRe,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>eRe,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>nRe,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>rRe,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>oRe,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>sRe,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>iRe,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>cRe,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>aRe,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>lRe,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>uRe,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>zAe,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>QAe,SEMRESATTRS_CLOUD_PLATFORM:()=>ZAe,SEMRESATTRS_CLOUD_PROVIDER:()=>XAe,SEMRESATTRS_CLOUD_REGION:()=>JAe,SEMRESATTRS_CONTAINER_ID:()=>dRe,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>ERe,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>fRe,SEMRESATTRS_CONTAINER_NAME:()=>pRe,SEMRESATTRS_CONTAINER_RUNTIME:()=>_Re,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>SRe,SEMRESATTRS_DEVICE_ID:()=>TRe,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>mRe,SEMRESATTRS_DEVICE_MODEL_NAME:()=>hRe,SEMRESATTRS_FAAS_ID:()=>ARe,SEMRESATTRS_FAAS_INSTANCE:()=>ORe,SEMRESATTRS_FAAS_MAX_MEMORY:()=>NRe,SEMRESATTRS_FAAS_NAME:()=>gRe,SEMRESATTRS_FAAS_VERSION:()=>RRe,SEMRESATTRS_HOST_ARCH:()=>MRe,SEMRESATTRS_HOST_ID:()=>IRe,SEMRESATTRS_HOST_IMAGE_ID:()=>vRe,SEMRESATTRS_HOST_IMAGE_NAME:()=>yRe,SEMRESATTRS_HOST_IMAGE_VERSION:()=>bRe,SEMRESATTRS_HOST_NAME:()=>CRe,SEMRESATTRS_HOST_TYPE:()=>PRe,SEMRESATTRS_K8S_CLUSTER_NAME:()=>LRe,SEMRESATTRS_K8S_CONTAINER_NAME:()=>BRe,SEMRESATTRS_K8S_CRONJOB_NAME:()=>zRe,SEMRESATTRS_K8S_CRONJOB_UID:()=>XRe,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>qRe,SEMRESATTRS_K8S_DAEMONSET_UID:()=>YRe,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>FRe,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>kRe,SEMRESATTRS_K8S_JOB_NAME:()=>WRe,SEMRESATTRS_K8S_JOB_UID:()=>KRe,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>URe,SEMRESATTRS_K8S_NODE_NAME:()=>DRe,SEMRESATTRS_K8S_NODE_UID:()=>xRe,SEMRESATTRS_K8S_POD_NAME:()=>VRe,SEMRESATTRS_K8S_POD_UID:()=>wRe,SEMRESATTRS_K8S_REPLICASET_NAME:()=>HRe,SEMRESATTRS_K8S_REPLICASET_UID:()=>GRe,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>$Re,SEMRESATTRS_K8S_STATEFULSET_UID:()=>jRe,SEMRESATTRS_OS_DESCRIPTION:()=>QRe,SEMRESATTRS_OS_NAME:()=>ZRe,SEMRESATTRS_OS_TYPE:()=>JRe,SEMRESATTRS_OS_VERSION:()=>eOe,SEMRESATTRS_PROCESS_COMMAND:()=>oOe,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>iOe,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>sOe,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>nOe,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>rOe,SEMRESATTRS_PROCESS_OWNER:()=>aOe,SEMRESATTRS_PROCESS_PID:()=>tOe,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>lOe,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>cOe,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>uOe,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>dOe,SEMRESATTRS_SERVICE_NAME:()=>pOe,SEMRESATTRS_SERVICE_NAMESPACE:()=>tA,SEMRESATTRS_SERVICE_VERSION:()=>_Oe,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>TOe,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>fOe,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>EOe,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>SOe,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>gOe,SEMRESATTRS_WEBENGINE_NAME:()=>mOe,SEMRESATTRS_WEBENGINE_VERSION:()=>hOe,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>sCe,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>iCe,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>aCe,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>uCe,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>lCe,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>pCe,SemanticAttributes:()=>dhe,SemanticResourceAttributes:()=>AOe,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>ENe,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>fNe,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>SNe,TELEMETRYSDKLANGUAGEVALUES_GO:()=>TNe,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>mNe,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>hNe,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>gNe,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>ANe,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>RNe,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>ONe,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>ZWe,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>_Ce,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>ECe,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>e2e,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>fCe,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>SCe,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>t2e,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>TCe,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>mCe,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>hCe,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>gCe,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>ACe,TelemetrySdkLanguageValues:()=>NNe});var de=U(()=>{e$();Cq();Pq();Mq();yq()});var vq=f(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});q_.ExceptionEventName=void 0;q_.ExceptionEventName="exception"});var dA=f(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.Span=void 0;var Pn=(y(),I(x)),It=oe(),Fs=(hn(),I(mn)),PPe=vq(),pA=class{constructor(e,n,r,o,s,i,a=[],c,u,l){this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this.status={code:Pn.SpanStatusCode.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1],this.name=r,this._spanContext=o,this.parentSpanId=i,this.kind=s,this.links=a;let p=Date.now();this._performanceStartTime=It.otperformance.now(),this._performanceOffset=p-(this._performanceStartTime+(0,It.getTimeOrigin)()),this._startTimeProvided=c!=null,this.startTime=this._getTime(c??p),this.resource=e.resource,this.instrumentationLibrary=e.instrumentationLibrary,this._spanLimits=e.getSpanLimits(),this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,l!=null&&this.setAttributes(l),this._spanProcessor=e.getActiveSpanProcessor(),this._spanProcessor.onStart(this,n)}spanContext(){return this._spanContext}setAttribute(e,n){return n==null||this._isSpanEnded()?this:e.length===0?(Pn.diag.warn(`Invalid attribute key: ${e}`),this):(0,It.isAttributeValue)(n)?Object.keys(this.attributes).length>=this._spanLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),this):(Pn.diag.warn(`Invalid attribute value set for key: ${e}`),this)}setAttributes(e){for(let[n,r]of Object.entries(e))this.setAttribute(n,r);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;if(this._spanLimits.eventCountLimit===0)return Pn.diag.warn("No events allowed."),this._droppedEventsCount++,this;this.events.length>=this._spanLimits.eventCountLimit&&(this._droppedEventsCount===0&&Pn.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,It.isTimeInput)(n)&&((0,It.isTimeInput)(r)||(r=n),n=void 0);let o=(0,It.sanitizeAttributes)(n);return this.events.push({name:e,attributes:o,time:this._getTime(r),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status=Object.assign({},e),this.status.message!=null&&typeof e.message!="string"&&(Pn.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){Pn.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this._ended=!0,this.endTime=this._getTime(e),this._duration=(0,It.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(Pn.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&&Pn.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=It.otperformance.now())return(0,It.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,It.millisToHrTime)(e);if(e instanceof Date)return(0,It.millisToHrTime)(e.getTime());if((0,It.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,It.millisToHrTime)(Date.now());let n=It.otperformance.now()-this._performanceStartTime;return(0,It.addHrTimes)(this.startTime,(0,It.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[Fs.SEMATTRS_EXCEPTION_MESSAGE]=e:e&&(e.code?r[Fs.SEMATTRS_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[Fs.SEMATTRS_EXCEPTION_TYPE]=e.name),e.message&&(r[Fs.SEMATTRS_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[Fs.SEMATTRS_EXCEPTION_STACKTRACE]=e.stack)),r[Fs.SEMATTRS_EXCEPTION_TYPE]||r[Fs.SEMATTRS_EXCEPTION_MESSAGE]?this.addEvent(PPe.ExceptionEventName,r,n):Pn.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(){return this._ended&&Pn.diag.warn(`Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(Pn.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}};K_.Span=pA});var Mu=f(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.SamplingDecision=void 0;var MPe;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(MPe=Pu.SamplingDecision||(Pu.SamplingDecision={}))});var X_=f(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.AlwaysOffSampler=void 0;var yPe=Mu(),_A=class{shouldSample(){return{decision:yPe.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};W_.AlwaysOffSampler=_A});var J_=f(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.AlwaysOnSampler=void 0;var vPe=Mu(),EA=class{shouldSample(){return{decision:vPe.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};z_.AlwaysOnSampler=EA});var TA=f(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_.ParentBasedSampler=void 0;var Q_=(y(),I(x)),bPe=oe(),bq=X_(),fA=J_(),SA=class{constructor(e){var n,r,o,s;this._root=e.root,this._root||((0,bPe.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new fA.AlwaysOnSampler),this._remoteParentSampled=(n=e.remoteParentSampled)!==null&&n!==void 0?n:new fA.AlwaysOnSampler,this._remoteParentNotSampled=(r=e.remoteParentNotSampled)!==null&&r!==void 0?r:new bq.AlwaysOffSampler,this._localParentSampled=(o=e.localParentSampled)!==null&&o!==void 0?o:new fA.AlwaysOnSampler,this._localParentNotSampled=(s=e.localParentNotSampled)!==null&&s!==void 0?s:new bq.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=Q_.trace.getSpanContext(e);return!a||!(0,Q_.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&Q_.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&Q_.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()}}`}};Z_.ParentBasedSampler=SA});var hA=f(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.TraceIdRatioBasedSampler=void 0;var LPe=(y(),I(x)),Lq=Mu(),mA=class{constructor(e=0){this._ratio=e,this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,LPe.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?Lq.SamplingDecision.RECORD_AND_SAMPLED:Lq.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}};eE.TraceIdRatioBasedSampler=mA});var RA=f(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.buildSamplerFromEnv=ua.loadDefaultConfig=void 0;var tE=(y(),I(x)),qr=oe(),Dq=X_(),gA=J_(),AA=TA(),xq=hA(),DPe=qr.TracesSamplerValues.AlwaysOn,ca=1;function xPe(){let t=(0,qr.getEnv)();return{sampler:wq(t),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:t.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:t.OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:t.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:t.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:t.OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:t.OTEL_SPAN_EVENT_COUNT_LIMIT,attributePerEventCountLimit:t.OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,attributePerLinkCountLimit:t.OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT},mergeResourceWithDefaults:!0}}ua.loadDefaultConfig=xPe;function wq(t=(0,qr.getEnv)()){switch(t.OTEL_TRACES_SAMPLER){case qr.TracesSamplerValues.AlwaysOn:return new gA.AlwaysOnSampler;case qr.TracesSamplerValues.AlwaysOff:return new Dq.AlwaysOffSampler;case qr.TracesSamplerValues.ParentBasedAlwaysOn:return new AA.ParentBasedSampler({root:new gA.AlwaysOnSampler});case qr.TracesSamplerValues.ParentBasedAlwaysOff:return new AA.ParentBasedSampler({root:new Dq.AlwaysOffSampler});case qr.TracesSamplerValues.TraceIdRatio:return new xq.TraceIdRatioBasedSampler(Uq(t));case qr.TracesSamplerValues.ParentBasedTraceIdRatio:return new AA.ParentBasedSampler({root:new xq.TraceIdRatioBasedSampler(Uq(t))});default:return tE.diag.error(`OTEL_TRACES_SAMPLER value "${t.OTEL_TRACES_SAMPLER} invalid, defaulting to ${DPe}".`),new gA.AlwaysOnSampler}}ua.buildSamplerFromEnv=wq;function Uq(t){if(t.OTEL_TRACES_SAMPLER_ARG===void 0||t.OTEL_TRACES_SAMPLER_ARG==="")return tE.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ca}.`),ca;let e=Number(t.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(tE.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${ca}.`),ca):e<0||e>1?(tE.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${ca}.`),ca):e}});var NA=f(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.reconfigureLimits=la.mergeConfig=void 0;var Vq=RA(),OA=oe();function UPe(t){let e={sampler:(0,Vq.buildSamplerFromEnv)()},n=(0,Vq.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}la.mergeConfig=UPe;function wPe(t){var e,n,r,o,s,i,a,c,u,l,p,d;let _=Object.assign({},t.spanLimits),E=(0,OA.getEnvWithoutDefaults)();return _.attributeCountLimit=(i=(s=(o=(n=(e=t.spanLimits)===null||e===void 0?void 0:e.attributeCountLimit)!==null&&n!==void 0?n:(r=t.generalLimits)===null||r===void 0?void 0:r.attributeCountLimit)!==null&&o!==void 0?o:E.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT)!==null&&s!==void 0?s:E.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&i!==void 0?i:OA.DEFAULT_ATTRIBUTE_COUNT_LIMIT,_.attributeValueLengthLimit=(d=(p=(l=(c=(a=t.spanLimits)===null||a===void 0?void 0:a.attributeValueLengthLimit)!==null&&c!==void 0?c:(u=t.generalLimits)===null||u===void 0?void 0:u.attributeValueLengthLimit)!==null&&l!==void 0?l:E.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&p!==void 0?p:E.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&d!==void 0?d:OA.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:_})}la.reconfigureLimits=wPe});var Bq=f(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.BatchSpanProcessorBase=void 0;var pa=(y(),I(x)),js=oe(),IA=class{constructor(e,n){this._exporter=e,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;let r=(0,js.getEnv)();this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:r.OTEL_BSP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:r.OTEL_BSP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:r.OTEL_BSP_SCHEDULE_DELAY,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:r.OTEL_BSP_EXPORT_TIMEOUT,this._shutdownOnce=new js.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pa.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&pa.TraceFlags.SAMPLED)!==0&&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&&pa.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(pa.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);pa.context.with((0,js.suppressTracing)(pa.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=>{var c;clearTimeout(r),a.code===js.ExportResultCode.SUCCESS?e():n((c=a.error)!==null&&c!==void 0?c:new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(i??(i=[]),i.push(u.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,js.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,js.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),(0,js.unrefTimer)(this._timer))}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};nE.BatchSpanProcessorBase=IA});var Gq=f(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.BatchSpanProcessor=void 0;var VPe=Bq(),CA=class extends VPe.BatchSpanProcessorBase{onShutdown(){}};rE.BatchSpanProcessor=CA});var Fq=f(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.RandomIdGenerator=void 0;var BPe=8,kq=16,PA=class{constructor(){this.generateTraceId=Hq(kq),this.generateSpanId=Hq(BPe)}};sE.RandomIdGenerator=PA;var oE=Buffer.allocUnsafe(kq);function Hq(t){return function(){for(let n=0;n<t/4;n++)oE.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(oE[n]>0);n++)n===t-1&&(oE[t-1]=1);return oE.toString("hex",0,t)}}});var jq=f(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.RandomIdGenerator=da.BatchSpanProcessor=void 0;var GPe=Gq();Object.defineProperty(da,"BatchSpanProcessor",{enumerable:!0,get:function(){return GPe.BatchSpanProcessor}});var HPe=Fq();Object.defineProperty(da,"RandomIdGenerator",{enumerable:!0,get:function(){return HPe.RandomIdGenerator}})});var iE=f(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.RandomIdGenerator=_a.BatchSpanProcessor=void 0;var $q=jq();Object.defineProperty(_a,"BatchSpanProcessor",{enumerable:!0,get:function(){return $q.BatchSpanProcessor}});Object.defineProperty(_a,"RandomIdGenerator",{enumerable:!0,get:function(){return $q.RandomIdGenerator}})});var yA=f(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.Tracer=void 0;var _t=(y(),I(x)),aE=oe(),kPe=dA(),FPe=NA(),jPe=iE(),MA=class{constructor(e,n,r){this._tracerProvider=r;let o=(0,FPe.mergeConfig)(n);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=n.idGenerator||new jPe.RandomIdGenerator,this.resource=r.resource,this.instrumentationLibrary=e}startSpan(e,n={},r=_t.context.active()){var o,s,i;n.root&&(r=_t.trace.deleteSpan(r));let a=_t.trace.getSpan(r);if((0,aE.isTracingSuppressed)(r))return _t.diag.debug("Instrumentation suppressed, returning Noop Span"),_t.trace.wrapSpanContext(_t.INVALID_SPAN_CONTEXT);let c=a?.spanContext(),u=this._idGenerator.generateSpanId(),l,p,d;!c||!_t.trace.isSpanContextValid(c)?l=this._idGenerator.generateTraceId():(l=c.traceId,p=c.traceState,d=c.spanId);let _=(o=n.kind)!==null&&o!==void 0?o:_t.SpanKind.INTERNAL,E=((s=n.links)!==null&&s!==void 0?s:[]).map(A=>({context:A.context,attributes:(0,aE.sanitizeAttributes)(A.attributes)})),S=(0,aE.sanitizeAttributes)(n.attributes),T=this._sampler.shouldSample(r,l,e,_,S,E);p=(i=T.traceState)!==null&&i!==void 0?i:p;let h=T.decision===_t.SamplingDecision.RECORD_AND_SAMPLED?_t.TraceFlags.SAMPLED:_t.TraceFlags.NONE,R={traceId:l,spanId:u,traceFlags:h,traceState:p};if(T.decision===_t.SamplingDecision.NOT_RECORD)return _t.diag.debug("Recording is off, propagating context in a non-recording span"),_t.trace.wrapSpanContext(R);let O=(0,aE.sanitizeAttributes)(Object.assign(S,T.attributes));return new kPe.Span(this,r,e,R,_,d,E,n.startTime,void 0,O)}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??_t.context.active(),u=this.startSpan(e,s,c),l=_t.trace.setSpan(c,u);return _t.context.with(l,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}getActiveSpanProcessor(){return this._tracerProvider.getActiveSpanProcessor()}};cE.Tracer=MA});var Yq=f(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.defaultServiceName=void 0;function $Pe(){return`unknown_service:${process.argv0}`}uE.defaultServiceName=$Pe});var qq=f(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.defaultServiceName=void 0;var YPe=Yq();Object.defineProperty(lE,"defaultServiceName",{enumerable:!0,get:function(){return YPe.defaultServiceName}})});var vA=f(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.defaultServiceName=void 0;var qPe=qq();Object.defineProperty(pE,"defaultServiceName",{enumerable:!0,get:function(){return qPe.defaultServiceName}})});var Kr=f(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0});dE.Resource=void 0;var Kq=(y(),I(x)),$s=(hn(),I(mn)),bA=oe(),KPe=vA(),yu=class t{constructor(e,n){var r;this._attributes=e,this.asyncAttributesPending=n!=null,this._syncAttributes=(r=this._attributes)!==null&&r!==void 0?r:{},this._asyncAttributesPromise=n?.then(o=>(this._attributes=Object.assign({},this._attributes,o),this.asyncAttributesPending=!1,o),o=>(Kq.diag.debug("a resource's async attributes promise rejected: %s",o),this.asyncAttributesPending=!1,{}))}static empty(){return t.EMPTY}static default(){return new t({[$s.SEMRESATTRS_SERVICE_NAME]:(0,KPe.defaultServiceName)(),[$s.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]:bA.SDK_INFO[$s.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE],[$s.SEMRESATTRS_TELEMETRY_SDK_NAME]:bA.SDK_INFO[$s.SEMRESATTRS_TELEMETRY_SDK_NAME],[$s.SEMRESATTRS_TELEMETRY_SDK_VERSION]:bA.SDK_INFO[$s.SEMRESATTRS_TELEMETRY_SDK_VERSION]})}get attributes(){var e;return this.asyncAttributesPending&&Kq.diag.error("Accessing resource attributes before async attributes settled"),(e=this._attributes)!==null&&e!==void 0?e:{}}async waitForAsyncAttributes(){this.asyncAttributesPending&&await this._asyncAttributesPromise}merge(e){var n;if(!e)return this;let r=Object.assign(Object.assign({},this._syncAttributes),(n=e._syncAttributes)!==null&&n!==void 0?n:e.attributes);if(!this._asyncAttributesPromise&&!e._asyncAttributesPromise)return new t(r);let o=Promise.all([this._asyncAttributesPromise,e._asyncAttributesPromise]).then(([s,i])=>{var a;return Object.assign(Object.assign(Object.assign(Object.assign({},this._syncAttributes),s),(a=e._syncAttributes)!==null&&a!==void 0?a:e.attributes),i)});return new t(r,o)}};dE.Resource=yu;yu.EMPTY=new yu({})});var LA=f(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.normalizeType=Ea.normalizeArch=void 0;var WPe=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Ea.normalizeArch=WPe;var XPe=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Ea.normalizeType=XPe});var EE=f(_E=>{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.execAsync=void 0;var zPe=require("child_process"),JPe=require("util");_E.execAsync=JPe.promisify(zPe.exec)});var Wq=f(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.getMachineId=void 0;var QPe=EE(),ZPe=(y(),I(x));async function eMe(){try{let e=(await(0,QPe.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
6
|
-
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return"";let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ZPe.diag.debug(`error reading machine id: ${t}`)}return""}fE.getMachineId=eMe});var Xq=f(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.getMachineId=void 0;var tMe=require("fs"),nMe=(y(),I(x));async function rMe(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await tMe.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){nMe.diag.debug(`error reading machine id: ${n}`)}return""}SE.getMachineId=rMe});var Jq=f(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.getMachineId=void 0;var oMe=require("fs"),sMe=EE(),zq=(y(),I(x));async function iMe(){try{return(await oMe.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){zq.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,sMe.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){zq.diag.debug(`error reading machine id: ${t}`)}return""}TE.getMachineId=iMe});var Zq=f(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.getMachineId=void 0;var Qq=require("process"),aMe=EE(),cMe=(y(),I(x));async function uMe(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";Qq.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in Qq.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,aMe.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){cMe.diag.debug(`error reading machine id: ${n}`)}return""}mE.getMachineId=uMe});var eK=f(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.getMachineId=void 0;var lMe=(y(),I(x));async function pMe(){return lMe.diag.debug("could not read machine-id: unsupported platform"),""}hE.getMachineId=pMe});var tK=f(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.getMachineId=void 0;var dMe=require("process"),fa;Wr.getMachineId=fa;switch(dMe.platform){case"darwin":Wr.getMachineId=fa=Wq().getMachineId;break;case"linux":Wr.getMachineId=fa=Xq().getMachineId;break;case"freebsd":Wr.getMachineId=fa=Jq().getMachineId;break;case"win32":Wr.getMachineId=fa=Zq().getMachineId;break;default:Wr.getMachineId=fa=eK().getMachineId}});var UA=f(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.hostDetectorSync=void 0;var DA=(hn(),I(mn)),_Me=Kr(),nK=require("os"),EMe=LA(),fMe=tK(),xA=class{detect(e){let n={[DA.SEMRESATTRS_HOST_NAME]:(0,nK.hostname)(),[DA.SEMRESATTRS_HOST_ARCH]:(0,EMe.normalizeArch)((0,nK.arch)())};return new _Me.Resource(n,this._getAsyncAttributes())}_getAsyncAttributes(){return(0,fMe.getMachineId)().then(e=>{let n={};return e&&(n[DA.SEMRESATTRS_HOST_ID]=e),n})}};gE.hostDetectorSync=new xA});var rK=f(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.hostDetector=void 0;var SMe=UA(),wA=class{detect(e){return Promise.resolve(SMe.hostDetectorSync.detect(e))}};AE.hostDetector=new wA});var BA=f(RE=>{"use strict";Object.defineProperty(RE,"__esModule",{value:!0});RE.osDetectorSync=void 0;var oK=(hn(),I(mn)),TMe=Kr(),sK=require("os"),mMe=LA(),VA=class{detect(e){let n={[oK.SEMRESATTRS_OS_TYPE]:(0,mMe.normalizeType)((0,sK.platform)()),[oK.SEMRESATTRS_OS_VERSION]:(0,sK.release)()};return new TMe.Resource(n)}};RE.osDetectorSync=new VA});var iK=f(OE=>{"use strict";Object.defineProperty(OE,"__esModule",{value:!0});OE.osDetector=void 0;var hMe=BA(),GA=class{detect(e){return Promise.resolve(hMe.osDetectorSync.detect(e))}};OE.osDetector=new GA});var kA=f(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.processDetectorSync=void 0;var gMe=(y(),I(x)),Xr=(hn(),I(mn)),AMe=Kr(),RMe=require("os"),HA=class{detect(e){let n={[Xr.SEMRESATTRS_PROCESS_PID]:process.pid,[Xr.SEMRESATTRS_PROCESS_EXECUTABLE_NAME]:process.title,[Xr.SEMRESATTRS_PROCESS_EXECUTABLE_PATH]:process.execPath,[Xr.SEMRESATTRS_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Xr.SEMRESATTRS_PROCESS_RUNTIME_VERSION]:process.versions.node,[Xr.SEMRESATTRS_PROCESS_RUNTIME_NAME]:"nodejs",[Xr.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Xr.SEMRESATTRS_PROCESS_COMMAND]=process.argv[1]);try{let r=RMe.userInfo();n[Xr.SEMRESATTRS_PROCESS_OWNER]=r.username}catch(r){gMe.diag.debug(`error obtaining process owner: ${r}`)}return new AMe.Resource(n)}};NE.processDetectorSync=new HA});var aK=f(IE=>{"use strict";Object.defineProperty(IE,"__esModule",{value:!0});IE.processDetector=void 0;var OMe=kA(),FA=class{detect(e){return Promise.resolve(OMe.processDetectorSync.detect(e))}};IE.processDetector=new FA});var cK=f(CE=>{"use strict";Object.defineProperty(CE,"__esModule",{value:!0});CE.serviceInstanceIdDetectorSync=void 0;var NMe=(hn(),I(mn)),IMe=Kr(),CMe=require("crypto"),jA=class{detect(e){let n={[NMe.SEMRESATTRS_SERVICE_INSTANCE_ID]:(0,CMe.randomUUID)()};return new IMe.Resource(n)}};CE.serviceInstanceIdDetectorSync=new jA});var uK=f(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.serviceInstanceIdDetectorSync=Ct.processDetectorSync=Ct.processDetector=Ct.osDetectorSync=Ct.osDetector=Ct.hostDetectorSync=Ct.hostDetector=void 0;var PMe=rK();Object.defineProperty(Ct,"hostDetector",{enumerable:!0,get:function(){return PMe.hostDetector}});var MMe=UA();Object.defineProperty(Ct,"hostDetectorSync",{enumerable:!0,get:function(){return MMe.hostDetectorSync}});var yMe=iK();Object.defineProperty(Ct,"osDetector",{enumerable:!0,get:function(){return yMe.osDetector}});var vMe=BA();Object.defineProperty(Ct,"osDetectorSync",{enumerable:!0,get:function(){return vMe.osDetectorSync}});var bMe=aK();Object.defineProperty(Ct,"processDetector",{enumerable:!0,get:function(){return bMe.processDetector}});var LMe=kA();Object.defineProperty(Ct,"processDetectorSync",{enumerable:!0,get:function(){return LMe.processDetectorSync}});var DMe=cK();Object.defineProperty(Ct,"serviceInstanceIdDetectorSync",{enumerable:!0,get:function(){return DMe.serviceInstanceIdDetectorSync}})});var lK=f(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.serviceInstanceIdDetectorSync=Pt.processDetectorSync=Pt.processDetector=Pt.osDetectorSync=Pt.osDetector=Pt.hostDetectorSync=Pt.hostDetector=void 0;var Ys=uK();Object.defineProperty(Pt,"hostDetector",{enumerable:!0,get:function(){return Ys.hostDetector}});Object.defineProperty(Pt,"hostDetectorSync",{enumerable:!0,get:function(){return Ys.hostDetectorSync}});Object.defineProperty(Pt,"osDetector",{enumerable:!0,get:function(){return Ys.osDetector}});Object.defineProperty(Pt,"osDetectorSync",{enumerable:!0,get:function(){return Ys.osDetectorSync}});Object.defineProperty(Pt,"processDetector",{enumerable:!0,get:function(){return Ys.processDetector}});Object.defineProperty(Pt,"processDetectorSync",{enumerable:!0,get:function(){return Ys.processDetectorSync}});Object.defineProperty(Pt,"serviceInstanceIdDetectorSync",{enumerable:!0,get:function(){return Ys.serviceInstanceIdDetectorSync}})});var qA=f(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.browserDetectorSync=void 0;var PE=(hn(),I(mn)),xMe=(y(),I(x)),$A=Kr(),YA=class{detect(e){var n,r,o;if(!(typeof navigator<"u"&&((r=(n=global.process)===null||n===void 0?void 0:n.versions)===null||r===void 0?void 0:r.node)===void 0&&((o=global.Bun)===null||o===void 0?void 0:o.version)===void 0))return $A.Resource.empty();let i={[PE.SEMRESATTRS_PROCESS_RUNTIME_NAME]:"browser",[PE.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION]:"Web Browser",[PE.SEMRESATTRS_PROCESS_RUNTIME_VERSION]:navigator.userAgent};return this._getResourceAttributes(i,e)}_getResourceAttributes(e,n){return e[PE.SEMRESATTRS_PROCESS_RUNTIME_VERSION]===""?(xMe.diag.debug("BrowserDetector failed: Unable to find required browser resources. "),$A.Resource.empty()):new $A.Resource(Object.assign({},e))}};ME.browserDetectorSync=new YA});var pK=f(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.browserDetector=void 0;var UMe=qA(),KA=class{detect(e){return Promise.resolve(UMe.browserDetectorSync.detect(e))}};yE.browserDetector=new KA});var XA=f(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE.envDetectorSync=void 0;var wMe=(y(),I(x)),VMe=oe(),BMe=(hn(),I(mn)),GMe=Kr(),WA=class{constructor(){this._MAX_LENGTH=255,this._COMMA_SEPARATOR=",",this._LABEL_KEY_VALUE_SPLITTER="=",this._ERROR_MESSAGE_INVALID_CHARS="should be a ASCII string with a length greater than 0 and not exceed "+this._MAX_LENGTH+" characters.",this._ERROR_MESSAGE_INVALID_VALUE="should be a ASCII string with a length not exceed "+this._MAX_LENGTH+" characters."}detect(e){let n={},r=(0,VMe.getEnv)(),o=r.OTEL_RESOURCE_ATTRIBUTES,s=r.OTEL_SERVICE_NAME;if(o)try{let i=this._parseResourceAttributes(o);Object.assign(n,i)}catch(i){wMe.diag.debug(`EnvDetector failed: ${i.message}`)}return s&&(n[BMe.SEMRESATTRS_SERVICE_NAME]=s),new GMe.Resource(n)}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR,-1);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[i,a]=s;if(i=i.trim(),a=a.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(i))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(a))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);n[i]=decodeURIComponent(a)}return n}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<33||r===44||r===59||r===92||r>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}};vE.envDetectorSync=new WA});var dK=f(bE=>{"use strict";Object.defineProperty(bE,"__esModule",{value:!0});bE.envDetector=void 0;var HMe=XA(),zA=class{detect(e){return Promise.resolve(HMe.envDetectorSync.detect(e))}};bE.envDetector=new zA});var _K=f(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.envDetectorSync=Ae.browserDetectorSync=Ae.envDetector=Ae.browserDetector=Ae.serviceInstanceIdDetectorSync=Ae.processDetectorSync=Ae.processDetector=Ae.osDetectorSync=Ae.osDetector=Ae.hostDetectorSync=Ae.hostDetector=void 0;var qs=lK();Object.defineProperty(Ae,"hostDetector",{enumerable:!0,get:function(){return qs.hostDetector}});Object.defineProperty(Ae,"hostDetectorSync",{enumerable:!0,get:function(){return qs.hostDetectorSync}});Object.defineProperty(Ae,"osDetector",{enumerable:!0,get:function(){return qs.osDetector}});Object.defineProperty(Ae,"osDetectorSync",{enumerable:!0,get:function(){return qs.osDetectorSync}});Object.defineProperty(Ae,"processDetector",{enumerable:!0,get:function(){return qs.processDetector}});Object.defineProperty(Ae,"processDetectorSync",{enumerable:!0,get:function(){return qs.processDetectorSync}});Object.defineProperty(Ae,"serviceInstanceIdDetectorSync",{enumerable:!0,get:function(){return qs.serviceInstanceIdDetectorSync}});var kMe=pK();Object.defineProperty(Ae,"browserDetector",{enumerable:!0,get:function(){return kMe.browserDetector}});var FMe=dK();Object.defineProperty(Ae,"envDetector",{enumerable:!0,get:function(){return FMe.envDetector}});var jMe=qA();Object.defineProperty(Ae,"browserDetectorSync",{enumerable:!0,get:function(){return jMe.browserDetectorSync}});var $Me=XA();Object.defineProperty(Ae,"envDetectorSync",{enumerable:!0,get:function(){return $Me.envDetectorSync}})});var EK=f(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.isPromiseLike=void 0;var YMe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";LE.isPromiseLike=YMe});var SK=f(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.detectResourcesSync=Ta.detectResources=void 0;var vu=Kr(),Sa=(y(),I(x)),qMe=EK(),KMe=async(t={})=>{let e=await Promise.all((t.detectors||[]).map(async n=>{try{let r=await n.detect(t);return Sa.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return Sa.diag.debug(`${n.constructor.name} failed: ${r.message}`),vu.Resource.empty()}}));return fK(e),e.reduce((n,r)=>n.merge(r),vu.Resource.empty())};Ta.detectResources=KMe;var WMe=(t={})=>{var e;let n=((e=t.detectors)!==null&&e!==void 0?e:[]).map(o=>{try{let s=o.detect(t),i;if((0,qMe.isPromiseLike)(s)){let a=async()=>{var c;let u=await s;return await((c=u.waitForAsyncAttributes)===null||c===void 0?void 0:c.call(u)),u.attributes};i=new vu.Resource({},a())}else i=s;return i.waitForAsyncAttributes?i.waitForAsyncAttributes().then(()=>Sa.diag.debug(`${o.constructor.name} found resource.`,i)):Sa.diag.debug(`${o.constructor.name} found resource.`,i),i}catch(s){return Sa.diag.error(`${o.constructor.name} failed: ${s.message}`),vu.Resource.empty()}}),r=n.reduce((o,s)=>o.merge(s),vu.Resource.empty());return r.waitForAsyncAttributes&&r.waitForAsyncAttributes().then(()=>{fK(n)}),r};Ta.detectResourcesSync=WMe;var fK=t=>{t.forEach(e=>{if(Object.keys(e.attributes).length>0){let n=JSON.stringify(e.attributes,null,4);Sa.diag.verbose(n)}})}});var JA=f(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.detectResources=se.detectResourcesSync=se.serviceInstanceIdDetectorSync=se.processDetectorSync=se.processDetector=se.osDetectorSync=se.osDetector=se.hostDetectorSync=se.hostDetector=se.envDetectorSync=se.envDetector=se.browserDetectorSync=se.browserDetector=se.defaultServiceName=se.Resource=void 0;var XMe=Kr();Object.defineProperty(se,"Resource",{enumerable:!0,get:function(){return XMe.Resource}});var zMe=vA();Object.defineProperty(se,"defaultServiceName",{enumerable:!0,get:function(){return zMe.defaultServiceName}});var Jn=_K();Object.defineProperty(se,"browserDetector",{enumerable:!0,get:function(){return Jn.browserDetector}});Object.defineProperty(se,"browserDetectorSync",{enumerable:!0,get:function(){return Jn.browserDetectorSync}});Object.defineProperty(se,"envDetector",{enumerable:!0,get:function(){return Jn.envDetector}});Object.defineProperty(se,"envDetectorSync",{enumerable:!0,get:function(){return Jn.envDetectorSync}});Object.defineProperty(se,"hostDetector",{enumerable:!0,get:function(){return Jn.hostDetector}});Object.defineProperty(se,"hostDetectorSync",{enumerable:!0,get:function(){return Jn.hostDetectorSync}});Object.defineProperty(se,"osDetector",{enumerable:!0,get:function(){return Jn.osDetector}});Object.defineProperty(se,"osDetectorSync",{enumerable:!0,get:function(){return Jn.osDetectorSync}});Object.defineProperty(se,"processDetector",{enumerable:!0,get:function(){return Jn.processDetector}});Object.defineProperty(se,"processDetectorSync",{enumerable:!0,get:function(){return Jn.processDetectorSync}});Object.defineProperty(se,"serviceInstanceIdDetectorSync",{enumerable:!0,get:function(){return Jn.serviceInstanceIdDetectorSync}});var TK=SK();Object.defineProperty(se,"detectResourcesSync",{enumerable:!0,get:function(){return TK.detectResourcesSync}});Object.defineProperty(se,"detectResources",{enumerable:!0,get:function(){return TK.detectResources}})});var mK=f(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.MultiSpanProcessor=void 0;var JMe=oe(),QA=class{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,JMe.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}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)})}};DE.MultiSpanProcessor=QA});var eR=f(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.NoopSpanProcessor=void 0;var ZA=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};xE.NoopSpanProcessor=ZA});var AK=f(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.BasicTracerProvider=Ks.ForceFlushState=void 0;var ma=(y(),I(x)),ga=oe(),hK=JA(),QMe=yA(),ZMe=RA(),gK=mK(),eye=eR(),tye=iE(),nye=NA(),ha;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(ha=Ks.ForceFlushState||(Ks.ForceFlushState={}));var bu=class{constructor(e={}){var n,r;this._registeredSpanProcessors=[],this._tracers=new Map;let o=(0,ga.merge)({},(0,ZMe.loadDefaultConfig)(),(0,nye.reconfigureLimits)(e));if(this.resource=(n=o.resource)!==null&&n!==void 0?n:hK.Resource.empty(),o.mergeResourceWithDefaults&&(this.resource=hK.Resource.default().merge(this.resource)),this._config=Object.assign({},o,{resource:this.resource}),!((r=e.spanProcessors)===null||r===void 0)&&r.length)this._registeredSpanProcessors=[...e.spanProcessors],this.activeSpanProcessor=new gK.MultiSpanProcessor(this._registeredSpanProcessors);else{let s=this._buildExporterFromEnv();if(s!==void 0){let i=new tye.BatchSpanProcessor(s);this.activeSpanProcessor=i}else this.activeSpanProcessor=new eye.NoopSpanProcessor}}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new QMe.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this)),this._tracers.get(o)}addSpanProcessor(e){this._registeredSpanProcessors.length===0&&this.activeSpanProcessor.shutdown().catch(n=>ma.diag.error("Error while trying to shutdown current span processor",n)),this._registeredSpanProcessors.push(e),this.activeSpanProcessor=new gK.MultiSpanProcessor(this._registeredSpanProcessors)}getActiveSpanProcessor(){return this.activeSpanProcessor}register(e={}){ma.trace.setGlobalTracerProvider(this),e.propagator===void 0&&(e.propagator=this._buildPropagatorFromEnv()),e.contextManager&&ma.context.setGlobalContextManager(e.contextManager),e.propagator&&ma.propagation.setGlobalPropagator(e.propagator)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._registeredSpanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=ha.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==ha.timeout&&(s=ha.resolved,o(s))}).catch(a=>{clearTimeout(i),s=ha.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==ha.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this.activeSpanProcessor.shutdown()}_getPropagator(e){var n;return(n=this.constructor._registeredPropagators.get(e))===null||n===void 0?void 0:n()}_getSpanExporter(e){var n;return(n=this.constructor._registeredExporters.get(e))===null||n===void 0?void 0:n()}_buildPropagatorFromEnv(){let e=Array.from(new Set((0,ga.getEnv)().OTEL_PROPAGATORS)),r=e.map(o=>{let s=this._getPropagator(o);return s||ma.diag.warn(`Propagator "${o}" requested through environment variable is unavailable.`),s}).reduce((o,s)=>(s&&o.push(s),o),[]);if(r.length!==0)return e.length===1?r[0]:new ga.CompositePropagator({propagators:r})}_buildExporterFromEnv(){let e=(0,ga.getEnv)().OTEL_TRACES_EXPORTER;if(e==="none"||e==="")return;let n=this._getSpanExporter(e);return n||ma.diag.error(`Exporter "${e}" requested through environment variable is unavailable.`),n}};Ks.BasicTracerProvider=bu;bu._registeredPropagators=new Map([["tracecontext",()=>new ga.W3CTraceContextPropagator],["baggage",()=>new ga.W3CBaggagePropagator]]);bu._registeredExporters=new Map});var RK=f(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.ConsoleSpanExporter=void 0;var tR=oe(),nR=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){var n;return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationLibrary,traceId:e.spanContext().traceId,parentId:e.parentSpanId,traceState:(n=e.spanContext().traceState)===null||n===void 0?void 0:n.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,tR.hrTimeToMicroseconds)(e.startTime),duration:(0,tR.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:tR.ExportResultCode.SUCCESS})}};UE.ConsoleSpanExporter=nR});var NK=f(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.InMemorySpanExporter=void 0;var OK=oe(),rR=class{constructor(){this._finishedSpans=[],this._stopped=!1}export(e,n){if(this._stopped)return n({code:OK.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:OK.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};wE.InMemorySpanExporter=rR});var IK=f(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.SimpleSpanProcessor=void 0;var rye=(y(),I(x)),Aa=oe(),oR=class{constructor(e){this._exporter=e,this._shutdownOnce=new Aa.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,n){}onEnd(e){var n,r;if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&rye.TraceFlags.SAMPLED)===0)return;let o=()=>Aa.internal._export(this._exporter,[e]).then(s=>{var i;s.code!==Aa.ExportResultCode.SUCCESS&&(0,Aa.globalErrorHandler)((i=s.error)!==null&&i!==void 0?i:new Error(`SimpleSpanProcessor: span export failed (status ${s})`))}).catch(s=>{(0,Aa.globalErrorHandler)(s)});if(e.resource.asyncAttributesPending){let s=(r=(n=e.resource).waitForAsyncAttributes)===null||r===void 0?void 0:r.call(n).then(()=>(s!=null&&this._unresolvedExports.delete(s),o()),i=>(0,Aa.globalErrorHandler)(i));s!=null&&this._unresolvedExports.add(s)}else o()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};VE.SimpleSpanProcessor=oR});var sR=f(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.Span=ie.SamplingDecision=ie.TraceIdRatioBasedSampler=ie.ParentBasedSampler=ie.AlwaysOnSampler=ie.AlwaysOffSampler=ie.NoopSpanProcessor=ie.SimpleSpanProcessor=ie.InMemorySpanExporter=ie.ConsoleSpanExporter=ie.RandomIdGenerator=ie.BatchSpanProcessor=ie.ForceFlushState=ie.BasicTracerProvider=ie.Tracer=void 0;var oye=yA();Object.defineProperty(ie,"Tracer",{enumerable:!0,get:function(){return oye.Tracer}});var CK=AK();Object.defineProperty(ie,"BasicTracerProvider",{enumerable:!0,get:function(){return CK.BasicTracerProvider}});Object.defineProperty(ie,"ForceFlushState",{enumerable:!0,get:function(){return CK.ForceFlushState}});var PK=iE();Object.defineProperty(ie,"BatchSpanProcessor",{enumerable:!0,get:function(){return PK.BatchSpanProcessor}});Object.defineProperty(ie,"RandomIdGenerator",{enumerable:!0,get:function(){return PK.RandomIdGenerator}});var sye=RK();Object.defineProperty(ie,"ConsoleSpanExporter",{enumerable:!0,get:function(){return sye.ConsoleSpanExporter}});var iye=NK();Object.defineProperty(ie,"InMemorySpanExporter",{enumerable:!0,get:function(){return iye.InMemorySpanExporter}});var aye=IK();Object.defineProperty(ie,"SimpleSpanProcessor",{enumerable:!0,get:function(){return aye.SimpleSpanProcessor}});var cye=eR();Object.defineProperty(ie,"NoopSpanProcessor",{enumerable:!0,get:function(){return cye.NoopSpanProcessor}});var uye=X_();Object.defineProperty(ie,"AlwaysOffSampler",{enumerable:!0,get:function(){return uye.AlwaysOffSampler}});var lye=J_();Object.defineProperty(ie,"AlwaysOnSampler",{enumerable:!0,get:function(){return lye.AlwaysOnSampler}});var pye=TA();Object.defineProperty(ie,"ParentBasedSampler",{enumerable:!0,get:function(){return pye.ParentBasedSampler}});var dye=hA();Object.defineProperty(ie,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return dye.TraceIdRatioBasedSampler}});var _ye=Mu();Object.defineProperty(ie,"SamplingDecision",{enumerable:!0,get:function(){return _ye.SamplingDecision}});var Eye=dA();Object.defineProperty(ie,"Span",{enumerable:!0,get:function(){return Eye.Span}})});var DR=f(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.AbstractAsyncHooksContextManager=void 0;var lbe=require("events"),pbe=["addListener","on","once","prependListener","prependOnceListener"],LR=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,n){return n instanceof lbe.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),pbe.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){var i;let a=(i=r._getPatchMap(e))===null||i===void 0?void 0:i[o];if(a===void 0)return n.call(this,o,s);let c=a.get(s);return n.call(this,o,c||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 u=o.bind(r,i);c.set(i,u),o._wrapped=!0;try{return n.call(this,s,u)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}};KE.AbstractAsyncHooksContextManager=LR});var kW=f(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});WE.AsyncHooksContextManager=void 0;var dbe=(y(),I(x)),_be=require("async_hooks"),Ebe=DR(),xR=class extends Ebe.AbstractAsyncHooksContextManager{constructor(){super(),this._contexts=new Map,this._stack=[],this._asyncHook=_be.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(){var e;return(e=this._stack[this._stack.length-1])!==null&&e!==void 0?e:dbe.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()}};WE.AsyncHooksContextManager=xR});var FW=f(XE=>{"use strict";Object.defineProperty(XE,"__esModule",{value:!0});XE.AsyncLocalStorageContextManager=void 0;var fbe=(y(),I(x)),Sbe=require("async_hooks"),Tbe=DR(),UR=class extends Tbe.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new Sbe.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:fbe.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}};XE.AsyncLocalStorageContextManager=UR});var jW=f(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.AsyncLocalStorageContextManager=ya.AsyncHooksContextManager=void 0;var mbe=kW();Object.defineProperty(ya,"AsyncHooksContextManager",{enumerable:!0,get:function(){return mbe.AsyncHooksContextManager}});var hbe=FW();Object.defineProperty(ya,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return hbe.AsyncLocalStorageContextManager}})});var u2=f(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.PACKAGE_NAME=va.PACKAGE_VERSION=void 0;va.PACKAGE_VERSION="0.10.1";va.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var l2=f(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.SemanticAttributes=void 0;rf.SemanticAttributes={HTTP_CONNECTION_STATE:"http.connection.state",ERROR_TYPE:"error.type",HTTP_REQUEST_BODY_SIZE:"http.request.body.size",HTTP_REQUEST_METHOD:"http.request.method",HTTP_REQUEST_METHOD_ORIGINAL:"http.request.method_original",HTTP_REQUEST_RESEND_COUNT:"http.request.resend_count",HTTP_RESPONSE_BODY_SIZE:"http.response.body.size",HTTP_RESPONSE_STATUS_CODE:"http.response.status_code",HTTP_ROUTE:"http.route",NETWORK_PEER_ADDRESS:"network.peer.address",NETWORK_PEER_PORT:"network.peer.port",NETWORK_PROTOCOL_NAME:"network.protocol.name",NETWORK_PROTOCOL_VERSION:"network.protocol.version",SERVER_ADDRESS:"server.address",SERVER_PORT:"server.port",URL_FULL:"url.full",URL_PATH:"url.path",URL_QUERY:"url.query",URL_SCHEME:"url.scheme",USER_AGENT_ORIGINAL:"user_agent.original"}});var d2=f(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.UndiciInstrumentation=void 0;var $u=require("diagnostics_channel"),jbe=require("url"),Yu=te(),_n=(y(),I(x)),p2=u2(),Ze=l2(),of=oe(),jR=class extends Yu.InstrumentationBase{constructor(e={}){super(p2.PACKAGE_NAME,p2.PACKAGE_VERSION,e),this._recordFromReq=new WeakMap}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("http.client.request.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:_n.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){var r;let[o,s]=process.version.replace("v","").split(".").map(c=>Number(c)),i=o>18||o===18&&s>=19,a;if(i)(r=$u.subscribe)===null||r===void 0||r.call($u,e,n),a=()=>{var c;return(c=$u.unsubscribe)===null||c===void 0?void 0:c.call($u,e,n)};else{let c=$u.channel(e);c.subscribe(n),a=()=>c.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:a})}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,Yu.safeExecuteInTheMiddle)(()=>{var A;return!r||e.method==="CONNECT"||((A=n.ignoreRequestHook)===null||A===void 0?void 0:A.call(n,e))},A=>A&&this._diag.error("caught ignoreRequestHook error: ",A),!0))return;let s=(0,of.hrTime)(),i;try{i=new jbe.URL(e.path,e.origin)}catch(A){this._diag.warn("could not determine url.full:",A);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),u={[Ze.SemanticAttributes.HTTP_REQUEST_METHOD]:c,[Ze.SemanticAttributes.HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[Ze.SemanticAttributes.URL_FULL]:i.toString(),[Ze.SemanticAttributes.URL_PATH]:i.pathname,[Ze.SemanticAttributes.URL_QUERY]:i.search,[Ze.SemanticAttributes.URL_SCHEME]:a},l={https:"443",http:"80"},p=i.hostname,d=i.port||l[a];u[Ze.SemanticAttributes.SERVER_ADDRESS]=p,d&&!isNaN(Number(d))&&(u[Ze.SemanticAttributes.SERVER_PORT]=Number(d));let _;if(Array.isArray(e.headers)){let A=e.headers.findIndex(M=>M.toLowerCase()==="user-agent");A>=0&&(_=e.headers[A+1])}else if(typeof e.headers=="string"){let M=e.headers.split(`\r
|
|
7
|
-
`).find(v=>v.toLowerCase().startsWith("user-agent"));_=M&&M.substring(M.indexOf(":")+1).trim()}_&&(u[Ze.SemanticAttributes.USER_AGENT_ORIGINAL]=_);let E=(0,Yu.safeExecuteInTheMiddle)(()=>{var A;return(A=n.startSpanHook)===null||A===void 0?void 0:A.call(n,e)},A=>A&&this._diag.error("caught startSpanHook error: ",A),!0);E&&Object.entries(E).forEach(([A,M])=>{u[A]=M});let S=_n.context.active(),T=_n.trace.getSpan(S),h;n.requireParentforSpans&&(!T||!_n.trace.isSpanContextValid(T.spanContext()))?h=_n.trace.wrapSpanContext(_n.INVALID_SPAN_CONTEXT):h=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:_n.SpanKind.CLIENT,attributes:u},S),(0,Yu.safeExecuteInTheMiddle)(()=>{var A;return(A=n.requestHook)===null||A===void 0?void 0:A.call(n,h,e)},A=>A&&this._diag.error("caught requestHook error: ",A),!0);let R=_n.trace.setSpan(_n.context.active(),h),O={};_n.propagation.inject(R,O);let N=Object.entries(O);for(let A=0;A<N.length;A++){let[M,v]=N[A];typeof e.addHeader=="function"?e.addHeader(M,v):typeof e.headers=="string"?e.headers+=`${M}: ${v}\r
|
|
8
|
-
`:Array.isArray(e.headers)&&e.headers.push(M,v)}this._recordFromReq.set(e,{span:h,attributes:u,startTime:s})}onRequestHeaders({request:e,socket:n}){var r;let o=this._recordFromReq.get(e);if(!o)return;let s=this.getConfig(),{span:i}=o,{remoteAddress:a,remotePort:c}=n,u={[Ze.SemanticAttributes.NETWORK_PEER_ADDRESS]:a,[Ze.SemanticAttributes.NETWORK_PEER_PORT]:c};if(!((r=s.headersToSpanAttributes)===null||r===void 0)&&r.requestHeaders){let l=new Set(s.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=Array.isArray(e.headers)?e.headers:e.headers.split(`\r
|
|
9
|
-
`);p.forEach((d,_)=>{let E=d.indexOf(":"),S=E!==-1,T=(S?d.substring(0,E):d).toLowerCase(),h=S?d.substring(E+1):p[_+1];l.has(T)&&(u[`http.request.header.${T}`]=h.trim())})}i.setAttributes(u)}onResponseHeaders({request:e,response:n}){var r,o;let s=this._recordFromReq.get(e);if(!s)return;let{span:i,attributes:a}=s,c={[Ze.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE]:n.statusCode},u=this.getConfig();(0,Yu.safeExecuteInTheMiddle)(()=>{var p;return(p=u.responseHook)===null||p===void 0?void 0:p.call(u,i,{request:e,response:n})},p=>p&&this._diag.error("caught responseHook error: ",p),!0);let l=new Set;!((r=u.headersToSpanAttributes)===null||r===void 0)&&r.responseHeaders&&((o=u.headersToSpanAttributes)===null||o===void 0||o.responseHeaders.forEach(p=>l.add(p.toLowerCase())));for(let p=0;p<n.headers.length;p=p+2){let d=n.headers[p].toString().toLowerCase(),_=n.headers[p+1];if(l.has(d)&&(c[`http.response.header.${d}`]=_.toString()),d==="content-length"){let E=Number(_.toString());isNaN(E)||(c["http.response.header.content-length"]=E)}}i.setAttributes(c),i.setStatus({code:n.statusCode>=400?_n.SpanStatusCode.ERROR:_n.SpanStatusCode.UNSET}),s.attributes=Object.assign(a,c)}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:_n.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[Ze.SemanticAttributes.ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[Ze.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,Ze.SemanticAttributes.HTTP_REQUEST_METHOD,Ze.SemanticAttributes.SERVER_ADDRESS,Ze.SemanticAttributes.SERVER_PORT,Ze.SemanticAttributes.URL_SCHEME,Ze.SemanticAttributes.ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,of.hrTimeToMilliseconds)((0,of.hrTimeDuration)(n,(0,of.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};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};sf.UndiciInstrumentation=jR});var E2=f(_2=>{"use strict";Object.defineProperty(_2,"__esModule",{value:!0})});var S2=f(Ho=>{"use strict";var $be=Ho&&Ho.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),f2=Ho&&Ho.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$be(e,t,n)};Object.defineProperty(Ho,"__esModule",{value:!0});f2(d2(),Ho);f2(E2(),Ho)});var af=f(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.ExpressLayerType=void 0;var Jbe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Jbe=qu.ExpressLayerType||(qu.ExpressLayerType={}))});var cf=f(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AttributeNames=void 0;var Qbe;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Qbe=Ku.AttributeNames||(Ku.AttributeNames={}))});var $R=f(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba._LAYERS_STORE_PROPERTY=ba.kLayerPatched=void 0;ba.kLayerPatched=Symbol("express-layer-patched");ba._LAYERS_STORE_PROPERTY="__ot_middlewares"});var A2=f(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getLayerPath=Mt.asErrorAndMessage=Mt.isLayerIgnored=Mt.getLayerMetadata=Mt.getRouterPath=Mt.storeLayerPath=void 0;var YR=af(),La=cf(),qR=$R(),Zbe=(t,e)=>{Array.isArray(t[qR._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,qR._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e!==void 0&&t[qR._LAYERS_STORE_PROPERTY].push(e)};Mt.storeLayerPath=Zbe;var eLe=(t,e)=>{var n,r,o,s;let i=(r=(n=e.handle)===null||n===void 0?void 0:n.stack)===null||r===void 0?void 0:r[0];return!((o=i?.route)===null||o===void 0)&&o.path?`${t}${i.route.path}`:!((s=i?.handle)===null||s===void 0)&&s.stack?(0,Mt.getRouterPath)(t,i):t};Mt.getRouterPath=eLe;var tLe=(t,e,n)=>{var r;if(e.name==="router"){let o=(0,Mt.getRouterPath)("",e),s=o||n||t||"/";return{attributes:{[La.AttributeNames.EXPRESS_NAME]:s,[La.AttributeNames.EXPRESS_TYPE]:YR.ExpressLayerType.ROUTER},name:`router - ${s}`}}else return e.name==="bound dispatch"?{attributes:{[La.AttributeNames.EXPRESS_NAME]:(r=t||n)!==null&&r!==void 0?r:"request handler",[La.AttributeNames.EXPRESS_TYPE]:YR.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[La.AttributeNames.EXPRESS_NAME]:e.name,[La.AttributeNames.EXPRESS_TYPE]:YR.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};Mt.getLayerMetadata=tLe;var nLe=(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")},rLe=(t,e,n)=>{var r;if(Array.isArray(n?.ignoreLayersType)&&(!((r=n?.ignoreLayersType)===null||r===void 0)&&r.includes(e)))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let o of n.ignoreLayers)if(nLe(t,o))return!0}catch{}return!1};Mt.isLayerIgnored=rLe;var oLe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];Mt.asErrorAndMessage=oLe;var sLe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>g2(n)||"").join(","):g2(e)};Mt.getLayerPath=sLe;var g2=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()}});var R2=f(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.PACKAGE_NAME=Da.PACKAGE_VERSION=void 0;Da.PACKAGE_VERSION="0.47.1";Da.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var P2=f(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.ExpressInstrumentation=void 0;var O2=oe(),Js=(y(),I(x)),N2=af(),I2=cf(),ko=A2(),C2=R2(),xa=te(),iLe=(de(),I(je)),Wu=$R(),KR=class extends xa.InstrumentationBase{constructor(e={}){super(C2.PACKAGE_NAME,C2.PACKAGE_VERSION,e)}init(){return[new xa.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <5"],e=>{let n=e.Router;return(0,xa.isWrapped)(n.route)&&this._unwrap(n,"route"),this._wrap(n,"route",this._getRoutePatch()),(0,xa.isWrapped)(n.use)&&this._unwrap(n,"use"),this._wrap(n,"use",this._getRouterUsePatch()),(0,xa.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch()),e},e=>{if(e===void 0)return;let n=e.Router;this._unwrap(n,"route"),this._unwrap(n,"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,ko.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,ko.getLayerPath)(o)),s}}}_getAppUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this._router.stack[this._router.stack.length-1];return e._applyPatch(i,(0,ko.getLayerPath)(o)),s}}}_applyPatch(e,n){let r=this;e[Wu.kLayerPatched]!==!0&&(e[Wu.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){(0,ko.storeLayerPath)(i,n);let c=i[Wu._LAYERS_STORE_PROPERTY].filter(N=>N!=="/"&&N!=="/*").join("").replace(/\/{2,}/g,"/"),u={[iLe.SEMATTRS_HTTP_ROUTE]:c.length>0?c:"/"},l=(0,ko.getLayerMetadata)(c,e,n),p=l.attributes[I2.AttributeNames.EXPRESS_TYPE],d=(0,O2.getRPCMetadata)(Js.context.active());if(d?.type===O2.RPCType.HTTP&&(d.route=c||"/"),(0,ko.isLayerIgnored)(l.name,p,r.getConfig()))return p===N2.ExpressLayerType.MIDDLEWARE&&i[Wu._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Js.trace.getSpan(Js.context.active())===void 0)return o.apply(this,arguments);let _=r._getSpanName({request:i,layerType:p,route:c},l.name),E=r.tracer.startSpan(_,{attributes:Object.assign(u,l.attributes)}),{requestHook:S}=r.getConfig();S&&(0,xa.safeExecuteInTheMiddle)(()=>S(E,{request:i,layerType:p,route:c}),N=>{N&&Js.diag.error("express instrumentation: request hook failed",N)},!0);let T=!1;l.attributes[I2.AttributeNames.EXPRESS_TYPE]!==N2.ExpressLayerType.MIDDLEWARE&&(E.end(),T=!0);let h=()=>{T===!1&&(T=!0,E.end())},R=Array.from(arguments),O=R.findIndex(N=>typeof N=="function");O>=0&&(arguments[O]=function(){var N;let A=arguments[0],M=![void 0,null,"route","router"].includes(A);if(!T&&M){let[X,q]=(0,ko.asErrorAndMessage)(A);E.recordException(X),E.setStatus({code:Js.SpanStatusCode.ERROR,message:q})}return T===!1&&(T=!0,(N=i.res)===null||N===void 0||N.removeListener("finish",h),E.end()),i.route&&M||i[Wu._LAYERS_STORE_PROPERTY].pop(),R[O].apply(this,arguments)});try{return o.apply(this,arguments)}catch(N){let[A,M]=(0,ko.asErrorAndMessage)(N);throw E.recordException(A),E.setStatus({code:Js.SpanStatusCode.ERROR,message:M}),N}finally{T||a.once("finish",h)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){var r;let{spanNameHook:o}=this.getConfig();if(!(o instanceof Function))return n;try{return(r=o(e,n))!==null&&r!==void 0?r:n}catch(s){return Js.diag.error("express instrumentation: error calling span name rewrite hook",s),n}}};uf.ExpressInstrumentation=KR});var y2=f(M2=>{"use strict";Object.defineProperty(M2,"__esModule",{value:!0})});var v2=f(Cr=>{"use strict";var aLe=Cr&&Cr.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),lf=Cr&&Cr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aLe(e,t,n)};Object.defineProperty(Cr,"__esModule",{value:!0});lf(P2(),Cr);lf(af(),Cr);lf(cf(),Cr);lf(y2(),Cr)});var q2=f((A3e,Y2)=>{"use strict";Y2.exports=j2;function j2(t,e,n){t instanceof RegExp&&(t=F2(t,n)),e instanceof RegExp&&(e=F2(e,n));var r=$2(t,e,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+t.length,r[1]),post:n.slice(r[1]+e.length)}}function F2(t,e){var n=e.match(t);return n?n[0]:null}j2.range=$2;function $2(t,e,n){var r,o,s,i,a,c=n.indexOf(t),u=n.indexOf(e,c+1),l=c;if(c>=0&&u>0){if(t===e)return[c,u];for(r=[],s=n.length;l>=0&&!a;)l==c?(r.push(l),c=n.indexOf(t,l+1)):r.length==1?a=[r.pop(),u]:(o=r.pop(),o<s&&(s=o,i=u),u=n.indexOf(e,l+1)),l=c<u&&c>=0?c:u;r.length&&(a=[s,i])}return a}});var e4=f((R3e,Z2)=>{var K2=q2();Z2.exports=fLe;var W2="\0SLASH"+Math.random()+"\0",X2="\0OPEN"+Math.random()+"\0",ZR="\0CLOSE"+Math.random()+"\0",z2="\0COMMA"+Math.random()+"\0",J2="\0PERIOD"+Math.random()+"\0";function QR(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function _Le(t){return t.split("\\\\").join(W2).split("\\{").join(X2).split("\\}").join(ZR).split("\\,").join(z2).split("\\.").join(J2)}function ELe(t){return t.split(W2).join("\\").split(X2).join("{").split(ZR).join("}").split(z2).join(",").split(J2).join(".")}function Q2(t){if(!t)return[""];var e=[],n=K2("{","}",t);if(!n)return t.split(",");var r=n.pre,o=n.body,s=n.post,i=r.split(",");i[i.length-1]+="{"+o+"}";var a=Q2(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function fLe(t,e){if(!t)return[];e=e||{};var n=e.max==null?1/0:e.max;return t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Xu(_Le(t),n,!0).map(ELe)}function SLe(t){return"{"+t+"}"}function TLe(t){return/^-?0\d/.test(t)}function mLe(t,e){return t<=e}function hLe(t,e){return t>=e}function Xu(t,e,n){var r=[],o=K2("{","}",t);if(!o)return[t];var s=o.pre,i=o.post.length?Xu(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(var a=0;a<i.length&&a<e;a++){var c=s+"{"+o.body+"}"+i[a];r.push(c)}else{var u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),p=u||l,d=o.body.indexOf(",")>=0;if(!p&&!d)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+ZR+o.post,Xu(t,e,!0)):[t];var _;if(p)_=o.body.split(/\.\./);else if(_=Q2(o.body),_.length===1&&(_=Xu(_[0],e,!1).map(SLe),_.length===1))return i.map(function(w){return o.pre+_[0]+w});var E;if(p){var S=QR(_[0]),T=QR(_[1]),h=Math.max(_[0].length,_[1].length),R=_.length==3?Math.max(Math.abs(QR(_[2])),1):1,O=mLe,N=T<S;N&&(R*=-1,O=hLe);var A=_.some(TLe);E=[];for(var M=S;O(M,T);M+=R){var v;if(l)v=String.fromCharCode(M),v==="\\"&&(v="");else if(v=String(M),A){var X=h-v.length;if(X>0){var q=new Array(X+1).join("0");M<0?v="-"+q+v.slice(1):v=q+v}}E.push(v)}}else{E=[];for(var Ue=0;Ue<_.length;Ue++)E.push.apply(E,Xu(_[Ue],e,!1))}for(var Ue=0;Ue<E.length;Ue++)for(var a=0;a<i.length&&r.length<e;a++){var c=s+E[Ue]+i[a];(!n||p||c)&&r.push(c)}}return r}});var iO=f(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.SpanNames=Qn.TokenKind=Qn.AllowedOperationTypes=void 0;var mDe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(mDe=Qn.AllowedOperationTypes||(Qn.AllowedOperationTypes={}));var hDe;(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"})(hDe=Qn.TokenKind||(Qn.TokenKind={}));var gDe;(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"})(gDe=Qn.SpanNames||(Qn.SpanNames={}))});var aO=f(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.AttributeNames=void 0;var ADe;(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.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(ADe=nl.AttributeNames||(nl.AttributeNames={}))});var Af=f(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.OTEL_GRAPHQL_DATA_SYMBOL=wa.OTEL_PATCHED_SYMBOL=void 0;wa.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");wa.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var v4=f(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.OPERATION_NOT_SUPPORTED=void 0;var cze=Af();Rf.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var F4=f(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.wrapFieldResolver=et.wrapFields=et.getSourceFromLocation=et.getOperation=et.endSpan=et.addSpanSource=et.addInputVariableAttributes=et.isPromise=void 0;var Ba=(y(),I(x)),qo=iO(),Va=aO(),eo=Af(),b4=Object.values(qo.AllowedOperationTypes),RDe=t=>typeof t?.then=="function";et.isPromise=RDe;var ODe=t=>typeof t=="object"&&t!==null;function cO(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{cO(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{cO(t,`${e}.${r}`,o)}):t.setAttribute(`${Va.AttributeNames.VARIABLES}${String(e)}`,n)}function NDe(t,e){Object.entries(e).forEach(([n,r])=>{cO(t,n,r)})}et.addInputVariableAttributes=NDe;function U4(t,e,n,r,o){let s=G4(e,n,r,o);t.setAttribute(Va.AttributeNames.SOURCE,s)}et.addSpanSource=U4;function IDe(t,e,n,r,o){let s=w4(n,o),i=!1;if(!s){i=!0;let a=V4(n,o);s={parent:a,span:CDe(t,e,n,r,o,a.span),error:null},yDe(n,o,s)}return{spanAdded:i,field:s}}function CDe(t,e,n,r,o,s){var i,a;let c={[Va.AttributeNames.FIELD_NAME]:r.fieldName,[Va.AttributeNames.FIELD_PATH]:o.join("."),[Va.AttributeNames.FIELD_TYPE]:r.returnType.toString()},u=t.startSpan(`${qo.SpanNames.RESOLVE} ${c[Va.AttributeNames.FIELD_PATH]}`,{attributes:c},s?Ba.trace.setSpan(Ba.context.active(),s):void 0),l=n[eo.OTEL_GRAPHQL_DATA_SYMBOL].source,p=r.fieldNodes.find(d=>d.kind==="Field");return p&&U4(u,l.loc,e().allowValues,(i=p.loc)===null||i===void 0?void 0:i.start,(a=p.loc)===null||a===void 0?void 0:a.end),u}function PDe(t,e){e&&t.recordException(e),t.end()}et.endSpan=PDe;function MDe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>{var r;return b4.indexOf((r=n)===null||r===void 0?void 0:r.operation)!==-1}).find(n=>{var r,o;return e===((o=(r=n)===null||r===void 0?void 0:r.name)===null||o===void 0?void 0:o.value)}):t.definitions.find(n=>{var r;return b4.indexOf((r=n)===null||r===void 0?void 0:r.operation)!==-1})}et.getOperation=MDe;function yDe(t,e,n){return t[eo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function w4(t,e){return t[eo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function V4(t,e){for(let n=e.length-1;n>0;n--){let r=w4(t,e.slice(0,n));if(r)return r}return{span:t[eo.OTEL_GRAPHQL_DATA_SYMBOL].span}}function vDe(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 bDe(t){return B4(`
|
|
10
|
-
`,t)}function L4(t){return B4(" ",t)}function B4(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var LDe=[qo.TokenKind.FLOAT,qo.TokenKind.STRING,qo.TokenKind.INT,qo.TokenKind.BLOCK_STRING];function G4(t,e=!1,n,r){var o,s;let i="";if(t?.startToken){let a=typeof n=="number"?n:t.start,c=typeof r=="number"?r:t.end,u=t.startToken.next,l=1;for(;u;){if(u.start<a){u=u.next,l=u?.line;continue}if(u.end>c){u=u.next,l=u?.line;continue}let p=u.value||u.kind,d="";!e&&LDe.indexOf(u.kind)>=0&&(p="*"),u.kind===qo.TokenKind.STRING&&(p=`"${p}"`),u.kind===qo.TokenKind.EOF&&(p=""),u.line>l?(i+=bDe(u.line-l),l=u.line,d=L4(u.column-1)):u.line===((o=u.prev)===null||o===void 0?void 0:o.line)&&(d=L4(u.start-(((s=u.prev)===null||s===void 0?void 0:s.end)||0))),i+=d+p,u&&(u=u.next)}}return i}et.getSourceFromLocation=G4;function H4(t,e,n){if(!t||typeof t.getFields!="function"||t[eo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[eo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=k4(e,n,s.resolve)),s.type)){let i=s.type;for(;i.ofType;)i=i.ofType;H4(i,e,n)}})}et.wrapFields=H4;var D4=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Ba.SpanStatusCode.ERROR,message:e.message}),t.end())},x4=(t,e)=>{e&&t.end()};function k4(t,e,n,r=!1){if(o[eo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let u=e();if(u.ignoreTrivialResolveSpans&&r&&(ODe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[eo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let l=vDe(u.mergeItems,c&&c.path),p=l.filter(E=>typeof E=="string").length,d,_=!1;if(u.depth>=0&&u.depth<p)d=V4(a,l);else{let E=IDe(t,e,a,c,l);d=E.field,_=E.spanAdded}return Ba.context.with(Ba.trace.setSpan(Ba.context.active(),d.span),()=>{try{let E=n.call(this,s,i,a,c);return(0,et.isPromise)(E)?E.then(S=>(x4(d.span,_),S),S=>{throw D4(d.span,S,_),S}):(x4(d.span,_),E)}catch(E){throw D4(d.span,E,_),E}})}return o[eo.OTEL_PATCHED_SYMBOL]=!0,o}et.wrapFieldResolver=k4});var j4=f(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.PACKAGE_NAME=Ga.PACKAGE_VERSION=void 0;Ga.PACKAGE_VERSION="0.47.1";Ga.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var q4=f(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.GraphQLInstrumentation=void 0;var to=(y(),I(x)),bn=te(),rl=iO(),Of=aO(),uO=Af(),DDe=v4(),vt=F4(),$4=j4(),Y4={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},Nf=[">=14.0.0 <17"],lO=class extends bn.InstrumentationBase{constructor(e={}){super($4.PACKAGE_NAME,$4.PACKAGE_VERSION,Object.assign(Object.assign({},Y4),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},Y4),e))}init(){let e=new bn.InstrumentationNodeModuleDefinition("graphql",Nf);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new bn.InstrumentationNodeModuleFile("graphql/execution/execute.js",Nf,e=>((0,bn.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 bn.InstrumentationNodeModuleFile("graphql/language/parser.js",Nf,e=>((0,bn.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new bn.InstrumentationNodeModuleFile("graphql/validation/validate.js",Nf,e=>((0,bn.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 u=arguments;i=n._wrapExecuteArgs(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],e)}else{let u=arguments[0];i=n._wrapExecuteArgs(u.schema,u.document,u.rootValue,u.contextValue,u.variableValues,u.operationName,u.fieldResolver,u.typeResolver,e)}let a=(0,vt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[uO.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[uO.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},to.context.with(to.trace.setSpan(to.context.active(),c),()=>(0,bn.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(u,l)=>{n._handleExecutionResult(c,u,l)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,vt.endSpan)(e,n);return}if((0,vt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,vt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,vt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,vt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,bn.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,vt.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,u){return e._validate(this,r,s,i,a,u,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(rl.SpanNames.PARSE);return to.context.with(to.trace.setSpan(to.context.active(),i),()=>(0,bn.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,vt.getOperation)(c)?c.loc&&(0,vt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(rl.SpanNames.SCHEMA_PARSE)),(0,vt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(rl.SpanNames.VALIDATE,{});return to.context.with(to.trace.setSpan(to.context.active(),c),()=>(0,bn.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(u,l)=>{o.loc||c.updateName(rl.SpanNames.SCHEMA_VALIDATE),l&&l.length&&c.recordException({name:Of.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(l)}),(0,vt.endSpan)(c,u)}))}_createExecuteSpan(e,n){var r;let o=this.getConfig(),s=this.tracer.startSpan(rl.SpanNames.EXECUTE,{});if(e){let{operation:i,name:a}=e;s.setAttribute(Of.AttributeNames.OPERATION_TYPE,i);let c=a?.value;c?(s.setAttribute(Of.AttributeNames.OPERATION_NAME,c),s.updateName(`${i} ${c}`)):s.updateName(i)}else{let i=" ";n.operationName&&(i=` "${n.operationName}" `),i=DDe.OPERATION_NOT_SUPPORTED.replace("$operationName$",i),s.setAttribute(Of.AttributeNames.OPERATION_NAME,i)}return!((r=n.document)===null||r===void 0)&&r.loc&&(0,vt.addSpanSource)(s,n.document.loc,o.allowValues),n.variableValues&&o.allowValues&&(0,vt.addInputVariableAttributes)(s,n.variableValues),s}_wrapExecuteArgs(e,n,r,o,s,i,a,c,u){if(o||(o={}),o[uO.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 l=a==null,p=a??u;return a=(0,vt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),p,l),e&&((0,vt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,vt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};If.GraphQLInstrumentation=lO});var W4=f(K4=>{"use strict";Object.defineProperty(K4,"__esModule",{value:!0})});var z4=f(Ko=>{"use strict";var xDe=Ko&&Ko.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),X4=Ko&&Ko.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xDe(e,t,n)};Object.defineProperty(Ko,"__esModule",{value:!0});X4(q4(),Ko);X4(W4(),Ko)});var n5=f(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.PACKAGE_NAME=Ha.PACKAGE_VERSION=void 0;Ha.PACKAGE_VERSION="0.7.1";Ha.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var r5=f(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.bufferTextMapGetter=void 0;Cf.bufferTextMapGetter={get(t,e){var n;if(!t)return;let r=Object.keys(t);for(let o of r)if(o===e||o.toLowerCase()===e)return(n=t[o])===null||n===void 0?void 0:n.toString()},keys(t){return t?Object.keys(t):[]}}});var i5=f(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.KafkaJsInstrumentation=void 0;var ft=(y(),I(x)),Wo=(de(),I(je)),o5=n5(),s5=r5(),Zn=te(),pO=class extends Zn.InstrumentationBase{constructor(e={}){super(o5.PACKAGE_NAME,o5.PACKAGE_VERSION,e)}init(){let e=r=>{var o,s;(0,Zn.isWrapped)((o=r?.Kafka)===null||o===void 0?void 0:o.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,Zn.isWrapped)((s=r?.Kafka)===null||s===void 0?void 0:s.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new Zn.InstrumentationNodeModuleDefinition("kafkajs",[">=0.1.0 <3"],r=>{var o,s;return e(r),this._wrap((o=r?.Kafka)===null||o===void 0?void 0:o.prototype,"producer",this._getProducerPatch()),this._wrap((s=r?.Kafka)===null||s===void 0?void 0:s.prototype,"consumer",this._getConsumerPatch()),r},e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,Zn.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),s}}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,Zn.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getProducerSendBatchPatch()),(0,Zn.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getProducerSendPatch()),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,Zn.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,Zn.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=ft.propagation.extract(ft.ROOT_CONTEXT,s.message.headers,s5.bufferTextMapGetter),a=e._startConsumerSpan(s.topic,s.message,Wo.MESSAGINGOPERATIONVALUES_PROCESS,i),c=ft.context.with(ft.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan(s.batch.topic,void 0,Wo.MESSAGINGOPERATIONVALUES_RECEIVE,ft.ROOT_CONTEXT);return ft.context.with(ft.trace.setSpan(ft.context.active(),i),()=>{let a=s.batch.messages.map(u=>{var l;let p=ft.propagation.extract(ft.ROOT_CONTEXT,u.headers,s5.bufferTextMapGetter),d=(l=ft.trace.getSpan(p))===null||l===void 0?void 0:l.spanContext(),_;return d&&(_={context:d}),n._startConsumerSpan(s.batch.topic,u,Wo.MESSAGINGOPERATIONVALUES_PROCESS,void 0,_)}),c=e.apply(this,o);return a.unshift(i),n._endSpansOnPromise(a,c)})}}}_getProducerSendBatchPatch(){let e=this;return n=>function(...o){let a=(o[0].topicMessages||[]).map(u=>u.messages.map(l=>e._startProducerSpan(u.topic,l))).reduce((u,l)=>u.concat(l),[]),c=n.apply(this,o);return e._endSpansOnPromise(a,c)}}_getProducerSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(c=>e._startProducerSpan(s.topic,c)),a=n.apply(this,o);return e._endSpansOnPromise(i,a)}}_endSpansOnPromise(e,n){return Promise.resolve(n).catch(r=>{let o;throw typeof r=="string"?o=r:typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,"message")&&(o=r.message),e.forEach(s=>s.setStatus({code:ft.SpanStatusCode.ERROR,message:o})),r}).finally(()=>{e.forEach(r=>r.end())})}_startConsumerSpan(e,n,r,o,s){let i=this.tracer.startSpan(e,{kind:ft.SpanKind.CONSUMER,attributes:{[Wo.SEMATTRS_MESSAGING_SYSTEM]:"kafka",[Wo.SEMATTRS_MESSAGING_DESTINATION]:e,[Wo.SEMATTRS_MESSAGING_OPERATION]:r},links:s?[s]:[]},o),{consumerHook:a}=this.getConfig();return a&&n&&(0,Zn.safeExecuteInTheMiddle)(()=>a(i,{topic:e,message:n}),c=>{c&&this._diag.error("consumerHook error",c)},!0),i}_startProducerSpan(e,n){var r;let o=this.tracer.startSpan(e,{kind:ft.SpanKind.PRODUCER,attributes:{[Wo.SEMATTRS_MESSAGING_SYSTEM]:"kafka",[Wo.SEMATTRS_MESSAGING_DESTINATION]:e}});n.headers=(r=n.headers)!==null&&r!==void 0?r:{},ft.propagation.inject(ft.trace.setSpan(ft.context.active(),o),n.headers);let{producerHook:s}=this.getConfig();return s&&(0,Zn.safeExecuteInTheMiddle)(()=>s(o,{topic:e,message:n}),i=>{i&&this._diag.error("producerHook error",i)},!0),o}};Pf.KafkaJsInstrumentation=pO});var c5=f(a5=>{"use strict";Object.defineProperty(a5,"__esModule",{value:!0})});var l5=f(Xo=>{"use strict";var VDe=Xo&&Xo.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),u5=Xo&&Xo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&VDe(e,t,n)};Object.defineProperty(Xo,"__esModule",{value:!0});u5(i5(),Xo);u5(c5(),Xo)});var f5=f(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.PACKAGE_NAME=ka.PACKAGE_VERSION=void 0;ka.PACKAGE_VERSION="0.44.1";ka.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var h5=f(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.LruMemoizerInstrumentation=void 0;var S5=(y(),I(x)),T5=te(),m5=f5(),dO=class extends T5.InstrumentationBase{constructor(e={}){super(m5.PACKAGE_NAME,m5.PACKAGE_VERSION,e)}init(){return[new T5.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <3"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?S5.context.bind(S5.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};Mf.LruMemoizerInstrumentation=dO});var g5=f(ei=>{"use strict";var GDe=ei&&ei.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),HDe=ei&&ei.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&GDe(e,t,n)};Object.defineProperty(ei,"__esModule",{value:!0});HDe(h5(),ei)});var I5=f(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.MongodbCommandType=void 0;var FDe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(FDe=ol.MongodbCommandType||(ol.MongodbCommandType={}))});var C5=f(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.PACKAGE_NAME=Fa.PACKAGE_VERSION=void 0;Fa.PACKAGE_VERSION="0.52.0";Fa.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var y5=f(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.MongoDBInstrumentation=void 0;var Ce=(y(),I(x)),ge=te(),no=(de(),I(je)),zo=I5(),P5=C5(),M5={requireParentSpan:!0},_O=class t extends ge.InstrumentationBase{constructor(e={}){super(P5.PACKAGE_NAME,P5.PACKAGE_VERSION,Object.assign(Object.assign({},M5),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},M5),e))}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter("db.client.connections.usage",{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}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:u}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:l,v4UnpatchSessions:p}=this._getV4SessionsPatches();return[new ge.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new ge.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new ge.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <7"],void 0,void 0,[new ge.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new ge.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <7"],i,a),new ge.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,u),new ge.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <7"],r,o),new ge.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <7"],l,p)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,ge.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,ge.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,ge.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,ge.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,ge.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,ge.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,ge.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,ge.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,ge.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,ge.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._connectionsUsage.add(1,{state:"used","pool.name":e._poolName}):o-1===i&&(e._connectionsUsage.add(-1,{state:"idle","pool.name":e._poolName}),e._connectionsUsage.add(1,{state:"used","pool.name":e._poolName})),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connectionsUsage.add(-1,{state:"used","pool.name":e._poolName}),e._connectionsUsage.add(1,{state:"idle","pool.name":e._poolName}),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,ge.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,ge.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=Ce.context.bind(Ce.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,ge.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,ge.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,u){let l=Ce.trace.getSpan(Ce.context.active()),p=n._checkSkipInstrumentation(l),d=typeof c=="function"?c:u;if(p||typeof d!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,u);let _=n.tracer.startSpan(`mongodb.${e}`,{kind:Ce.SpanKind.CLIENT});n._populateV3Attributes(_,i,s,a[0],e);let E=n._patchEnd(_,d);return typeof c=="function"?r.call(this,s,i,a,E):r.call(this,s,i,a,c,E)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let u=Ce.trace.getSpan(Ce.context.active()),l=e._checkSkipInstrumentation(u),p=typeof a=="function"?a:c;if(l||typeof p!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let d=t._getCommandType(i),_=d===zo.MongodbCommandType.UNKNOWN?"command":d,E=e.tracer.startSpan(`mongodb.${_}`,{kind:Ce.SpanKind.CLIENT}),S=d===zo.MongodbCommandType.UNKNOWN?void 0:d;e._populateV3Attributes(E,s,o,i,S);let T=e._patchEnd(E,p);return typeof a=="function"?n.call(this,o,s,i,T):n.call(this,o,s,i,a,T)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=Ce.trace.getSpan(Ce.context.active()),u=e._checkSkipInstrumentation(c),l=a,p=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let d;u||(d=e.tracer.startSpan(`mongodb.${p}`,{kind:Ce.SpanKind.CLIENT}),e._populateV4Attributes(d,this,o,s,p));let _=e._patchEnd(d,l,this.id,p);return n.call(this,o,s,i,_)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=Ce.trace.getSpan(Ce.context.active()),c=e._checkSkipInstrumentation(a),u=Object.keys(i)[0],l=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let p;c||(p=e.tracer.startSpan(`mongodb.${u}`,{kind:Ce.SpanKind.CLIENT}),e._populateV4Attributes(p,this,s,i,u));let d=e._patchEnd(p,l,this.id,u),_=n.apply(this,o);return _.then(E=>d(null,E),E=>d(E)),_}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,u){let l=Ce.trace.getSpan(Ce.context.active()),p=e._checkSkipInstrumentation(l),d=typeof c=="function"?c:u;if(p||typeof d!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,u);let _=e.tracer.startSpan("mongodb.find",{kind:Ce.SpanKind.CLIENT});e._populateV3Attributes(_,s,o,i,"find");let E=e._patchEnd(_,d);return typeof c=="function"?n.call(this,o,s,i,a,E):n.call(this,o,s,i,a,c,E)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,u){let l=Ce.trace.getSpan(Ce.context.active()),p=e._checkSkipInstrumentation(l),d=typeof c=="function"?c:u;if(p||typeof d!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,u);let _=e.tracer.startSpan("mongodb.getMore",{kind:Ce.SpanKind.CLIENT});e._populateV3Attributes(_,s,o,i.cmd,"getMore");let E=e._patchEnd(_,d);return typeof c=="function"?n.call(this,o,s,i,a,E):n.call(this,o,s,i,a,c,E)}}static _getCommandType(e){return e.createIndexes!==void 0?zo.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?zo.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?zo.MongodbCommandType.IS_MASTER:e.count!==void 0?zo.MongodbCommandType.COUNT:e.aggregate!==void 0?zo.MongodbCommandType.AGGREGATE:zo.MongodbCommandType.UNKNOWN}_populateV4Attributes(e,n,r,o,s){let i,a;if(n){let u=typeof n.address=="string"?n.address.split(":"):"";u.length===2&&(i=u[0],a=u[1])}let c;o?.documents&&o.documents[0]?c=o.documents[0]:o?.cursors?c=o.cursors:c=o,this._addAllSpanAttributes(e,r.db,r.collection,i,a,c,s)}_populateV3Attributes(e,n,r,o,s){var i,a,c,u,l,p,d,_;let E,S;if(r&&r.s&&(E=(a=(i=r.s.options)===null||i===void 0?void 0:i.host)!==null&&a!==void 0?a:r.s.host,S=(l=(u=(c=r.s.options)===null||c===void 0?void 0:c.port)!==null&&u!==void 0?u:r.s.port)===null||l===void 0?void 0:l.toString(),E==null||S==null)){let O=(p=r.description)===null||p===void 0?void 0:p.address;if(O){let N=O.split(":");E=N[0],S=N[1]}}let[T,h]=n.toString().split("."),R=(_=(d=o?.query)!==null&&d!==void 0?d:o?.q)!==null&&_!==void 0?_:o;this._addAllSpanAttributes(e,T,h,E,S,R,s)}_addAllSpanAttributes(e,n,r,o,s,i,a){if(e.setAttributes({[no.SEMATTRS_DB_SYSTEM]:no.DBSYSTEMVALUES_MONGODB,[no.SEMATTRS_DB_NAME]:n,[no.SEMATTRS_DB_MONGODB_COLLECTION]:r,[no.SEMATTRS_DB_OPERATION]:a,[no.SEMATTRS_DB_CONNECTION_STRING]:`mongodb://${o}:${s}/${n}`}),o&&s){e.setAttribute(no.SEMATTRS_NET_PEER_NAME,o);let l=parseInt(s,10);isNaN(l)||e.setAttribute(no.SEMATTRS_NET_PEER_PORT,l)}if(!i)return;let{dbStatementSerializer:c}=this.getConfig(),u=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,ge.safeExecuteInTheMiddle)(()=>{let l=u(i);e.setAttribute(no.SEMATTRS_DB_STATEMENT,l)},l=>{l&&this._diag.error("Error running dbStatementSerializer hook",l)},!0)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig(),r=n?e:this._scrubStatement(e);return JSON.stringify(r)}_scrubStatement(e){return Array.isArray(e)?e.map(n=>this._scrubStatement(n)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,this._scrubStatement(r)])):"?"}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,ge.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=Ce.context.active(),i=this;return function(...c){let u=c[0];if(e){if(u instanceof Error)e?.setStatus({code:Ce.SpanStatusCode.ERROR,message:u.message});else{let l=c[1];i._handleExecutionResult(e,l)}e.end()}return Ce.context.with(s,()=>(o==="endSessions"&&i._connectionsUsage.add(-1,{state:"idle","pool.name":i._poolName}),n.apply(this,c)))}}setPoolName(e){var n,r;let o=(n=e.hostAddress)===null||n===void 0?void 0:n.host,s=(r=e.hostAddress)===null||r===void 0?void 0:r.port,i=e.dbName,a=`mongodb://${o}:${s}/${i}`;this._poolName=a}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};yf.MongoDBInstrumentation=_O});var v5=f(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.MongodbCommandType=void 0;var jDe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(jDe=sl.MongodbCommandType||(sl.MongodbCommandType={}))});var L5=f(Jo=>{"use strict";var $De=Jo&&Jo.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),b5=Jo&&Jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$De(e,t,n)};Object.defineProperty(Jo,"__esModule",{value:!0});b5(y5(),Jo);b5(v5(),Jo)});var G5=f(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.handleCallbackResponse=Qo.handlePromiseResponse=Qo.getAttributesFromCollection=void 0;var V5=(y(),I(x)),zDe=te(),il=(de(),I(je));function JDe(t){return{[il.SEMATTRS_DB_MONGODB_COLLECTION]:t.name,[il.SEMATTRS_DB_NAME]:t.conn.name,[il.SEMATTRS_DB_USER]:t.conn.user,[il.SEMATTRS_NET_PEER_NAME]:t.conn.host,[il.SEMATTRS_NET_PEER_PORT]:t.conn.port}}Qo.getAttributesFromCollection=JDe;function B5(t,e={}){t.recordException(e),t.setStatus({code:V5.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
11
|
-
Mongoose Error Code: ${e.code}`:""}`})}function fO(t,e,n,r=void 0){n&&(0,zDe.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&V5.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function QDe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(fO(e,o,n,r),o)).catch(o=>{throw B5(e,o),o}).finally(()=>e.end()):(fO(e,t,n,r),e.end(),t)}Qo.handlePromiseResponse=QDe;function ZDe(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2&&(a=1),o[a]=(c,u)=>(c?B5(r,c):fO(r,u,s,i),r.end(),t(c,u)),e.apply(n,o)}Qo.handleCallbackResponse=ZDe});var H5=f(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.PACKAGE_NAME=ja.PACKAGE_VERSION=void 0;ja.PACKAGE_VERSION="0.46.1";ja.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var Y5=f(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.MongooseInstrumentation=yr._STORED_PARENT_SPAN=void 0;var kt=(y(),I(x)),exe=oe(),SO=G5(),k5=te(),F5=H5(),al=(de(),I(je)),vf=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],txe=["remove","count","findOneAndRemove",...vf],nxe=["count","findOneAndRemove",...vf],rxe=[...vf];function j5(t){return t?t.startsWith("6.")||t.startsWith("5.")?txe:t.startsWith("7.")?nxe:rxe:vf}function $5(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}yr._STORED_PARENT_SPAN=Symbol("stored-parent-span");var TO=class extends k5.InstrumentationBase{constructor(e={}){super(F5.PACKAGE_NAME,F5.PACKAGE_VERSION,e)}init(){return new k5.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <9"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){return this._wrap(e.Model.prototype,"save",this.patchOnModelMethods("save",n)),e.Model.prototype.$save=e.Model.prototype.save,$5(n)&&this._wrap(e.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),this._wrap(e.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(e.Aggregate.prototype,"exec",this.patchAggregateExec(n)),j5(n).forEach(o=>{this._wrap(e.Query.prototype,o,this.patchAndCaptureSpanContext(o))}),this._wrap(e.Model,"aggregate",this.patchModelAggregate()),e}unpatch(e,n){let r=j5(n);this._unwrap(e.Model.prototype,"save"),e.Model.prototype.$save=e.Model.prototype.save,$5(n)&&this._unwrap(e.Model.prototype,"remove"),this._unwrap(e.Query.prototype,"exec"),this._unwrap(e.Aggregate.prototype,"exec"),r.forEach(o=>{this._unwrap(e.Query.prototype,o)}),this._unwrap(e.Model,"aggregate")}patchAggregateExec(e){let n=this;return r=>function(s){var i;if(n.getConfig().requireParentSpan&&kt.trace.getSpan(kt.context.active())===void 0)return r.apply(this,arguments);let a=this[yr._STORED_PARENT_SPAN],c={},{dbStatementSerializer:u}=n.getConfig();u&&(c[al.SEMATTRS_DB_STATEMENT]=u("aggregate",{options:this.options,aggregatePipeline:this._pipeline}));let l=n._startSpan(this._model.collection,(i=this._model)===null||i===void 0?void 0:i.modelName,"aggregate",c,a);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&kt.trace.getSpan(kt.context.active())===void 0)return r.apply(this,arguments);let i=this[yr._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();c&&(a[al.SEMATTRS_DB_STATEMENT]=c(this.op,{condition:this._conditions,updates:this._update,options:this.options,fields:this._fields}));let u=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(u,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&kt.trace.getSpan(kt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let u={},{dbStatementSerializer:l}=r.getConfig();l&&(u[al.SEMATTRS_DB_STATEMENT]=l(e,c));let p=r._startSpan(this.constructor.collection,this.constructor.modelName,e,u);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(p,o,this,arguments,a,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=kt.trace.getSpan(kt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[yr._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[yr._STORED_PARENT_SPAN]=kt.trace.getSpan(kt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){return this.tracer.startSpan(`mongoose.${n}.${r}`,{kind:kt.SpanKind.CLIENT,attributes:Object.assign(Object.assign(Object.assign({},o),(0,SO.getAttributesFromCollection)(e)),{[al.SEMATTRS_DB_OPERATION]:r,[al.SEMATTRS_DB_SYSTEM]:"mongoose"})},s?kt.trace.setSpan(kt.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,SO.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,SO.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?kt.context.with((0,exe.suppressTracing)(kt.context.active()),e):e()}};yr.MongooseInstrumentation=TO});var K5=f(q5=>{"use strict";Object.defineProperty(q5,"__esModule",{value:!0})});var X5=f(Zo=>{"use strict";var oxe=Zo&&Zo.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),W5=Zo&&Zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oxe(e,t,n)};Object.defineProperty(Zo,"__esModule",{value:!0});W5(Y5(),Zo);W5(K5(),Zo)});var eX=f(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.AttributeNames=void 0;var ixe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(ixe=cl.AttributeNames||(cl.AttributeNames={}))});var nX=f(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getPoolName=tn.arrayStringifyHelper=tn.getSpanName=tn.getDbValues=tn.getDbStatement=tn.getConnectionAttributes=void 0;var ro=(de(),I(je));function axe(t){let{host:e,port:n,database:r,user:o}=cxe(t),s=parseInt(n,10);return isNaN(s)?{[ro.SEMATTRS_NET_PEER_NAME]:e,[ro.SEMATTRS_DB_CONNECTION_STRING]:tX(e,n,r),[ro.SEMATTRS_DB_NAME]:r,[ro.SEMATTRS_DB_USER]:o}:{[ro.SEMATTRS_NET_PEER_NAME]:e,[ro.SEMATTRS_NET_PEER_PORT]:s,[ro.SEMATTRS_DB_CONNECTION_STRING]:tX(e,n,r),[ro.SEMATTRS_DB_NAME]:r,[ro.SEMATTRS_DB_USER]:o}}tn.getConnectionAttributes=axe;function cxe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function tX(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function uxe(t){return typeof t=="string"?t:t.sql}tn.getDbStatement=uxe;function lxe(t,e){return mO(typeof t=="string"?e:e||t.values)}tn.getDbValues=lxe;function pxe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}tn.getSpanName=pxe;function mO(t){return t?`[${t.toString()}]`:""}tn.arrayStringifyHelper=mO;function dxe(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()}tn.getPoolName=dxe});var rX=f($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.PACKAGE_NAME=$a.PACKAGE_VERSION=void 0;$a.PACKAGE_VERSION="0.45.1";$a.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var sX=f(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.MySQLInstrumentation=void 0;var nn=(y(),I(x)),Ya=te(),hO=(de(),I(je)),_xe=eX(),qa=nX(),oX=rX(),bf=class t extends Ya.InstrumentationBase{constructor(e={}){super(oX.PACKAGE_NAME,oX.PACKAGE_VERSION,e),this._setMetricInstruments()}setMeterProvider(e){super.setMeterProvider(e),this._setMetricInstruments()}_setMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter("db.client.connections.usage",{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}init(){return[new Ya.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,Ya.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,Ya.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,Ya.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,n,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,u=(0,qa.getPoolName)(e);r._connectionsUsage.add(-c,{state:"used",name:u}),r._connectionsUsage.add(-a,{state:"idle",name:u}),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),u=a[c].pool;r._setPoolcallbacks(u,r,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=nn.context.active();return function(o,s){s&&((0,Ya.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&nn.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=r.tracer.startSpan((0,qa.getSpanName)(o),{kind:nn.SpanKind.CLIENT,attributes:Object.assign(Object.assign({},t.COMMON_ATTRIBUTES),(0,qa.getConnectionAttributes)(e.config))});if(a.setAttribute(hO.SEMATTRS_DB_STATEMENT,(0,qa.getDbStatement)(o)),r.getConfig().enhancedDatabaseReporting){let l;Array.isArray(s)?l=s:arguments[2]&&(l=[s]),a.setAttribute(_xe.AttributeNames.MYSQL_VALUES,(0,qa.getDbValues)(o,l))}let c=Array.from(arguments).findIndex(l=>typeof l=="function"),u=nn.context.active();if(c===-1){let l=nn.context.with(nn.trace.setSpan(nn.context.active(),a),()=>n.apply(e,arguments));return nn.context.bind(u,l),l.on("error",p=>a.setStatus({code:nn.SpanStatusCode.ERROR,message:p.message})).on("end",()=>{a.end()})}else return r._wrap(arguments,c,r._patchCallbackQuery(a,u)),nn.context.with(nn.trace.setSpan(nn.context.active(),a),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:nn.SpanStatusCode.ERROR,message:o.message}),e.end(),nn.context.with(n,()=>r(...arguments))}}_setPoolcallbacks(e,n,r){let o=r||(0,qa.getPoolName)(e);e.on("connection",s=>{n._connectionsUsage.add(1,{state:"idle",name:o})}),e.on("acquire",s=>{n._connectionsUsage.add(-1,{state:"idle",name:o}),n._connectionsUsage.add(1,{state:"used",name:o})}),e.on("release",s=>{n._connectionsUsage.add(-1,{state:"used",name:o}),n._connectionsUsage.add(1,{state:"idle",name:o})})}};Lf.MySQLInstrumentation=bf;bf.COMMON_ATTRIBUTES={[hO.SEMATTRS_DB_SYSTEM]:hO.DBSYSTEMVALUES_MYSQL}});var aX=f(iX=>{"use strict";Object.defineProperty(iX,"__esModule",{value:!0})});var uX=f(es=>{"use strict";var Exe=es&&es.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),cX=es&&es.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Exe(e,t,n)};Object.defineProperty(es,"__esModule",{value:!0});cX(sX(),es);cX(aX(),es)});var AO=f(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.addSqlCommenterComment=void 0;var gO=(y(),I(x)),Sxe=oe();function Txe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function mxe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function hxe(t,e){if(typeof e!="string"||e.length===0||Txe(e))return e;let n=new Sxe.W3CTraceContextPropagator,r={};n.inject(gO.trace.setSpan(gO.ROOT_CONTEXT,t),r,gO.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=mxe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}Df.addSqlCommenterComment=hxe});var fX=f(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getConnectionPrototypeToInstrument=Ln.once=Ln.getSpanName=Ln.getDbStatement=Ln.getConnectionAttributes=void 0;var oo=(de(),I(je));function gxe(t){let{host:e,port:n,database:r,user:o}=Axe(t),s=parseInt(n,10);return isNaN(s)?{[oo.SEMATTRS_NET_PEER_NAME]:e,[oo.SEMATTRS_DB_CONNECTION_STRING]:EX(e,n,r),[oo.SEMATTRS_DB_NAME]:r,[oo.SEMATTRS_DB_USER]:o}:{[oo.SEMATTRS_NET_PEER_NAME]:e,[oo.SEMATTRS_NET_PEER_PORT]:s,[oo.SEMATTRS_DB_CONNECTION_STRING]:EX(e,n,r),[oo.SEMATTRS_DB_NAME]:r,[oo.SEMATTRS_DB_USER]:o}}Ln.getConnectionAttributes=gxe;function Axe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function EX(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function Rxe(t,e,n){return e?typeof t=="string"?n?e(t,n):t:n||t.values?e(t.sql,n||t.values):t.sql:typeof t=="string"?t:t.sql}Ln.getDbStatement=Rxe;function Oxe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Ln.getSpanName=Oxe;var Nxe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Ln.once=Nxe;function Ixe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}Ln.getConnectionPrototypeToInstrument=Ixe});var SX=f(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.PACKAGE_NAME=Ka.PACKAGE_VERSION=void 0;Ka.PACKAGE_VERSION="0.45.2";Ka.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var gX=f(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.MySQL2Instrumentation=void 0;var TX=(y(),I(x)),ti=te(),OO=(de(),I(je)),mX=AO(),Wa=fX(),hX=SX(),RO=[">=1.4.2 <4"],xf=class t extends ti.InstrumentationBase{constructor(e={}){super(hX.PACKAGE_NAME,hX.PACKAGE_VERSION,e)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,ti.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,ti.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 ti.InstrumentationNodeModuleDefinition("mysql2",RO,s=>(n(s),s),()=>{},[new ti.InstrumentationNodeModuleFile("mysql2/promise.js",RO,s=>(n(s),s),()=>{}),new ti.InstrumentationNodeModuleFile("mysql2/lib/connection.js",RO,s=>{let i=(0,Wa.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Wa.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 u=o.tracer.startSpan((0,Wa.getSpanName)(s),{kind:TX.SpanKind.CLIENT,attributes:Object.assign(Object.assign(Object.assign({},t.COMMON_ATTRIBUTES),(0,Wa.getConnectionAttributes)(this.config)),{[OO.SEMATTRS_DB_STATEMENT]:(0,Wa.getDbStatement)(s,e,c)})});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,mX.addSqlCommenterComment)(u,s):Object.assign(s,{sql:(0,mX.addSqlCommenterComment)(u,s.sql)}));let l=(0,Wa.once)((p,d)=>{if(p)u.setStatus({code:TX.SpanStatusCode.ERROR,message:p.message});else{let{responseHook:_}=o.getConfig();typeof _=="function"&&(0,ti.safeExecuteInTheMiddle)(()=>{_(u,{queryResults:d})},E=>{E&&o._diag.warn("Failed executing responseHook",E)},!0)}u.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(l));let p=r.apply(this,arguments);return p.once("error",d=>{l(d)}).once("result",d=>{l(void 0,d)}),p}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(l)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(l)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};Uf.MySQL2Instrumentation=xf;xf.COMMON_ATTRIBUTES={[OO.SEMATTRS_DB_SYSTEM]:OO.DBSYSTEMVALUES_MYSQL}});var RX=f(AX=>{"use strict";Object.defineProperty(AX,"__esModule",{value:!0})});var NX=f(ts=>{"use strict";var Cxe=ts&&ts.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),OX=ts&&ts.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Cxe(e,t,n)};Object.defineProperty(ts,"__esModule",{value:!0});OX(gX(),ts);OX(RX(),ts)});var yX=f(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.endSpan=void 0;var Mxe=(y(),I(x)),yxe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:Mxe.SpanStatusCode.ERROR,message:e.message})),t.end()};wf.endSpan=yxe});var NO=f(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.defaultDbStatementSerializer=void 0;var vxe=[{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}],bxe=(t,e)=>{var n,r;if(Array.isArray(e)&&e.length){let o=(r=(n=vxe.find(({regex:i})=>i.test(t)))===null||n===void 0?void 0:n.args)!==null&&r!==void 0?r:0,s=o>=0?e.slice(0,o):e;return e.length>s.length&&s.push(`[${e.length-o} other arguments]`),`${t} ${s.join(" ")}`}return t};Vf.defaultDbStatementSerializer=bxe});var vX=f(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.PACKAGE_NAME=Xa.PACKAGE_VERSION=void 0;Xa.PACKAGE_VERSION="0.47.1";Xa.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var xX=f(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.IORedisInstrumentation=void 0;var ns=(y(),I(x)),Bf=te(),Dn=(de(),I(je)),bX=te(),ul=yX(),Lxe=NO(),LX=vX(),DX={requireParentSpan:!0},IO=class extends Bf.InstrumentationBase{constructor(e={}){super(LX.PACKAGE_NAME,LX.PACKAGE_VERSION,Object.assign(Object.assign({},DX),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},DX),e))}init(){return[new Bf.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Bf.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Bf.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||Lxe.defaultDbStatementSerializer,a=ns.trace.getSpan(ns.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c=r.tracer.startSpan(o.name,{kind:ns.SpanKind.CLIENT,attributes:{[Dn.SEMATTRS_DB_SYSTEM]:Dn.DBSYSTEMVALUES_REDIS,[Dn.SEMATTRS_DB_STATEMENT]:i(o.name,o.args)}}),{requestHook:u}=s;u&&(0,bX.safeExecuteInTheMiddle)(()=>u(c,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),d=>{d&&ns.diag.error("ioredis instrumentation: request hook failed",d)},!0);let{host:l,port:p}=this.options;c.setAttributes({[Dn.SEMATTRS_NET_PEER_NAME]:l,[Dn.SEMATTRS_NET_PEER_PORT]:p,[Dn.SEMATTRS_DB_CONNECTION_STRING]:`redis://${l}:${p}`});try{let d=e.apply(this,arguments),_=o.resolve;o.resolve=function(S){(0,bX.safeExecuteInTheMiddle)(()=>{var T;return(T=s.responseHook)===null||T===void 0?void 0:T.call(s,c,o.name,o.args,S)},T=>{T&&ns.diag.error("ioredis instrumentation: response hook failed",T)},!0),(0,ul.endSpan)(c,null),_(S)};let E=o.reject;return o.reject=function(S){(0,ul.endSpan)(c,S),E(S)},d}catch(d){throw(0,ul.endSpan)(c,d),d}}}_traceConnection(e){let n=this;return function(){let r=ns.trace.getSpan(ns.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o=n.tracer.startSpan("connect",{kind:ns.SpanKind.CLIENT,attributes:{[Dn.SEMATTRS_DB_SYSTEM]:Dn.DBSYSTEMVALUES_REDIS,[Dn.SEMATTRS_DB_STATEMENT]:"connect"}}),{host:s,port:i}=this.options;o.setAttributes({[Dn.SEMATTRS_NET_PEER_NAME]:s,[Dn.SEMATTRS_NET_PEER_PORT]:i,[Dn.SEMATTRS_DB_CONNECTION_STRING]:`redis://${s}:${i}`});try{let a=e.apply(this,arguments);return(0,ul.endSpan)(o,null),a}catch(a){throw(0,ul.endSpan)(o,a),a}}}};Gf.IORedisInstrumentation=IO});var wX=f(UX=>{"use strict";Object.defineProperty(UX,"__esModule",{value:!0})});var BX=f(rs=>{"use strict";var Dxe=rs&&rs.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),VX=rs&&rs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Dxe(e,t,n)};Object.defineProperty(rs,"__esModule",{value:!0});VX(xX(),rs);VX(wX(),rs)});var GX=f(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.getClientAttributes=void 0;var ll=(de(),I(je));function xxe(t,e){var n,r;return{[ll.SEMATTRS_DB_SYSTEM]:ll.DBSYSTEMVALUES_REDIS,[ll.SEMATTRS_NET_PEER_NAME]:(n=e?.socket)===null||n===void 0?void 0:n.host,[ll.SEMATTRS_NET_PEER_PORT]:(r=e?.socket)===null||r===void 0?void 0:r.port,[ll.SEMATTRS_DB_CONNECTION_STRING]:Uxe(t,e?.url)}}Hf.getClientAttributes=xxe;function Uxe(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 HX=f(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.PACKAGE_NAME=za.PACKAGE_VERSION=void 0;za.PACKAGE_VERSION="0.46.1";za.PACKAGE_NAME="@opentelemetry/instrumentation-redis-4"});var YX=f(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});Ff.RedisInstrumentation=void 0;var xn=(y(),I(x)),lt=te(),kX=GX(),wxe=NO(),FX=HX(),Vxe=(de(),I(je)),pl=Symbol("opentelemetry.instrumentation.redis.open_spans"),jX=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),$X={requireParentSpan:!1},kf=class t extends lt.InstrumentationBase{constructor(e={}){super(FX.PACKAGE_NAME,FX.PACKAGE_VERSION,Object.assign(Object.assign({},$X),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},$X),e))}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new lt.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,lt.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,lt.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,lt.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new lt.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0"],s=>{var i;let a=(i=s?.default)===null||i===void 0?void 0:i.prototype;return(0,lt.isWrapped)(a?.exec)&&this._unwrap(a,"exec"),this._wrap(a,"exec",this._getPatchMultiCommandsExec()),(0,lt.isWrapped)(a?.addCommand)&&this._unwrap(a,"addCommand"),this._wrap(a,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{var i;let a=(i=s?.default)===null||i===void 0?void 0:i.prototype;(0,lt.isWrapped)(a?.exec)&&this._unwrap(a,"exec"),(0,lt.isWrapped)(a?.addCommand)&&this._unwrap(a,"addCommand")}),o=new lt.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0"],s=>{var i;let a=(i=s?.default)===null||i===void 0?void 0:i.prototype;return a?.multi&&((0,lt.isWrapped)(a?.multi)&&this._unwrap(a,"multi"),this._wrap(a,"multi",this._getPatchRedisClientMulti())),a?.MULTI&&((0,lt.isWrapped)(a?.MULTI)&&this._unwrap(a,"MULTI"),this._wrap(a,"MULTI",this._getPatchRedisClientMulti())),(0,lt.isWrapped)(a?.sendCommand)&&this._unwrap(a,"sendCommand"),this._wrap(a,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(a,"connect",this._getPatchedClientConnect()),s},s=>{var i;let a=(i=s?.default)===null||i===void 0?void 0:i.prototype;(0,lt.isWrapped)(a?.multi)&&this._unwrap(a,"multi"),(0,lt.isWrapped)(a?.MULTI)&&this._unwrap(a,"MULTI"),(0,lt.isWrapped)(a?.sendCommand)&&this._unwrap(a,"sendCommand")});return new lt.InstrumentationNodeModuleDefinition(e,["^1.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){var a;if(((a=i?.BaseClass)===null||a===void 0?void 0:a.name)!=="RedisClient")return o.apply(this,arguments);let c=i.executor;return i.executor=function(u,l){let p=e(u,l).args;return n._traceClientCommand(c,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let e=this;return function(r){return function(){let s=r.apply(this,arguments);return typeof s?.then!="function"?(e._diag.error("got non promise result when patching RedisClientMultiCommand.exec"),s):s.then(i=>{let a=this[pl];return e._endSpansWithRedisReplies(a,i),i}).catch(i=>{let a=this[pl];if(!a)e._diag.error("cannot find open spans to end for redis multi command");else{let c=i.constructor.name==="MultiErrorReply"?i.replies:new Array(a.length).fill(i);e._endSpansWithRedisReplies(a,c)}return Promise.reject(i)})}}}_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[jX]=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,kX.getClientAttributes)(e._diag,s),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:xn.SpanKind.CLIENT,attributes:i});return xn.context.with(xn.trace.setSpan(xn.context.active(),a),()=>r.apply(this)).then(u=>(a.end(),u)).catch(u=>(a.recordException(u),a.setStatus({code:xn.SpanStatusCode.ERROR,message:u.message}),a.end(),Promise.reject(u)))}}}_traceClientCommand(e,n,r,o){if(xn.trace.getSpan(xn.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[jX],a=o[0],c=o.slice(1),u=this.getConfig().dbStatementSerializer||wxe.defaultDbStatementSerializer,l=(0,kX.getClientAttributes)(this._diag,i);try{let _=u(a,c);_!=null&&(l[Vxe.SEMATTRS_DB_STATEMENT]=_)}catch(_){this._diag.error("dbStatementSerializer throw an exception",_,{commandName:a})}let p=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:xn.SpanKind.CLIENT,attributes:l}),d=xn.context.with(xn.trace.setSpan(xn.context.active(),p),()=>e.apply(n,r));if(typeof d?.then=="function")d.then(_=>{this._endSpanWithResponse(p,a,c,_,void 0)},_=>{this._endSpanWithResponse(p,a,c,null,_)});else{let _=d;_[pl]=_[pl]||[],_[pl].push({span:p,commandName:a,commandArgs:c})}return d}_endSpansWithRedisReplies(e,n){if(!e)return this._diag.error("cannot find open spans to end for redis multi command");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");for(let r=0;r<e.length;r++){let{span:o,commandName:s,commandArgs:i}=e[r],a=n[r],[c,u]=a instanceof Error?[null,a]:[a,void 0];this._endSpanWithResponse(o,s,i,c,u)}}_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:xn.SpanStatusCode.ERROR,message:s?.message})),e.end()}};Ff.RedisInstrumentation=kf;kf.COMPONENT="redis"});var KX=f(qX=>{"use strict";Object.defineProperty(qX,"__esModule",{value:!0})});var XX=f(os=>{"use strict";var Bxe=os&&os.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),WX=os&&os.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Bxe(e,t,n)};Object.defineProperty(os,"__esModule",{value:!0});WX(YX(),os);WX(KX(),os)});var i3=f(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.EVENT_LISTENERS_SET=void 0;jf.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var yO=f(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.AttributeNames=void 0;var Yxe;(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"})(Yxe=_l.AttributeNames||(_l.AttributeNames={}))});var vO=f(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.METRIC_DB_CLIENT_OPERATION_DURATION=Ke.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Ke.METRIC_DB_CLIENT_CONNECTION_COUNT=Ke.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Ke.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Ke.ATTR_DB_OPERATION_NAME=Ke.ATTR_DB_NAMESPACE=Ke.ATTR_DB_CLIENT_CONNECTION_STATE=Ke.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Ke.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Ke.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Ke.ATTR_DB_NAMESPACE="db.namespace";Ke.ATTR_DB_OPERATION_NAME="db.operation.name";Ke.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Ke.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Ke.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Ke.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests";Ke.METRIC_DB_CLIENT_OPERATION_DURATION="db.client.operation.duration"});var bO=f(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.SpanNames=void 0;var qxe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(qxe=El.SpanNames||(El.SpanNames={}))});var _3=f(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.isObjectWithTextString=ae.getErrorMessage=ae.patchClientConnectCallback=ae.patchCallbackPGPool=ae.updateCounter=ae.getPoolName=ae.patchCallback=ae.handleExecutionResult=ae.handleConfigQuery=ae.shouldSkipInstrumentation=ae.getSemanticAttributesFromPool=ae.getSemanticAttributesFromConnection=ae.getConnectionString=ae.parseNormalizedOperationName=ae.getQuerySpanName=void 0;var ss=(y(),I(x)),$f=yO(),bt=(de(),I(je)),ni=vO(),Kxe=te(),a3=bO();function c3(t,e){if(!e)return a3.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:u3(e.text);return`${a3.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}ae.getQuerySpanName=c3;function u3(t){let e=t.indexOf(" "),n=e===-1?t:t.slice(0,e);return n=n.toUpperCase(),n.endsWith(";")?n.slice(0,-1):n}ae.parseNormalizedOperationName=u3;function LO(t){let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}ae.getConnectionString=LO;function l3(t){if(Number.isInteger(t))return t}function p3(t){return{[bt.SEMATTRS_DB_SYSTEM]:bt.DBSYSTEMVALUES_POSTGRESQL,[bt.SEMATTRS_DB_NAME]:t.database,[bt.SEMATTRS_DB_CONNECTION_STRING]:LO(t),[bt.SEMATTRS_NET_PEER_NAME]:t.host,[bt.SEMATTRS_NET_PEER_PORT]:l3(t.port),[bt.SEMATTRS_DB_USER]:t.user}}ae.getSemanticAttributesFromConnection=p3;function Wxe(t){return{[bt.SEMATTRS_DB_SYSTEM]:bt.DBSYSTEMVALUES_POSTGRESQL,[bt.SEMATTRS_DB_NAME]:t.database,[bt.SEMATTRS_DB_CONNECTION_STRING]:LO(t),[bt.SEMATTRS_NET_PEER_NAME]:t.host,[bt.SEMATTRS_NET_PEER_PORT]:l3(t.port),[bt.SEMATTRS_DB_USER]:t.user,[$f.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[$f.AttributeNames.MAX_CLIENT]:t.maxClient}}ae.getSemanticAttributesFromPool=Wxe;function Xxe(t){return t.requireParentSpan===!0&&ss.trace.getSpan(ss.context.active())===void 0}ae.shouldSkipInstrumentation=Xxe;function zxe(t,e,n){let{connectionParameters:r}=this,o=r.database,s=c3(o,n),i=t.startSpan(s,{kind:ss.SpanKind.CLIENT,attributes:p3(r)});if(!n)return i;if(n.text&&i.setAttribute(bt.SEMATTRS_DB_STATEMENT,n.text),e.enhancedDatabaseReporting&&Array.isArray(n.values))try{let a=n.values.map(c=>c==null?"null":c instanceof Buffer?c.toString():typeof c=="object"?typeof c.toPostgres=="function"?c.toPostgres():JSON.stringify(c):c.toString());i.setAttribute($f.AttributeNames.PG_VALUES,a)}catch(a){ss.diag.error("failed to stringify ",n.values,a)}return typeof n.name=="string"&&i.setAttribute($f.AttributeNames.PG_PLAN,n.name),i}ae.handleConfigQuery=zxe;function d3(t,e,n){typeof t.responseHook=="function"&&(0,Kxe.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&ss.diag.error("Error running response hook",r)},!0)}ae.handleExecutionResult=d3;function Jxe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[bt.ATTR_ERROR_TYPE]=i.code),e.setStatus({code:ss.SpanStatusCode.ERROR,message:i.message})):d3(t,e,a),o(),e.end(),n.call(this,i,a)}}ae.patchCallback=Jxe;function Qxe(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()}ae.getPoolName=Qxe;function Zxe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[ni.ATTR_DB_CLIENT_CONNECTION_STATE]:ni.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[ni.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[ni.ATTR_DB_CLIENT_CONNECTION_STATE]:ni.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[ni.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[ni.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}ae.updateCounter=Zxe;function eUe(t,e){return function(r,o,s){r&&t.setStatus({code:ss.SpanStatusCode.ERROR,message:r.message}),t.end(),e.call(this,r,o,s)}}ae.patchCallbackPGPool=eUe;function tUe(t,e){return function(r){r&&t.setStatus({code:ss.SpanStatusCode.ERROR,message:r.message}),t.end(),e.apply(this,arguments)}}ae.patchClientConnectCallback=tUe;function nUe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}ae.getErrorMessage=nUe;function rUe(t){var e;return typeof t=="object"&&typeof((e=t)===null||e===void 0?void 0:e.text)=="string"}ae.isObjectWithTextString=rUe});var E3=f(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.PACKAGE_NAME=Ja.PACKAGE_VERSION=void 0;Ja.PACKAGE_VERSION="0.51.1";Ja.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var g3=f(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.PgInstrumentation=void 0;var Un=te(),_e=(y(),I(x)),f3=i3(),We=_3(),S3=AO(),T3=E3(),m3=bO(),Yf=oe(),is=(de(),I(je)),ri=vO();function qf(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var DO=class extends Un.InstrumentationBase{constructor(e={}){super(T3.PACKAGE_NAME,T3.PACKAGE_VERSION,e),this._connectionsCounter={used:0,idle:0,pending:0}}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(ri.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:_e.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(ri.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(ri.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=new Un.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),r=new Un.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Un.InstrumentationNodeModuleDefinition("pg",e,i=>{let a=qf(i);return this._patchPgClient(a.Client),i},i=>{let a=qf(i);return this._unpatchPgClient(a.Client),i},[r,n]),s=new Un.InstrumentationNodeModuleDefinition("pg-pool",[">=2.0.0 <4"],i=>((0,Un.isWrapped)(i.prototype.connect)&&this._unwrap(i.prototype,"connect"),this._wrap(i.prototype,"connect",this._getPoolConnectPatch()),i),i=>{(0,Un.isWrapped)(i.prototype.connect)&&this._unwrap(i.prototype,"connect")});return[o,s]}_patchPgClient(e){if(!e)return;let n=qf(e);return(0,Un.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Un.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=qf(e);return(0,Un.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Un.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){if(We.shouldSkipInstrumentation(e.getConfig()))return n.call(this,o);let s=e.tracer.startSpan(m3.SpanNames.CONNECT,{kind:_e.SpanKind.CLIENT,attributes:We.getSemanticAttributesFromConnection(this)});if(o){let a=_e.trace.getSpan(_e.context.active());o=We.patchClientConnectCallback(s,o),a&&(o=_e.context.bind(_e.context.active(),o))}let i=_e.context.with(_e.trace.setSpan(_e.context.active(),s),()=>n.call(this,o));return h3(s,i)}}recordOperationDuration(e,n){let r={};[is.SEMATTRS_DB_SYSTEM,ri.ATTR_DB_NAMESPACE,is.ATTR_ERROR_TYPE,is.ATTR_SERVER_PORT,is.ATTR_SERVER_ADDRESS,ri.ATTR_DB_OPERATION_NAME].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,Yf.hrTimeToMilliseconds)((0,Yf.hrTimeDuration)(n,(0,Yf.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(We.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,Yf.hrTime)(),i=o[0],a=typeof i=="string",c=We.isObjectWithTextString(i),u=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?i:void 0,l={[is.SEMATTRS_DB_SYSTEM]:is.DBSYSTEMVALUES_POSTGRESQL,[ri.ATTR_DB_NAMESPACE]:this.database,[is.ATTR_SERVER_PORT]:this.connectionParameters.port,[is.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};u?.text&&(l[ri.ATTR_DB_OPERATION_NAME]=We.parseNormalizedOperationName(u?.text));let p=()=>{e.recordOperationDuration(l,s)},d=e.getConfig(),_=We.handleConfigQuery.call(this,e.tracer,d,u);if(d.addSqlCommenterCommentToQueries&&(a?o[0]=(0,S3.addSqlCommenterComment)(_,i):c&&!("name"in i)&&(o[0]=Object.assign(Object.assign({},i),{text:(0,S3.addSqlCommenterComment)(_,i.text)}))),o.length>0){let T=_e.trace.getSpan(_e.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=We.patchCallback(d,_,o[o.length-1],l,p),T&&(o[o.length-1]=_e.context.bind(_e.context.active(),o[o.length-1]));else if(typeof u?.callback=="function"){let h=We.patchCallback(e.getConfig(),_,u.callback,l,p);T&&(h=_e.context.bind(_e.context.active(),h)),o[0].callback=h}}let{requestHook:E}=d;typeof E=="function"&&u&&(0,Un.safeExecuteInTheMiddle)(()=>{let{database:T,host:h,port:R,user:O}=this.connectionParameters;E(_,{connection:{database:T,host:h,port:R,user:O},query:{text:u.text,values:u.values,name:u.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let S;try{S=n.apply(this,o)}catch(T){throw _.setStatus({code:_e.SpanStatusCode.ERROR,message:We.getErrorMessage(T)}),_.end(),T}return S instanceof Promise?S.then(T=>new Promise(h=>{We.handleExecutionResult(e.getConfig(),_,T),p(),_.end(),h(T)})).catch(T=>new Promise((h,R)=>{_.setStatus({code:_e.SpanStatusCode.ERROR,message:T.message}),p(),_.end(),R(T)})):S})}_setPoolConnectEventListeners(e){if(e[f3.EVENT_LISTENERS_SET])return;let n=We.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=We.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=We.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=We.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=We.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[f3.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){if(We.shouldSkipInstrumentation(e.getConfig()))return n.call(this,o);let s=e.tracer.startSpan(m3.SpanNames.POOL_CONNECT,{kind:_e.SpanKind.CLIENT,attributes:We.getSemanticAttributesFromPool(this.options)});if(e._setPoolConnectEventListeners(this),o){let a=_e.trace.getSpan(_e.context.active());o=We.patchCallbackPGPool(s,o),a&&(o=_e.context.bind(_e.context.active(),o))}let i=_e.context.with(_e.trace.setSpan(_e.context.active(),s),()=>n.call(this,o));return h3(s,i)}}};Kf.PgInstrumentation=DO;function h3(t,e){if(!(e instanceof Promise))return e;let n=e;return _e.context.bind(_e.context.active(),n.then(r=>(t.end(),r)).catch(r=>(t.setStatus({code:_e.SpanStatusCode.ERROR,message:We.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var R3=f(A3=>{"use strict";Object.defineProperty(A3,"__esModule",{value:!0})});var O3=f(so=>{"use strict";var oUe=so&&so.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),xO=so&&so.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oUe(e,t,n)};Object.defineProperty(so,"__esModule",{value:!0});xO(g3(),so);xO(R3(),so);xO(yO(),so)});var H3=f(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.PACKAGE_NAME=Qa.PACKAGE_VERSION=void 0;Qa.PACKAGE_VERSION="0.45.2";Qa.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var HO=f(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.HapiLifecycleMethodNames=vr.HapiLayerType=vr.handlerPatched=vr.HapiComponentName=void 0;vr.HapiComponentName="@hapi/hapi";vr.handlerPatched=Symbol("hapi-handler-patched");vr.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};vr.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var kO=f(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.AttributeNames=void 0;var TUe;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(TUe=fl.AttributeNames||(fl.AttributeNames={}))});var k3=f(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getPluginFromInput=Xe.getExtMetadata=Xe.getRouteMetadata=Xe.isPatchableExtMethod=Xe.isDirectExtInput=Xe.isLifecycleExtEventObj=Xe.isLifecycleExtType=Xe.getPluginName=void 0;var Xf=(de(),I(je)),Sl=HO(),as=kO();function mUe(t){return t.name?t.name:t.pkg.name}Xe.getPluginName=mUe;var hUe=t=>typeof t=="string"&&Sl.HapiLifecycleMethodNames.has(t);Xe.isLifecycleExtType=hUe;var gUe=t=>{var e;let n=(e=t)===null||e===void 0?void 0:e.type;return n!==void 0&&(0,Xe.isLifecycleExtType)(n)};Xe.isLifecycleExtEventObj=gUe;var AUe=t=>Array.isArray(t)&&t.length<=3&&(0,Xe.isLifecycleExtType)(t[0])&&typeof t[1]=="function";Xe.isDirectExtInput=AUe;var RUe=t=>!Array.isArray(t);Xe.isPatchableExtMethod=RUe;var OUe=(t,e)=>e?{attributes:{[Xf.SEMATTRS_HTTP_ROUTE]:t.path,[Xf.SEMATTRS_HTTP_METHOD]:t.method,[as.AttributeNames.HAPI_TYPE]:Sl.HapiLayerType.PLUGIN,[as.AttributeNames.PLUGIN_NAME]:e},name:`${e}: route - ${t.path}`}:{attributes:{[Xf.SEMATTRS_HTTP_ROUTE]:t.path,[Xf.SEMATTRS_HTTP_METHOD]:t.method,[as.AttributeNames.HAPI_TYPE]:Sl.HapiLayerType.ROUTER},name:`route - ${t.path}`};Xe.getRouteMetadata=OUe;var NUe=(t,e)=>e?{attributes:{[as.AttributeNames.EXT_TYPE]:t,[as.AttributeNames.HAPI_TYPE]:Sl.HapiLayerType.EXT,[as.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ext - ${t}`}:{attributes:{[as.AttributeNames.EXT_TYPE]:t,[as.AttributeNames.HAPI_TYPE]:Sl.HapiLayerType.EXT},name:`ext - ${t}`};Xe.getExtMetadata=NUe;var IUe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;Xe.getPluginFromInput=IUe});var $3=f(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});Jf.HapiInstrumentation=void 0;var En=(y(),I(x)),F3=oe(),zf=te(),j3=H3(),Tl=HO(),ao=k3(),FO=class extends zf.InstrumentationBase{constructor(e={}){super(j3.PACKAGE_NAME,j3.PACKAGE_VERSION,e)}init(){return new zf.InstrumentationNodeModuleDefinition(Tl.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,zf.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,zf.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,ao.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,ao.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,ao.isLifecycleExtType)(c.type)){let u=c,l=r._wrapExtMethods(u.method,c.type,n);u.method=l,i[a]=u}}return e.apply(this,s)}else if((0,ao.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,ao.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,ao.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",u=>n._getServerRoutePatch.bind(n)(u,r)),s._wrap(a,"ext",u=>n._getServerExtPatch.bind(n)(u,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,ao.isPatchableExtMethod)(e))return e[Tl.handlerPatched]===!0?e:(e[Tl.handlerPatched]=!0,async function(...i){if(En.trace.getSpan(En.context.active())===void 0)return await e.apply(this,i);let a=(0,ao.getExtMetadata)(n,r),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await En.context.with(En.trace.setSpan(En.context.active(),c),e,void 0,...i)}catch(u){throw c.recordException(u),c.setStatus({code:En.SpanStatusCode.ERROR,message:u.message}),u}finally{c.end()}});return e}_wrapRouteHandler(e,n){var r;let o=this;if(e[Tl.handlerPatched]===!0)return e;e[Tl.handlerPatched]=!0;let s=i=>async function(...a){if(En.trace.getSpan(En.context.active())===void 0)return await i.call(this,...a);let c=(0,F3.getRPCMetadata)(En.context.active());c?.type===F3.RPCType.HTTP&&(c.route=e.path);let u=(0,ao.getRouteMetadata)(e,n),l=o.tracer.startSpan(u.name,{attributes:u.attributes});try{return await En.context.with(En.trace.setSpan(En.context.active(),l),()=>i.call(this,...a))}catch(p){throw l.recordException(p),l.setStatus({code:En.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=s(e.handler);else if(typeof e.options=="function"){let i=e.options;e.options=function(a){let c=i(a);return typeof c.handler=="function"&&(c.handler=s(c.handler)),c}}else typeof((r=e.options)===null||r===void 0?void 0:r.handler)=="function"&&(e.options.handler=s(e.options.handler));return e}};Jf.HapiInstrumentation=FO});var q3=f(cs=>{"use strict";var CUe=cs&&cs.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),Y3=cs&&cs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&CUe(e,t,n)};Object.defineProperty(cs,"__esModule",{value:!0});Y3($3(),cs);Y3(kO(),cs)});var Qf=f(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.KoaLayerType=void 0;var MUe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(MUe=ml.KoaLayerType||(ml.KoaLayerType={}))});var J3=f(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.PACKAGE_NAME=Za.PACKAGE_VERSION=void 0;Za.PACKAGE_VERSION="0.47.1";Za.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var jO=f(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.AttributeNames=void 0;var yUe;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(yUe=hl.AttributeNames||(hl.AttributeNames={}))});var Z3=f(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.isLayerIgnored=ec.getMiddlewareMetadata=void 0;var Q3=Qf(),Zf=jO(),vUe=(de(),I(je)),bUe=(t,e,n,r)=>{var o;return n?{attributes:{[Zf.AttributeNames.KOA_NAME]:r?.toString(),[Zf.AttributeNames.KOA_TYPE]:Q3.KoaLayerType.ROUTER,[vUe.SEMATTRS_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[Zf.AttributeNames.KOA_NAME]:(o=e.name)!==null&&o!==void 0?o:"middleware",[Zf.AttributeNames.KOA_TYPE]:Q3.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};ec.getMiddlewareMetadata=bUe;var LUe=(t,e)=>{var n;return!!(Array.isArray(e?.ignoreLayersType)&&(!((n=e?.ignoreLayersType)===null||n===void 0)&&n.includes(t)))};ec.isLayerIgnored=LUe});var ez=f(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.kLayerPatched=void 0;eS.kLayerPatched=Symbol("koa-layer-patched")});var iz=f(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.KoaInstrumentation=void 0;var br=(y(),I(x)),gl=te(),tz=Qf(),nz=J3(),rz=Z3(),oz=oe(),sz=ez(),$O=class extends gl.InstrumentationBase{constructor(e={}){super(nz.PACKAGE_NAME,nz.PACKAGE_VERSION,e)}init(){return new gl.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <3"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,gl.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,gl.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){var n;br.diag.debug("Patching @koa/router dispatch");let r=e.router,o=(n=r?.stack)!==null&&n!==void 0?n:[];for(let s of o){let i=s.path,a=s.stack;for(let c=0;c<a.length;c++){let u=a[c];a[c]=this._patchLayer(u,!0,i)}}return e}_patchLayer(e,n,r){let o=n?tz.KoaLayerType.ROUTER:tz.KoaLayerType.MIDDLEWARE;return e[sz.kLayerPatched]===!0||(0,rz.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(br.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[sz.kLayerPatched]=!0,br.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(br.trace.getSpan(br.context.active())===void 0)return e(s,i);let c=(0,rz.getMiddlewareMetadata)(s,e,n,r),u=this.tracer.startSpan(c.name,{attributes:c.attributes}),l=(0,oz.getRPCMetadata)(br.context.active());l?.type===oz.RPCType.HTTP&&s._matchedRoute&&(l.route=s._matchedRoute.toString());let{requestHook:p}=this.getConfig();p&&(0,gl.safeExecuteInTheMiddle)(()=>p(u,{context:s,middlewareLayer:e,layerType:o}),_=>{_&&br.diag.error("koa instrumentation: request hook failed",_)},!0);let d=br.trace.setSpan(br.context.active(),u);return br.context.with(d,async()=>{try{return await e(s,i)}catch(_){throw u.recordException(_),_}finally{u.end()}})})}};tS.KoaInstrumentation=$O});var az=f(co=>{"use strict";var DUe=co&&co.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),YO=co&&co.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&DUe(e,t,n)};Object.defineProperty(co,"__esModule",{value:!0});YO(iz(),co);YO(Qf(),co);YO(jO(),co)});var qO=f(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.ConnectNames=er.ConnectTypes=er.AttributeNames=void 0;var UUe;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(UUe=er.AttributeNames||(er.AttributeNames={}));var wUe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(wUe=er.ConnectTypes||(er.ConnectTypes={}));var VUe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(VUe=er.ConnectNames||(er.ConnectNames={}))});var dz=f(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.PACKAGE_NAME=tc.PACKAGE_VERSION=void 0;tc.PACKAGE_VERSION="0.43.1";tc.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var _z=f(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS._LAYERS_STORE_PROPERTY=void 0;nS._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var Ez=f(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.generateRoute=ls.replaceCurrentStackRoute=ls.addNewStackLayer=void 0;var BUe=(y(),I(x)),us=_z(),GUe=t=>{Array.isArray(t[us._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,us._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[us._LAYERS_STORE_PROPERTY].push("/");let e=t[us._LAYERS_STORE_PROPERTY].length;return()=>{e===t[us._LAYERS_STORE_PROPERTY].length?t[us._LAYERS_STORE_PROPERTY].pop():BUe.diag.warn("Connect: Trying to pop the stack multiple time")}};ls.addNewStackLayer=GUe;var HUe=(t,e)=>{e&&t[us._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ls.replaceCurrentStackRoute=HUe;var kUe=t=>t[us._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ls.generateRoute=kUe});var Tz=f(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.ConnectInstrumentation=ps.ANONYMOUS_NAME=void 0;var FUe=(y(),I(x)),fz=oe(),nc=qO(),Sz=dz(),rS=te(),jUe=(de(),I(je)),KO=Ez();ps.ANONYMOUS_NAME="anonymous";var WO=class extends rS.InstrumentationBase{constructor(e={}){super(Sz.PACKAGE_NAME,Sz.PACKAGE_VERSION,e)}init(){return[new rS.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,rS.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,rS.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=nc.ConnectTypes.REQUEST_HANDLER,s=nc.ConnectNames.REQUEST_HANDLER,o=e):(r=nc.ConnectTypes.MIDDLEWARE,s=nc.ConnectNames.MIDDLEWARE,o=n.name||ps.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[jUe.SEMATTRS_HTTP_ROUTE]:e.length>0?e:"/",[nc.AttributeNames.CONNECT_TYPE]:r,[nc.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],u=arguments[i],l=arguments[a],p=arguments[c];(0,KO.replaceCurrentStackRoute)(u,e);let d=(0,fz.getRPCMetadata)(FUe.context.active());e&&d?.type===fz.RPCType.HTTP&&(d.route=(0,KO.generateRoute)(u));let _="";e?_=`request handler - ${e}`:_=`middleware - ${n.name||ps.ANONYMOUS_NAME}`;let E=r._startSpan(e,n);r._diag.debug("start span",_);let S=!1;function T(){S?r._diag.debug(`span ${E.name} - already finished`):(S=!0,r._diag.debug(`finishing span ${E.name}`),E.end()),l.removeListener("close",T)}return l.addListener("close",T),arguments[c]=r._patchNext(p,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,KO.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)}}};ps.ConnectInstrumentation=WO});var hz=f(ds=>{"use strict";var $Ue=ds&&ds.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),mz=ds&&ds.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$Ue(e,t,n)};Object.defineProperty(ds,"__esModule",{value:!0});mz(qO(),ds);mz(Tz(),ds)});var Nz=f(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.once=rc.getSpanName=void 0;function qUe(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}rc.getSpanName=qUe;var KUe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};rc.once=KUe});var Iz=f(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.PACKAGE_NAME=oc.PACKAGE_VERSION=void 0;oc.PACKAGE_VERSION="0.18.1";oc.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var vz=f(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.TediousInstrumentation=void 0;var Al=(y(),I(x)),WUe=require("events"),oS=te(),_s=(de(),I(je)),Cz=Nz(),Pz=Iz(),yz=Symbol("opentelemetry.instrumentation-tedious.current-database"),Mz=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function sS(t){Object.defineProperty(this,yz,{value:t,writable:!0})}var iS=class t extends oS.InstrumentationBase{constructor(e={}){super(Pz.PACKAGE_NAME,Pz.PACKAGE_VERSION,e)}init(){return[new oS.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of Mz)(0,oS.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r));return(0,oS.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 Mz)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){var r,o;return sS.call(this,(o=(r=this.config)===null||r===void 0?void 0:r.options)===null||o===void 0?void 0:o.database),this.removeListener("databaseChange",sS),this.on("databaseChange",sS),this.once("end",()=>{this.removeListener("databaseChange",sS)}),e.apply(this,arguments)}}_patchQuery(e){return n=>{let r=this;function o(s){var i,a,c,u,l,p,d,_;if(!(s instanceof WUe.EventEmitter))return r._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),n.apply(this,arguments);let E=0,S=0,T=()=>S++,h=()=>E++,R=this[yz],O=(M=>{var v,X;return M.sqlTextOrProcedure==="sp_prepare"&&(!((X=(v=M.parametersByName)===null||v===void 0?void 0:v.stmt)===null||X===void 0)&&X.value)?M.parametersByName.stmt.value:M.sqlTextOrProcedure})(s),N=r.tracer.startSpan((0,Cz.getSpanName)(e,R,O,s.table),{kind:Al.SpanKind.CLIENT,attributes:{[_s.SEMATTRS_DB_SYSTEM]:_s.DBSYSTEMVALUES_MSSQL,[_s.SEMATTRS_DB_NAME]:R,[_s.SEMATTRS_NET_PEER_PORT]:(a=(i=this.config)===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.port,[_s.SEMATTRS_NET_PEER_NAME]:(c=this.config)===null||c===void 0?void 0:c.server,[_s.SEMATTRS_DB_USER]:(l=(u=this.config)===null||u===void 0?void 0:u.userName)!==null&&l!==void 0?l:(_=(d=(p=this.config)===null||p===void 0?void 0:p.authentication)===null||d===void 0?void 0:d.options)===null||_===void 0?void 0:_.userName,[_s.SEMATTRS_DB_STATEMENT]:O,[_s.SEMATTRS_DB_SQL_TABLE]:s.table}}),A=(0,Cz.once)(M=>{s.removeListener("done",T),s.removeListener("doneInProc",T),s.removeListener("doneProc",h),s.removeListener("error",A),this.removeListener("end",A),N.setAttribute("tedious.procedure_count",E),N.setAttribute("tedious.statement_count",S),M&&N.setStatus({code:Al.SpanStatusCode.ERROR,message:M.message}),N.end()});return s.on("done",T),s.on("doneInProc",T),s.on("doneProc",h),s.once("error",A),this.on("end",A),typeof s.callback=="function"?r._wrap(s,"callback",r._patchCallbackQuery(A)):r._diag.error("Expected request.callback to be a function"),Al.context.with(Al.trace.setSpan(Al.context.active(),N),n,this,...arguments)}return Object.defineProperty(o,"length",{value:n.length,writable:!1}),o}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};aS.TediousInstrumentation=iS;iS.COMPONENT="tedious"});var Lz=f(bz=>{"use strict";Object.defineProperty(bz,"__esModule",{value:!0})});var xz=f(Es=>{"use strict";var XUe=Es&&Es.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),Dz=Es&&Es.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&XUe(e,t,n)};Object.defineProperty(Es,"__esModule",{value:!0});Dz(vz(),Es);Dz(Lz(),Es)});var Gz=f(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.PACKAGE_NAME=sc.PACKAGE_VERSION=void 0;sc.PACKAGE_VERSION="0.43.1";sc.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var kz=f(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.GenericPoolInstrumentation=void 0;var ic=(y(),I(x)),oi=te(),Hz=Gz(),XO="generic-pool",zO=class extends oi.InstrumentationBase{constructor(e={}){super(Hz.PACKAGE_NAME,Hz.PACKAGE_VERSION,e),this._isDisabled=!1}init(){return[new oi.InstrumentationNodeModuleDefinition(XO,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,oi.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 oi.InstrumentationNodeModuleDefinition(XO,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,oi.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 oi.InstrumentationNodeModuleDefinition(XO,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,oi.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=ic.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return ic.context.with(ic.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=ic.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return ic.context.with(ic.trace.setSpan(i,a),()=>{e.call(this,(c,u)=>{if(a.end(),o)return o(c,u)},s)})}}};cS.GenericPoolInstrumentation=zO});var Fz=f(si=>{"use strict";var QUe=si&&si.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),ZUe=si&&si.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&QUe(e,t,n)};Object.defineProperty(si,"__esModule",{value:!0});ZUe(kz(),si)});var JO=f(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.DEFAULT_CONFIG=ii.EndOperation=void 0;var t0e;(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"})(t0e=ii.EndOperation||(ii.EndOperation={}));ii.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var zz=f(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.isConfirmChannelTracing=De.unmarkConfirmChannelTracing=De.markConfirmChannelTracing=De.getConnectionAttributesFromUrl=De.getConnectionAttributesFromServer=De.normalizeExchange=De.CONNECTION_ATTRIBUTES=De.CHANNEL_CONSUME_TIMEOUT_TIMER=De.CHANNEL_SPANS_NOT_ENDED=De.MESSAGE_STORED_SPAN=void 0;var QO=(y(),I(x)),uo=(de(),I(je));De.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");De.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");De.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");De.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var ZO=(0,QO.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),n0e=t=>t!==""?t:"<default>";De.normalizeExchange=n0e;var r0e=t=>t.replace(/:[^:@/]*@/,":***@"),Kz=(t,e)=>t||(e==="AMQP"?5672:5671),Wz=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},Xz=t=>t||"localhost",ac=(t,e,n,r)=>n?{[e]:n}:(QO.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),o0e=t=>{var e,n;let r=(n=(e=t.serverProperties.product)===null||e===void 0?void 0:e.toLowerCase)===null||n===void 0?void 0:n.call(e);return r?{[uo.SEMATTRS_MESSAGING_SYSTEM]:r}:{}};De.getConnectionAttributesFromServer=o0e;var s0e=t=>{let e={[uo.SEMATTRS_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let n=t,r=Wz(n?.protocol);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_MESSAGING_PROTOCOL,r,"protocol")));let o=Xz(n?.hostname);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_NET_PEER_NAME,o,"hostname")));let s=Kz(n.port,r);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_NET_PEER_PORT,s,"port")))}else{let n=r0e(t);e[uo.SEMATTRS_MESSAGING_URL]=n;try{let r=new URL(n),o=Wz(r.protocol);Object.assign(e,Object.assign({},ac(n,uo.SEMATTRS_MESSAGING_PROTOCOL,o,"protocol")));let s=Xz(r.hostname);Object.assign(e,Object.assign({},ac(n,uo.SEMATTRS_NET_PEER_NAME,s,"hostname")));let i=Kz(r.port?parseInt(r.port):void 0,o);Object.assign(e,Object.assign({},ac(n,uo.SEMATTRS_NET_PEER_PORT,i,"port")))}catch(r){QO.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:n,err:r})}}return e};De.getConnectionAttributesFromUrl=s0e;var i0e=t=>t.setValue(ZO,!0);De.markConfirmChannelTracing=i0e;var a0e=t=>t.deleteValue(ZO);De.unmarkConfirmChannelTracing=a0e;var c0e=t=>t.getValue(ZO)===!0;De.isConfirmChannelTracing=c0e});var Jz=f(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.PACKAGE_NAME=cc.PACKAGE_VERSION=void 0;cc.PACKAGE_VERSION="0.46.1";cc.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Zz=f(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.AmqplibInstrumentation=void 0;var Pe=(y(),I(x)),uS=oe(),le=te(),rn=(de(),I(je)),Ft=JO(),xe=zz(),Qz=Jz(),lS=[">=0.5.5 <1"],eN=class extends le.InstrumentationBase{constructor(e={}){super(Qz.PACKAGE_NAME,Qz.PACKAGE_VERSION,Object.assign(Object.assign({},Ft.DEFAULT_CONFIG),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},Ft.DEFAULT_CONFIG),e))}init(){let e=new le.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",lS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new le.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",lS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new le.InstrumentationNodeModuleFile("amqplib/lib/connect.js",lS,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new le.InstrumentationNodeModuleDefinition("amqplib",lS,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,le.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,le.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,le.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,le.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,le.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,Ft.EndOperation.Ack)),(0,le.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,Ft.EndOperation.Nack)),(0,le.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,Ft.EndOperation.Reject)),(0,le.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,Ft.EndOperation.AckAll)),(0,le.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,Ft.EndOperation.NackAll)),(0,le.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,le.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,le.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,le.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,le.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,le.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,le.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,le.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,le.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,le.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,le.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){return function(r,o,s){return e.call(this,r,o,function(i,a){if(i==null){let c=(0,xe.getConnectionAttributesFromUrl)(r),u=(0,xe.getConnectionAttributesFromServer)(a);a[xe.CONNECTION_ATTRIBUTES]=Object.assign(Object.assign({},c),u)}s.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,Ft.EndOperation.ChannelClosed,void 0);let s=this[xe.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[xe.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,Ft.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){var u;let l=this,p=n===Ft.EndOperation.Reject?a:c,d=(u=l[xe.CHANNEL_SPANS_NOT_ENDED])!==null&&u!==void 0?u:[],_=d.findIndex(E=>E.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==Ft.EndOperation.Reject&&a){for(let E=0;E<=_;E++)o.endConsumerSpan(d[E].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,xe.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:l}=r.getConfig();if(l){let p=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},l);p.unref(),c[xe.CHANNEL_CONSUME_TIMEOUT_TIMER]=p}c[xe.CHANNEL_SPANS_NOT_ENDED]=[]}let u=function(l){var p,d,_,E,S;if(!l)return i.call(this,l);let T=(p=l.properties.headers)!==null&&p!==void 0?p:{},h=Pe.propagation.extract(Pe.ROOT_CONTEXT,T),R=(d=l.fields)===null||d===void 0?void 0:d.exchange,O;if(r._config.useLinksForConsume){let v=h?(_=Pe.trace.getSpan(h))===null||_===void 0?void 0:_.spanContext():void 0;h=void 0,v&&(O=[{context:v}])}let N=r.tracer.startSpan(`${s} process`,{kind:Pe.SpanKind.CONSUMER,attributes:Object.assign(Object.assign({},(E=c?.connection)===null||E===void 0?void 0:E[xe.CONNECTION_ATTRIBUTES]),{[rn.SEMATTRS_MESSAGING_DESTINATION]:R,[rn.SEMATTRS_MESSAGING_DESTINATION_KIND]:rn.MESSAGINGDESTINATIONKINDVALUES_TOPIC,[rn.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY]:(S=l.fields)===null||S===void 0?void 0:S.routingKey,[rn.SEMATTRS_MESSAGING_OPERATION]:rn.MESSAGINGOPERATIONVALUES_PROCESS,[rn.SEMATTRS_MESSAGING_MESSAGE_ID]:l?.properties.messageId,[rn.SEMATTRS_MESSAGING_CONVERSATION_ID]:l?.properties.correlationId}),links:O},h),{consumeHook:A}=r.getConfig();A&&(0,le.safeExecuteInTheMiddle)(()=>A(N,{moduleVersion:e,msg:l}),v=>{v&&Pe.diag.error("amqplib instrumentation: consumerHook error",v)},!0),a?.noAck||(c[xe.CHANNEL_SPANS_NOT_ENDED].push({msg:l,timeOfConsume:(0,uS.hrTime)()}),l[xe.MESSAGE_STORED_SPAN]=N);let M=h||Pe.ROOT_CONTEXT;Pe.context.with(Pe.trace.setSpan(M,N),()=>{i.call(this,l)}),a?.noAck&&(r.callConsumeEndHook(N,l,!1,Ft.EndOperation.AutoAck),N.end())};return arguments[1]=u,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,u){let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,le.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!0}),h=>{h&&Pe.diag.error("amqplib instrumentation: publishHook error",h)},!0);let E=function(h,R){try{u?.call(this,h,R)}finally{let{publishConfirmHook:O}=r.getConfig();O&&(0,le.safeExecuteInTheMiddle)(()=>O(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:h}),N=>{N&&Pe.diag.error("amqplib instrumentation: publishConfirmHook error",N)},!0),h&&p.setStatus({code:Pe.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),p.end()}},S=(0,xe.markConfirmChannelTracing)(Pe.context.active()),T=[...arguments];return T[3]=d,T[4]=Pe.context.bind((0,xe.unmarkConfirmChannelTracing)(Pe.trace.setSpan(S,p)),E),Pe.context.with(S,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,xe.isConfirmChannelTracing)(Pe.context.active()))return n.apply(this,arguments);{let u=this,{span:l,modifiedOptions:p}=r.createPublishSpan(r,s,i,u,c),{publishHook:d}=r.getConfig();d&&(0,le.safeExecuteInTheMiddle)(()=>d(l,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:p,isConfirmChannel:!1}),S=>{S&&Pe.diag.error("amqplib instrumentation: publishHook error",S)},!0);let _=[...arguments];_[3]=p;let E=n.apply(this,_);return l.end(),E}}}createPublishSpan(e,n,r,o,s){var i;let a=(0,xe.normalizeExchange)(n),c=e.tracer.startSpan(`publish ${a}`,{kind:Pe.SpanKind.PRODUCER,attributes:Object.assign(Object.assign({},o.connection[xe.CONNECTION_ATTRIBUTES]),{[rn.SEMATTRS_MESSAGING_DESTINATION]:n,[rn.SEMATTRS_MESSAGING_DESTINATION_KIND]:rn.MESSAGINGDESTINATIONKINDVALUES_TOPIC,[rn.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[rn.SEMATTRS_MESSAGING_MESSAGE_ID]:s?.messageId,[rn.SEMATTRS_MESSAGING_CONVERSATION_ID]:s?.correlationId})}),u=s??{};return u.headers=(i=u.headers)!==null&&i!==void 0?i:{},Pe.propagation.inject(Pe.trace.setSpan(Pe.context.active(),c),u.headers),{span:c,modifiedOptions:u}}endConsumerSpan(e,n,r,o){let s=e[xe.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Pe.SpanStatusCode.ERROR,message:r!==Ft.EndOperation.ChannelClosed&&r!==Ft.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[xe.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){var s;((s=e[xe.CHANNEL_SPANS_NOT_ENDED])!==null&&s!==void 0?s:[]).forEach(a=>{this.endConsumerSpan(a.msg,n,r,o)}),e[xe.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,le.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Pe.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){var n;let r=(0,uS.hrTime)(),o=(n=e[xe.CHANNEL_SPANS_NOT_ENDED])!==null&&n!==void 0?n:[],s,{consumeTimeoutMs:i}=this.getConfig();for(s=0;s<o.length;s++){let a=o[s],c=(0,uS.hrTimeDuration)(a.timeOfConsume,r);if((0,uS.hrTimeToMilliseconds)(c)<i)break;this.endConsumerSpan(a.msg,null,Ft.EndOperation.InstrumentationTimeout,!0)}o.splice(0,s)}};pS.AmqplibInstrumentation=eN});var t8=f(fs=>{"use strict";var u0e=fs&&fs.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),e8=fs&&fs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&u0e(e,t,n)};Object.defineProperty(fs,"__esModule",{value:!0});e8(Zz(),fs);e8(JO(),fs)});var R8=require("commander"),Nl=C(require("crypto")),O8=C(require("fs")),Lt=C(require("os")),ai=C(require("path")),N8=require("child_process"),I8=require("util");var bl=require("child_process"),uN=require("util"),_o=C(require("fs")),Ll=C(require("os")),RS=C(require("path"));var xr="6820f6e91b762e645c9bf020c0d3673bb99d4a25a824880c0d548e10bb9bc7b1";var nr=(0,uN.promisify)(bl.execFile),OS=RS.join(Ll.homedir(),".visa-mcp"),lc=RS.join(OS,"session-token"),Sn="visa-cli",po="session-token",yl="rc-access",V8=5e3,vl=class extends Error{constructor(e){super(e),this.name="CredentialAccessError"}};function B8(t){let e=t;return[e?.message,e?.stderr].filter(n=>typeof n=="string").join(`
|
|
12
|
-
`)}function lN(t){let e=t;if(e?.code==="EPERM"||e?.code==="EACCES")return!0;let n=B8(t).toLowerCase();return n.includes("operation not permitted")||n.includes("permission denied")}async function G8(){try{let{stdout:t}=await nr("security",["find-generic-password","-s",Sn,"-a",po,"-w"],{timeout:5e3});return t.trim()||null}catch(t){if(lN(t))throw new vl("Unable to read Visa CLI credentials from macOS Keychain. In sandboxed agents such as Codex, rerun with keychain access or run this command outside the sandbox.");return null}}async function H8(t){try{try{await nr("security",["delete-generic-password","-s",Sn,"-a",po],{timeout:5e3})}catch{}return await nr("security",["add-generic-password","-s",Sn,"-a",po,"-w",t],{timeout:5e3}),!0}catch{return!1}}async function k8(){try{await nr("security",["delete-generic-password","-s",Sn,"-a",po],{timeout:5e3})}catch{}}async function F8(){if(!NS())return null;try{let{stdout:t}=await nr("secret-tool",["lookup","service",Sn,"account",po],{timeout:5e3});return t.trim()||null}catch{return null}}async function j8(t){if(!NS())return!1;try{let e=(0,bl.execFile)("secret-tool",["store","--label",`${Sn} ${po}`,"service",Sn,"account",po]);return e.stdin?(e.stdin.write(t),e.stdin.end(),await Promise.race([new Promise((n,r)=>{e.on("exit",o=>o===0?n():r(new Error(`secret-tool exited ${o}`))),e.on("error",r)}),new Promise((n,r)=>setTimeout(()=>{e.kill(),r(new Error("secret-tool timed out"))},V8))]),!0):!1}catch{return!1}}async function $8(){if(NS())try{await nr("secret-tool",["clear","service",Sn,"account",po],{timeout:5e3})}catch{}}function NS(){return!!process.env.DBUS_SESSION_BUS_ADDRESS}async function Y8(){try{let{stdout:t}=await nr("security",["find-generic-password","-s",Sn,"-a",yl,"-w"],{timeout:5e3});return t.trim()||null}catch{return null}}async function q8(t){try{try{await nr("security",["delete-generic-password","-s",Sn,"-a",yl],{timeout:5e3})}catch{}await nr("security",["add-generic-password","-s",Sn,"-a",yl,"-w",t],{timeout:5e3})}catch{}}async function K8(){try{await nr("security",["delete-generic-password","-s",Sn,"-a",yl],{timeout:5e3})}catch{}}function gS(){try{return _o.readFileSync(lc,"utf-8").trim()||null}catch(t){if(lN(t))throw new vl(`Unable to read Visa CLI credentials from ${lc}. Check file permissions or rerun with access to the Visa CLI credential directory.`);return null}}function pN(t){_o.mkdirSync(OS,{recursive:!0,mode:448}),_o.writeFileSync(lc,t,{mode:384}),process.platform==="win32"&&W8(lc)}function AS(){try{_o.unlinkSync(lc)}catch{}}function W8(t){try{let e=Ll.userInfo().username;(0,bl.execFile)("icacls",[t,"/inheritance:r","/grant:r",`${e}:F`],{timeout:5e3},n=>{n&&console.error(`[visa-cli] icacls ACL restriction failed: ${n.message}`)})}catch(e){console.error(`[visa-cli] Failed to invoke icacls: ${e instanceof Error?e.message:String(e)}`)}}function hS(){switch(process.platform){case"darwin":return{get:G8,store:H8,delete:k8};case"linux":return{get:F8,store:j8,delete:$8};default:return{get:async()=>gS(),store:async t=>{try{return pN(t),!0}catch{return!1}},delete:async()=>AS(),storesInSessionFile:!0}}}var Oe=class{static async getSessionToken(){if(process.env.VISA_MOCK_KEYCHAIN==="true")return Promise.resolve("mock-session-token-for-testing");let e=hS(),n=await e.get();if(n)return n;let r=gS();return r?(await e.store(r),r):null}static async saveSessionToken(e){if(process.env.VISA_MOCK_KEYCHAIN==="true")return;let n=hS();if(await n.store(e)){if(await n.get()===e){n.storesInSessionFile||AS();return}await n.delete()}if(pN(e),gS()!==e)throw new Error("Failed to persist session token. "+(process.platform==="darwin"?'Check Keychain Access permissions for "visa-cli".':`Ensure ${OS} is writable.`))}static async getRcAccessToken(){return process.env.VISA_MOCK_KEYCHAIN==="true"?xr:Y8()}static async saveRcAccessToken(e){process.env.VISA_MOCK_KEYCHAIN!=="true"&&await q8(e)}static async deleteSessionToken(){if(process.env.VISA_MOCK_KEYCHAIN==="true")return;await hS().delete(),AS()}static async clearAll(){await this.deleteSessionToken(),await K8()}};var Dl=C(require("crypto")),xl=C(require("tty")),Ul=C(require("fs"));function z8(t){return/-rc\.|-beta\./.test(t)}function CS(t){return Dl.createHash("sha256").update(t.trim()).digest("hex")}function dN(t){return xr==="SKIP"?!0:Dl.timingSafeEqual(Buffer.from(CS(t)),Buffer.from(xr))}function J8(){try{let t=Ul.openSync("/dev/tty","r+"),e=new xl.ReadStream(t),n=new xl.WriteStream(t),r=!1;return{input:e,output:n,cleanupStreams:()=>{if(!r){r=!0;try{e.destroy()}catch{}try{n.destroy()}catch{}try{Ul.closeSync(t)}catch{}}}}}catch{if(!process.stdin.isTTY)throw new Error("No interactive terminal available. Set VISA_RC_CODE env var instead.");return{input:process.stdin,output:process.stderr,cleanupStreams:()=>{}}}}function Q8(t){return new Promise((e,n)=>{let r;try{r=J8()}catch(l){n(l);return}let{input:o,output:s,cleanupStreams:i}=r,a=()=>{o.off("data",u);try{o.setRawMode?.(!1)}catch{}i()};s.write(t),o.setRawMode?.(!0),o.resume(),o.setEncoding("utf8");let c="",u=l=>{l==="\r"||l===`
|
|
13
|
-
`?(s.write(`
|
|
14
|
-
`),a(),e(c)):l===""?(s.write(`
|
|
15
|
-
`),a(),n(new Error("Cancelled"))):l==="\x7F"||l==="\b"?c.length>0&&(c=c.slice(0,-1),s.write("\b \b")):(c+=l,s.write("\u2022"))};o.on("data",u)})}var Z8=`
|
|
1
|
+
"use strict";var Rl=Object.create;var ms=Object.defineProperty;var $l=Object.getOwnPropertyDescriptor;var Il=Object.getOwnPropertyNames;var Pl=Object.getPrototypeOf,Ml=Object.prototype.hasOwnProperty;var Ol=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qo=(e,t)=>{for(var n in t)ms(e,n,{get:t[n],enumerable:!0})},Nl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Il(t))!Ml.call(e,s)&&s!==n&&ms(e,s,{get:()=>t[s],enumerable:!(r=$l(t,s))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?Rl(Pl(e)):{},Nl(t||!e||!e.__esModule?ms(n,"default",{value:e,enumerable:!0}):n,e));var ar=Xo((ch,Wl)=>{Wl.exports={name:"@visa/cli",version:"2.0.0",description:"AI-powered payments for Claude Code",bin:{"visa-cli":"./bin/visa-cli.js"},scripts:{prebuild:"pnpm --filter @visa/money build && pnpm --filter @visa-cli/tools build",build:"tsc --noEmit && node esbuild.config.js",dev:"tsc --watch",pretest:"pnpm build",start:"node dist/mcp-server/index.js",test:"jest --config jest.config.js","test:unit":"jest --config jest.config.js","test:unit:watch":"jest --config jest.config.js --watch","test:unit:coverage":"jest --config jest.config.js --coverage","test:smoke":"VISA_AUTH_URL=https://auth.visacli.sh jest --config jest.smoke.config.js","test:integration":"jest --config jest.integration.config.js","test:e2e":"jest --config jest.e2e.config.js","test:catalog-e2e":"jest --config jest.catalog-e2e.config.js","test:all":"npm run test:unit && npm run test:integration && npm run test:e2e",prepublishOnly:"npm run build && npm test",lint:"eslint src/**/*.ts",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"'},keywords:["visa","checkout","mcp","ai-agent","payments","click-to-pay","usdc","stablecoin"],author:"Visa Crypto Labs",license:"SEE LICENSE IN LICENSE",dependencies:{"@modelcontextprotocol/sdk":"^1.0.0",commander:"^12.1.0",zod:"^3.23.0"},devDependencies:{"@visa/money":"workspace:*","@visa/observability":"workspace:*","@visa-cli/tools":"workspace:*","@changesets/changelog-git":"^0.2.1","@changesets/cli":"^2.31.0","@types/jest":"^30.0.0","@types/node":"^25.7.0","@typescript-eslint/eslint-plugin":"^8.59.3","@typescript-eslint/parser":"^8.59.3","@types/express":"^5.0.0",esbuild:"^0.27.4",express:"^4.21.0",eslint:"^10.0.2","eslint-config-prettier":"^10.1.8",jest:"^29.7.0",prettier:"^3.8.3","ts-jest":"^29.2.0",typescript:"^5.7.0"},engines:{node:">=18.0.0"},mcpName:"io.github.visa-crypto-labs/visa-cli",files:["bin/visa-cli.js","dist/","install.ps1","install.sh","native/visa-keychain.m","server.json","README.md","LICENSE"]}});var Br=Xo(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.micros=ip;ee.fromCents=ap;ee.fromUsdc=cp;ee.fromUsd=lp;ee.toCents=up;ee.toCentsForAcquirer=dp;ee.toUsdc=mp;ee.toWire=pp;ee.fromWire=fp;ee.toDisplay=gp;ee.toUsdRounded2dp=hp;ee.add=yp;ee.sub=_p;ee.clampNonNegative=vp;ee.isNonNegative=bp;ee.max=Sp;ee.min=wp;var et=10000n,dc=1000000n;function ip(e){return e}function ap(e){if(!Number.isFinite(e)||!Number.isInteger(e)||!Number.isSafeInteger(e))throw new TypeError(`fromCents: expected safe integer, got ${e}`);return BigInt(e)*et}function cp(e){return e}function lp(e){if(!Number.isFinite(e))throw new TypeError(`fromUsd: expected finite number, got ${e}`);return BigInt(Math.round(e*1e6))}function up(e){if(e>=0n)return Number(e/et);let t=e/et,n=e%et;return Number(n===0n?t:t-1n)}function dp(e){if(e<0n)throw new RangeError(`toCentsForAcquirer: refusing negative micros (${e}); card charges are non-negative`);return Number(e/et)}function mp(e){return e}function pp(e){return e.toString()}function fp(e){if(typeof e!="string"||e.length===0)throw new TypeError(`fromWire: expected non-empty string, got ${typeof e} ${JSON.stringify(e)}`);if(!/^-?\d+$/.test(e))throw new TypeError(`fromWire: not a valid micros integer: ${JSON.stringify(e)}`);return BigInt(e)}function gp(e,t={}){let n=t.decimals??2,r=t.symbol??"$",s=e<0n,o=s?-e:e,i=o/dc,a=o%dc,l=s?"-":"";if(n===0)return`${l}${r}${i.toString()}`;let c=a.toString().padStart(6,"0").slice(0,n);return`${l}${r}${i.toString()}.${c}`}function hp(e){let t=e<0n,n=t?-e:e,r=n/et,o=n%et*2n,i;o<et?i=r:o>et?i=r+1n:i=r%2n===0n?r:r+1n;let a=Number(i)/100;return t?-a:a}function yp(e,t){return e+t}function _p(e,t){return e-t}function vp(e){return e<0n?0n:e}function bp(e){return e>=0n}function Sp(e,t){return e>t?e:t}function wp(e,t){return e<t?e:t}});var os={};Qo(os,{initSentry:()=>Sg,isSentryConfigured:()=>bg,reportFatal:()=>wg});function bg(){return!1}async function Sg(){return null}async function wg(e,t){process.exit(t?.exitCode??1)}var is=Ol(()=>{});var ml=require("commander"),er=R(require("crypto")),Oe=R(require("fs")),X=R(require("os")),st=R(require("path")),pl=require("child_process"),fl=R(require("node:readline/promises")),gl=require("util");var or=require("child_process"),li=require("util"),ut=R(require("fs")),ir=R(require("os")),_s=R(require("path"));var ri=R(require("crypto"));var Ke="e9501a252b778bce5a3d77710667afdd9198a750d1d989d95fb32d80e485bf15";var si="VISA_ALLOW_INSECURE_MOCKS",ei,ti,ni;function ps(e){return`${e}-${ri.randomBytes(24).toString("base64url")}`}function oi(e=process.env){return e.NODE_ENV==="test"||e[si]==="true"}function ct(e=process.env){return e.VISA_MOCK_KEYCHAIN==="true"&&oi(e)}function En(e=process.env){return e.VISA_MOCK_TOUCHID==="true"&&oi(e)}function fs(){return`Set ${si}=true only for local debugging; it enables insecure mock credential hooks outside NODE_ENV=test.`}function ii(){return ei??=ps("mock-session"),ei}function ai(e=process.env){return e.NODE_ENV==="test"?Ke:(ti??=ps("mock-rc"),ti)}function ci(){return ni??=ps("mock-signature"),ni}var Ne=(0,li.promisify)(or.execFile),vs=_s.join(ir.homedir(),".visa-mcp"),An=_s.join(vs,"session-token"),Se="visa-cli",lt="session-token",rr="rc-access",Ll=5e3,sr=class extends Error{constructor(t){super(t),this.name="CredentialAccessError"}};function Dl(e){let t=e;return[t?.message,t?.stderr].filter(n=>typeof n=="string").join(`
|
|
2
|
+
`)}function ui(e){let t=e;if(t?.code==="EPERM"||t?.code==="EACCES")return!0;let n=Dl(e).toLowerCase();return n.includes("operation not permitted")||n.includes("permission denied")}async function Ul(){try{let{stdout:e}=await Ne("security",["find-generic-password","-s",Se,"-a",lt,"-w"],{timeout:5e3});return e.trim()||null}catch(e){if(ui(e))throw new sr("Unable to read Visa CLI credentials from macOS Keychain. In sandboxed agents such as Codex, rerun with keychain access or run this command outside the sandbox.");return null}}async function jl(e){try{try{await Ne("security",["delete-generic-password","-s",Se,"-a",lt],{timeout:5e3})}catch{}return await Ne("security",["add-generic-password","-s",Se,"-a",lt,"-w",e],{timeout:5e3}),!0}catch{return!1}}async function ql(){try{await Ne("security",["delete-generic-password","-s",Se,"-a",lt],{timeout:5e3})}catch{}}async function Vl(){if(!bs())return null;try{let{stdout:e}=await Ne("secret-tool",["lookup","service",Se,"account",lt],{timeout:5e3});return e.trim()||null}catch{return null}}async function Fl(e){if(!bs())return!1;try{let t=(0,or.execFile)("secret-tool",["store","--label",`${Se} ${lt}`,"service",Se,"account",lt]);return t.stdin?(t.stdin.write(e),t.stdin.end(),await Promise.race([new Promise((n,r)=>{t.on("exit",s=>s===0?n():r(new Error(`secret-tool exited ${s}`))),t.on("error",r)}),new Promise((n,r)=>setTimeout(()=>{t.kill(),r(new Error("secret-tool timed out"))},Ll))]),!0):!1}catch{return!1}}async function Bl(){if(bs())try{await Ne("secret-tool",["clear","service",Se,"account",lt],{timeout:5e3})}catch{}}function bs(){return!!process.env.DBUS_SESSION_BUS_ADDRESS}async function Hl(){try{let{stdout:e}=await Ne("security",["find-generic-password","-s",Se,"-a",rr,"-w"],{timeout:5e3});return e.trim()||null}catch{return null}}async function Kl(e){try{try{await Ne("security",["delete-generic-password","-s",Se,"-a",rr],{timeout:5e3})}catch{}await Ne("security",["add-generic-password","-s",Se,"-a",rr,"-w",e],{timeout:5e3})}catch{}}async function Gl(){try{await Ne("security",["delete-generic-password","-s",Se,"-a",rr],{timeout:5e3})}catch{}}function hs(){try{return ut.readFileSync(An,"utf-8").trim()||null}catch(e){if(ui(e))throw new sr(`Unable to read Visa CLI credentials from ${An}. Check file permissions or rerun with access to the Visa CLI credential directory.`);return null}}function di(e){ut.mkdirSync(vs,{recursive:!0,mode:448}),ut.writeFileSync(An,e,{mode:384}),process.platform==="win32"&&zl(An)}function ys(){try{ut.unlinkSync(An)}catch{}}function zl(e){try{let t=ir.userInfo().username;(0,or.execFile)("icacls",[e,"/inheritance:r","/grant:r",`${t}:F`],{timeout:5e3},n=>{n&&console.error(`[visa-cli] icacls ACL restriction failed: ${n.message}`)})}catch(t){console.error(`[visa-cli] Failed to invoke icacls: ${t instanceof Error?t.message:String(t)}`)}}function gs(){switch(process.platform){case"darwin":return{get:Ul,store:jl,delete:ql};case"linux":return{get:Vl,store:Fl,delete:Bl};default:return{get:async()=>hs(),store:async e=>{try{return di(e),!0}catch{return!1}},delete:async()=>ys(),storesInSessionFile:!0}}}var D=class{static async getSessionToken(){if(ct())return Promise.resolve(ii());let t=gs(),n=await t.get();if(n)return n;let r=hs();return r?(await t.store(r),r):null}static async saveSessionToken(t){if(ct())return;let n=gs();if(await n.store(t)){if(await n.get()===t){n.storesInSessionFile||ys();return}await n.delete()}if(di(t),hs()!==t)throw new Error("Failed to persist session token. "+(process.platform==="darwin"?'Check Keychain Access permissions for "visa-cli".':`Ensure ${vs} is writable.`))}static async getRcAccessToken(){return ct()?ai():Hl()}static async saveRcAccessToken(t){ct()||await Kl(t)}static async deleteSessionToken(){if(ct())return;await gs().delete(),ys()}static async clearAll(){await this.deleteSessionToken(),await Gl()}};var cr=R(require("crypto")),lr=R(require("tty")),ur=R(require("fs"));function Jl(e){return/-rc\.|-beta\./.test(e)}function Ss(e){return cr.createHash("sha256").update(e.trim()).digest("hex")}function mi(e){return Ke==="SKIP"?!0:cr.timingSafeEqual(Buffer.from(Ss(e)),Buffer.from(Ke))}function Yl(){try{let e=ur.openSync("/dev/tty","r+"),t=new lr.ReadStream(e),n=new lr.WriteStream(e),r=!1;return{input:t,output:n,cleanupStreams:()=>{if(!r){r=!0;try{t.destroy()}catch{}try{n.destroy()}catch{}try{ur.closeSync(e)}catch{}}}}}catch{if(!process.stdin.isTTY)throw new Error("No interactive terminal available. Set VISA_RC_CODE env var instead.");return{input:process.stdin,output:process.stderr,cleanupStreams:()=>{}}}}function Zl(e){return new Promise((t,n)=>{let r;try{r=Yl()}catch(u){n(u);return}let{input:s,output:o,cleanupStreams:i}=r,a=()=>{s.off("data",c);try{s.setRawMode?.(!1)}catch{}i()};o.write(e),s.setRawMode?.(!0),s.resume(),s.setEncoding("utf8");let l="",c=u=>{u==="\r"||u===`
|
|
3
|
+
`?(o.write(`
|
|
4
|
+
`),a(),t(l)):u===""?(o.write(`
|
|
5
|
+
`),a(),n(new Error("Cancelled"))):u==="\x7F"||u==="\b"?l.length>0&&(l=l.slice(0,-1),o.write("\b \b")):(l+=u,o.write("\u2022"))};s.on("data",c)})}var Xl=`
|
|
16
6
|
\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557
|
|
17
7
|
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
18
8
|
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
|
|
@@ -21,38 +11,37 @@ Mongoose Error Code: ${e.code}`:""}`})}function fO(t,e,n,r=void 0){n&&(0,zDe.saf
|
|
|
21
11
|
\u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
22
12
|
|
|
23
13
|
This is a Release Candidate build. Access is restricted to Visa employees.
|
|
24
|
-
`;async function
|
|
25
|
-
`),process.exit(1)}let
|
|
14
|
+
`;async function pi(e={}){let t=e.version??ar().version;if(!Jl(t))return;let n=process.env.VISA_RC_CODE;if(n&&mi(n)){await D.saveRcAccessToken(Ss(n));return}if(e.isMcp??!1){let i=await D.getRcAccessToken();if(i&&(Ke==="SKIP"||i===Ke))return;process.stderr.write(`[visa-cli] RC build requires access. Run: visa-cli setup
|
|
15
|
+
`),process.exit(1)}let s=await D.getRcAccessToken();if(s&&(Ke==="SKIP"||s===Ke))return;console.log(Xl);let o=3;for(let i=1;i<=o;i++){let a;try{a=await Zl(" Enter RC access code: ")}catch{process.exit(1)}if(mi(a)){await D.saveRcAccessToken(Ss(a)),console.log(`
|
|
26
16
|
Access granted. Welcome.
|
|
27
|
-
`);return}i<
|
|
28
|
-
Invalid code. ${
|
|
17
|
+
`);return}i<o&&console.log(`
|
|
18
|
+
Invalid code. ${o-i} attempt(s) remaining.
|
|
29
19
|
`)}console.log(`
|
|
30
20
|
Invalid code. Contact your team lead.
|
|
31
|
-
`),process.exit(1)}var
|
|
32
|
-
`)}function
|
|
33
|
-
`))n(` ${c}`);n("");let
|
|
34
|
-
`)
|
|
35
|
-
${
|
|
36
|
-
${a}`}function
|
|
37
|
-
`);
|
|
38
|
-
`),n=[],r=new Set;for(let
|
|
39
|
-
`)}
|
|
40
|
-
`)),
|
|
41
|
-
`))}
|
|
42
|
-
`)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`)}
|
|
48
|
-
`}function w6(t){return t.tool_name!=null}function V6(t){return fc(t.amount)===0&&t.status==="failed"}function B6(t){return w6(t)&&!V6(t)}function G6(t,e=1/0){let n=new Set,r=[];for(let o of t){if(r.length>=e)break;let s=fo(o.merchant_name,"Unknown merchant"),i=fo(o.tool_name,"unknown_tool"),a=`${s} :: ${i}`;n.has(a)||(n.add(a),r.push(`${s} [${i}]`))}return r}function H6(t){let e=fo(t.merchant_name,"Unknown merchant"),n=fo(t.tool_name,"unknown_tool"),r=fi(fc(t.amount)),o=fo(t.status,"unknown"),s=j6(t.created_at);return`${r} ${o.padEnd(9)} ${e} [${n}] ${s}`}function k6(t){let e=fo(t.brand?.toUpperCase(),"CARD"),n=t.isDefault?" default":"";return`${Number.isInteger(t.id)?`#${t.id} `:""}${e} ****${t.last4}${n}`}function F6(t){return{dailyLimit:fc(t?.daily_limit??t?.dailyLimit??0)}}function fc(t){let e=Number(typeof t=="string"?t:t??0);return Number.isFinite(e)?e:0}function fi(t){return`$${t.toFixed(2)}`}function sI(t,e=U6){let n=Math.max(0,Math.min(1,t)),r=Math.round(n*e);return`[${"\u2588".repeat(r)}${"\u2591".repeat(e-r)}]`}function fo(t,e){let n=Ec(t??"").trim();return n.length>0?n:e}function j6(t){if(!t)return"unknown time";let e=new Date(t);return Number.isNaN(e.getTime())?fo(t,"unknown time"):e.toISOString().slice(0,16).replace("T"," ")}function Ec(t){return t.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g,"").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\u001B[P_^][^\u001B]*(?:\u001B\\|\u0007)/g,"").replace(/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g,"").replace(/\s+/g," ")}var pe=C(require("fs")),Zl=C(require("os")),$e=C(require("path")),cI=require("child_process");var $6=2,zl="# >>> visa-cli shell hud v2 >>>",Jl="# <<< visa-cli shell hud v2 <<<",Y6="# >>> visa-cli shell hud >>>",q6="# <<< visa-cli shell hud <<<",uI=3e4,K6={currentVersion:"0.0.0"},W6=3e4;function YS(){try{return $e.join(fI(),".visa-cli")}catch{return $e.join(Zl.tmpdir(),".visa-cli")}}function Tc(){return $e.join(YS(),"shell-hud.json")}function ep(){return $e.join(YS(),"shell-hud.line")}function lI(){return $e.join(YS(),"shell-hud.lock")}function tp(t){let e=t??process.env.SHELL;if(!e)return null;let n=$e.basename(e.replace(/\\/g,"/")).toLowerCase();return n==="zsh"?"zsh":n==="bash"?"bash":n==="pwsh"||n==="pwsh.exe"||n==="powershell"||n==="powershell.exe"?"powershell":null}function np(t){let e=fI();if(t==="zsh")return $e.join(e,".zshrc");if(t==="bash")return $e.join(e,".bashrc");let n=(process.platform==="win32","PowerShell");return $e.join(e,"Documents",n,"Microsoft.PowerShell_profile.ps1")}function X6(t){let e="$HOME/.visa-cli/shell-hud.line",n=oJ(t),r=sJ(t);if(t==="zsh")return`${zl}
|
|
21
|
+
`),process.exit(1)}var gi=require("child_process");function ws(e=process.env,t=process.platform){return e.VISA_CLI_NO_BROWSER==="1"||e.VISA_CLI_NO_BROWSER==="true"?{headless:!0,reason:"VISA_CLI_NO_BROWSER is set"}:e.CI==="true"||e.CI==="1"?{headless:!0,reason:"CI environment detected"}:e.SSH_CONNECTION||e.SSH_TTY?{headless:!0,reason:"SSH session detected"}:t==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY?{headless:!0,reason:"Linux with no $DISPLAY or $WAYLAND_DISPLAY"}:{headless:!1}}function Ql(e){let n=e.length+4;return[`\u250C${"\u2500".repeat(n)}\u2510`,`\u2502${" ".repeat(2)}${e}${" ".repeat(2)}\u2502`,`\u2514${"\u2500".repeat(n)}\u2518`].join(`
|
|
22
|
+
`)}function eu(e){if(typeof e!="string"||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}return t.protocol!=="https:"&&t.protocol!=="http:"?null:t.toString()}function tu(e,t){return t==="darwin"?{cmd:"open",args:[e]}:t==="win32"?{cmd:"rundll32.exe",args:["url.dll,FileProtocolHandler",e]}:t==="linux"?{cmd:"xdg-open",args:[e]}:null}function fi(e,t){e(` Could not open browser automatically (${t.message}).`),e(" Open the URL above manually to continue."),e("")}async function xs(e,t={}){let n=t.log??(c=>console.log(c)),r=t.env??process.env,s=t.platform??process.platform,o=eu(e),i=t.spawn??((c,u,d)=>{(0,gi.execFile)(c,u,g=>d(g))});n(""),n(" Sign in to Visa CLI by opening this URL in your browser:"),n("");for(let c of Ql(o??e).split(`
|
|
23
|
+
`))n(` ${c}`);if(n(""),!o){n(" (Auth URL is not a valid absolute http(s) URL \u2014 skipping browser auto-open.)"),n(" Open the URL above manually to continue."),n("");return}let a=ws(r,s);if(a.headless){n(` (${a.reason} \u2014 skipping browser auto-open.)`),n(" Open the URL above on any device with a browser. The CLI will"),n(" continue waiting for you to complete sign-in."),n("");return}let l=tu(o,s);if(!l){n(` No known browser-open command for platform "${s}".`),n(" Open the URL above manually to continue."),n("");return}await new Promise(c=>{let u=d=>{d?fi(n,d):(n(" Opened browser. Waiting for you to sign in..."),n("")),c()};try{i(l.cmd,l.args,u)}catch(d){fi(n,d instanceof Error?d:new Error(String(d))),c()}})}function nu(e){return new Promise(t=>setTimeout(t,e))}function hi(e){if(typeof e=="number"&&Number.isFinite(e)&&e>0)return e*1e3;if(typeof e!="string"||e.trim()==="")return null;let t=Number(e);if(Number.isFinite(t)&&t>0)return t*1e3;let n=Date.parse(e);return Number.isFinite(n)?Math.max(n-Date.now(),0):null}function yi(e){return!Number.isFinite(e)||e===null||e<=0?1e3:Math.min(Math.max(Math.ceil(e),1e3),3e4)}async function ru(e,t=Math.random()*250){let n=s=>Math.min(s+Math.max(0,Math.ceil(t)),3e4);if(!e||e.status!==429)return n(1e3);let r=hi(e.headers?.get("Retry-After"));if(r!==null)return n(yi(r));if(typeof e.json=="function")try{let s=await e.json();return n(yi(hi(s?.retryAfter)))}catch{return n(1e3)}return n(1e3)}async function dt(e,t){let n=await ru(e);return t?.(n),await nu(n),n}var vi=R(require("crypto")),bi=require("child_process"),de=R(require("fs")),dr=R(require("path"));function Si(e,t){de.mkdirSync(dr.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.${vi.randomBytes(8).toString("hex")}.tmp`;try{de.writeFileSync(n,JSON.stringify(t,null,2)+`
|
|
24
|
+
`),de.renameSync(n,e)}catch(r){try{de.unlinkSync(n)}catch{}throw r}}function _i(e){return`'${e.replace(/'/g,"'\\''")}'`}var Cs="# visa-cli-hud-v1";function su(e,t){if(!e&&!t&&ou())return`visa-cli config statusline ${Cs}`;let n=e??process.execPath,r=t??process.argv[1]??"",s=r?dr.resolve(r):"";return`${s?`${_i(n)} ${_i(s)} config statusline`:"visa-cli config statusline"} ${Cs}`}function ou(){try{return(0,bi.execSync)("command -v visa-cli",{stdio:"ignore",timeout:1e3}),!0}catch{return!1}}function Et(e){return typeof e!="string"?!1:e.includes(Cs)?!0:e.includes("visa-cli")&&e.includes("statusline")}function mr(e,t=su){let n={},r=!1;if(de.existsSync(e)){r=!0;try{n=JSON.parse(de.readFileSync(e,"utf-8"))}catch(s){return{installed:"malformed-json",message:`~/.claude/settings.json is not valid JSON (${s.message}). Fix the file manually, then run: visa-cli config hud enable claude`}}}if(n.statusLine){let s=typeof n.statusLine=="object"?n.statusLine.command:"";return Et(s)?{installed:"already-visa",message:"Visa HUD already registered in ~/.claude/settings.json."}:{installed:"other-hud-present",message:"Another HUD is already configured (keeping it). To switch to Visa HUD, edit ~/.claude/settings.json \u2192 statusLine.command"}}try{return n.statusLine={type:"command",command:t()},Si(e,n),{installed:"new",message:`Visa HUD registered in ~/.claude/settings.json${r?"":" (new file)"}. Restart Claude Code to see it pinned below the input.`}}catch(s){return{installed:"error",message:`Failed to write settings: ${s.message}. Enable manually later with: visa-cli config hud enable claude`}}}function ks(e){if(!de.existsSync(e))return{removed:!1,message:"No ~/.claude/settings.json found."};let t;try{t=JSON.parse(de.readFileSync(e,"utf-8"))}catch(r){return{removed:!1,message:`~/.claude/settings.json is not valid JSON: ${r.message}`}}if(!t.statusLine)return{removed:!1,message:"No statusLine configured."};let n=typeof t.statusLine=="object"?t.statusLine.command:"";return Et(n)?(delete t.statusLine,Si(e,t),{removed:!0,message:"Visa HUD removed from ~/.claude/settings.json. Restart Claude Code to take effect."}):{removed:!1,message:"statusLine is owned by another tool \u2014 leaving it alone."}}var Ge=R(require("fs")),Le=R(require("path")),iu=1,At={CLAUDE_CODE:"claude-code",CODEX:"codex",UNKNOWN:"unknown"},au=["terminal","claude","claude-code","codex","all"];function Rs(e){let t=e.toLowerCase();return au.includes(t)?t:null}var cu=50,lu=64*1024,wi=10,Ts=80;function uu(){let e=(process.env.COLORTERM??"").toLowerCase();if(e==="truecolor"||e==="24bit")return!0;let t=(process.env.TERM??"").toLowerCase();return t.includes("truecolor")||t.includes("24bit")}var Es=uu(),S={reset:"\x1B[0m",visaBlue:Es?"\x1B[38;2;20;52;203m":"\x1B[38;5;27m",visaBlueSoft:Es?"\x1B[38;2;97;126;229m":"\x1B[38;5;111m",visaGold:Es?"\x1B[38;2;247;182;0m":"\x1B[38;5;220m",green:"\x1B[38;5;48m",dim:"\x1B[2m"};function w(e,t){return e.length===0||process.env.NO_COLOR?e:`${t}${e}${S.reset}`}function xi(e){return e.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u001F\u007F]/g,"").length}async function Ei(e=process.stdin){return e.isTTY?null:new Promise(t=>{let n=[],r=!1,s=()=>{e.removeListener("data",i),e.removeListener("end",a),e.removeListener("error",l),clearTimeout(c)},o=u=>{r||(r=!0,s(),t(u))},i=u=>{n.push(typeof u=="string"?Buffer.from(u):u)},a=()=>{let u=Buffer.concat(n).toString("utf-8").trim();if(!u)return o(null);try{let d=JSON.parse(u);o(d&&typeof d=="object"?d:null)}catch{o(null)}},l=()=>o(null),c=setTimeout(()=>{n.length>0?a():o(null)},cu);e.on("data",i),e.on("end",a),e.on("error",l)})}function Rn(e){let n=Math.round(Math.max(0,Math.min(1,e))*10),r="\u2588".repeat(n),s="\u2591".repeat(10-n);return`${w(r||"",S.visaBlueSoft)}${w(s||"",S.dim)}`}function $n(e){return!Number.isFinite(e)||e<0?"0":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(Math.round(e))}function du(e){if(Di(e))return pu(e);let t=` ${w("\u2502",S.dim)} `,n=pr(e)||"claude",r=e.cwd?J(Le.basename(e.cwd)):"",s=fr(e.workspace),o=r||s,i=s&&s!==o?` ${w(`@${s}`,S.visaBlueSoft)}`:"",a=[w(`[${n}]`,S.visaBlueSoft)];o&&a.push(`${w(o,S.visaGold)}${i}`);let l=J(e.git_branch??e.branch??"");l&&a.push(`${w("git:(",S.dim)}${w(l,S.visaBlueSoft)}${w(")",S.dim)}`);let c=a.join(t),u=Number(e.context_window?.context_window_size??0),d=typeof e.context_window?.used_percentage=="number"?e.context_window.used_percentage:typeof e.context_window?.remaining_percentage=="number"?100-e.context_window.remaining_percentage:null,g=e.context_window?.current_usage,f=[g?.input_tokens,g?.output_tokens,g?.cache_creation_input_tokens,g?.cache_read_input_tokens].filter(G=>typeof G=="number"&&Number.isFinite(G)),x=f.length>0?f.reduce((G,F)=>G+F,0):null,y=Number(e.context_window?.total_input_tokens??x??g?.input_tokens??0),A=d!==null?Math.max(0,Math.min(1,d/100)):u>0?Math.max(0,Math.min(1,y/u)):0,N=d!==null&&u>0?Math.round(A*u):y,L;if(u>0||d!==null){let G=`${String(Math.round(A*100)).padStart(2," ")}%`,F=u>0?` ${w(`(${$n(N)}/${$n(u)})`,S.dim)}`:"";L=`${w("Context",S.dim)} ${Rn(A)} ${w(G,S.green)}${F}`}else L=`${w("Context",S.dim)} ${w("-",S.dim)}`;let T=Ai(e.rate_limits),C=[L];T&&C.push(T);let V=C.join(t);return`${c}
|
|
25
|
+
${V}`}function mu(e){if(Di(e))return null;let t=` ${w("\u2502",S.dim)} `,n=pr(e)||"claude",r=e.cwd?J(Le.basename(e.cwd)):"",s=fr(e.workspace),o=r||s,i=s&&s!==o?` ${w(`@${s}`,S.visaBlueSoft)}`:"",a=[w(`[${n}]`,S.visaBlueSoft)];o&&a.push(`${w(o,S.visaGold)}${i}`);let l=J(e.git_branch??e.branch??"");l&&a.push(`${w("git:(",S.dim)}${w(l,S.visaBlueSoft)}${w(")",S.dim)}`);let c=Number(e.context_window?.context_window_size??0),u=typeof e.context_window?.used_percentage=="number"?e.context_window.used_percentage:typeof e.context_window?.remaining_percentage=="number"?100-e.context_window.remaining_percentage:null,d=e.context_window?.current_usage,g=[d?.input_tokens,d?.output_tokens,d?.cache_creation_input_tokens,d?.cache_read_input_tokens].filter(C=>typeof C=="number"&&Number.isFinite(C)),f=g.length>0?g.reduce((C,V)=>C+V,0):null,x=Number(e.context_window?.total_input_tokens??f??d?.input_tokens??0),y=u!==null?Math.max(0,Math.min(1,u/100)):c>0?Math.max(0,Math.min(1,x/c)):0,A=u!==null&&c>0?Math.round(y*c):x,N;if(c>0||u!==null){let C=`${String(Math.round(y*100)).padStart(2," ")}%`,V=c>0?` ${w(`(${$n(A)}/${$n(c)})`,S.dim)}`:"";N=`${w("Context",S.dim)} ${Rn(y)} ${w(C,S.green)}${V}`}else N=`${w("Context",S.dim)} ${w("-",S.dim)}`;let L=Ai(e.rate_limits),T=[N];return L&&T.push(L),{identity:a.join(t),metrics:T.join(t)}}function pu(e){let t=` ${w("\u2502",S.dim)} `,n=Ui(e),r=n.model||"codex",s=[w(`[${r}]`,S.visaBlueSoft)];n.project&&s.push(w(n.project,S.visaGold)),n.gitBranch&&s.push(`${w("git",S.dim)} ${w(n.gitBranch,S.visaGold)}`);let o=s.join(t),i=[];if(typeof n.contextUsedPercent=="number"){let l=Math.max(0,Math.min(1,n.contextUsedPercent/100));i.push(`${w("Context",S.dim)} ${Rn(l)} ${w(`${Math.round(n.contextUsedPercent)}%`,S.green)}`)}else if(typeof n.contextRemainingPercent=="number"){let l=100-n.contextRemainingPercent,c=Math.max(0,Math.min(1,l/100));i.push(`${w("Context",S.dim)} ${Rn(c)} ${w(`${Math.round(l)}%`,S.green)}`)}typeof n.usedTokens=="number"&&i.push(`${w("Tokens",S.dim)} ${$n(n.usedTokens)}`),n.status&&i.push(`${w("Status",S.dim)} ${w(n.status,S.visaBlueSoft)}`),n.threadTitle&&i.push(`${w("Thread",S.dim)} ${w(n.threadTitle,S.visaBlueSoft)}`);let a=i.length>0?i.join(t):`${w("Context",S.dim)} ${w("-",S.dim)}`;return`${o}
|
|
26
|
+
${a}`}function fu(e){if(typeof e!="number"||e<=0)return"";let n=(e>1e12?e:e*1e3)-Date.now();if(n<=0||n>=10080*60*1e3)return"";let r=Math.floor(n/6e4),s=Math.floor(r/60),o=r%60;return s>0?`${s}h ${o}m`:`${o}m`}function Ci(e,t){if(!e||typeof e.used_percentage!="number")return null;let n=Math.max(0,Math.min(100,e.used_percentage)),r=n/100,s=Rn(r),o=n>=90?"\x1B[38;5;196m":n>=70?S.visaGold:S.green,i=`${String(Math.round(n)).padStart(2," ")}%`,a=fu(e.resets_at),l=a?` ${w(`(${a} / ${t})`,S.dim)}`:` ${w(`(${t})`,S.dim)}`;return`${s} ${w(i,o)}${l}`}function Ai(e){if(!e)return null;let t=Ci(e.five_hour,"5h"),n=typeof e.seven_day?.used_percentage=="number"?e.seven_day.used_percentage:null,r=n!==null&&n>=90?Ci(e.seven_day,"7d"):null;if(!t&&!r)return null;let s=` ${w("\u2502",S.dim)} `,o=[t,r].filter(Boolean);return`${w("Usage",S.dim)} ${o.join(s)}`}function Ri(e){let t;try{let n=Ge.statSync(e);if(!n.isFile())return null;let r=n.size;if(r===0)return null;let s=Math.min(r,lu),o=r-s;t=Ge.openSync(e,"r");let i=Buffer.alloc(s);Ge.readSync(t,i,0,s,o);let a=i.toString("utf-8");if(o>0){let l=Buffer.alloc(1);if(Ge.readSync(t,l,0,1,o-1),l[0]!==10){let c=a.indexOf(`
|
|
27
|
+
`);c>=0&&(a=a.slice(c+1))}}return a}catch{return null}finally{if(t!==void 0)try{Ge.closeSync(t)}catch{}}}function gu(e){if(!e||typeof e!="object")return;let t=e,n=["file_path","path","notebook_path","pattern","command","url"];for(let r of n){let s=t[r];if(typeof s=="string"&&s.length>0){if(r.endsWith("_path")||r==="path"){let o=Le.basename(Le.dirname(s)),i=Le.basename(s);return o&&o!=="."&&o!=="/"?`${o}/${i}`:i}return s}}}function hu(e){let t=e.split(`
|
|
28
|
+
`),n=[],r=new Set;for(let s=t.length-1;s>=0&&n.length<wi*3;s-=1){let o=t[s].trim();if(!o)continue;let i;try{i=JSON.parse(o)}catch{continue}if(!i||typeof i!="object")continue;let l=i.message;if(!l||typeof l!="object")continue;let c=l.content;if(Array.isArray(c))for(let u of c){if(!u||typeof u!="object")continue;let d=u;if(d.type==="tool_result"&&typeof d.tool_use_id=="string")r.add(d.tool_use_id);else if(d.type==="tool_use"&&typeof d.name=="string"){let g=typeof d.id=="string"?d.id:"",f=g.length>0?!r.has(g):!1;n.push({name:d.name,target:gu(d.input),running:f})}}}return n.reverse(),n.slice(Math.max(0,n.length-wi))}function yu(e){let t=[];for(let n of e){let r=t[t.length-1];r&&!r.running&&!n.running&&r.name===n.name&&r.target===void 0&&n.target===void 0?r.count+=1:t.push({...n,count:1})}return t}function _u(e){let t=e.running?w("\u25D0",S.visaGold):w("\u2713",S.green),n=e.running?S.visaGold:S.visaBlueSoft,r=w(J(e.name),n),s=e.target?J(e.target):"",o=s?`${w(":",S.dim)} ${w(s,S.dim)}`:"",i=e.count>1?` ${w(`\xD7${e.count}`,S.dim)}`:"";return o?`${t} ${r}${o}${i}`:`${t} ${r}${i}`}function vu(e){let t=` ${w("\u2502",S.dim)} `,n=xi(t),r=e.slice();for(;r.length>0;){let l=r.join(t);if(xi(l)<=Ts)return l;r=r.slice(1)}if(e.length===0)return"";let s="\u2026",i=e[e.length-1].replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,""),a=i.length>Ts-n-1?i.slice(0,Ts-n-1)+s:i;return`${w(s,S.dim)}${t}${a}`}async function ki(e){if(!e||typeof e!="string")return null;let t=Ri(e);if(!t)return null;let n;try{n=hu(t)}catch{return null}if(n.length===0)return null;let s=yu(n).map(_u);return vu(s)||null}async function $i(e,t,n){return(await Pi(e,t,n)).join(`
|
|
29
|
+
`)}function Ii(e,t,n){let r=!!t?.activeSession||e.includes("in session"),s=n?Su(n):!1;return{isActive:r||s,hasSession:r,hasToolActivity:s}}async function Pi(e,t,n){let{isActive:r}=Ii(e,n,t?.transcript_path),s=e.split(`
|
|
30
|
+
`).filter(a=>a.length>0),i=t&&!r?s.map(a=>w(As(a),S.dim)):[...s];if(t){let a=mu(t);if(a){if(i.push(a.identity),t.transcript_path){let l=await ki(t.transcript_path);l&&i.push(...l.split(`
|
|
31
|
+
`))}i.push(a.metrics)}else{let l=du(t);if(l&&i.push(...l.split(`
|
|
32
|
+
`)),t.transcript_path){let c=await ki(t.transcript_path);c&&i.push(...c.split(`
|
|
33
|
+
`))}}}return i}var bu=["generate_image","generate_video","generate_music","generate_audio","generate_3d","upscale_image","run_llm","transcribe_audio","pay","get_status","buy_credits","get_cards","add_card","set_session_mode","query_onchain_prices","allium_explorer"];function Su(e){let t=Ri(e);if(!t)return!1;let n=t.slice(-16384).toLowerCase();return bu.some(r=>n.includes(`"${r}"`))}async function Mi(e,t,n){let r=await Pi(e,t,n),s=r.join(`
|
|
34
|
+
`),{isActive:o}=Ii(e,n,t?.transcript_path);return{schemaVersion:iu,client:t?Li(t):At.UNKNOWN,rendered:s,lines:r.map(As),visa:{spendLine:As(e),balanceCents:n?.balanceCents,balanceUsd:n?.amountUsd,sessionMode:n?.sessionMode,activeSession:n?.activeSession,isVisaActive:o},context:t?Ui(t):{}}}function J(e){return e?e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g,"").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\u001B[P_^][^\u001B]*(?:\u001B\\|\u0007)/g,"").replace(/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g,"").replace(/\s+/g," ").trim():""}function fr(e){if(typeof e=="string")return J(Le.basename(e));if(!e||typeof e!="object")return"";let t=typeof e.current_dir=="string"?e.current_dir:typeof e.path=="string"?e.path:"";return J(t?Le.basename(t):e.name)}function Oi(e){return J(e.app_name??e.appName??e.app??e.client)}function pr(e){return J(e.model?.display_name??e.model?.id??e.model_name??e.modelName)}function Ni(e){return J(e.cwd??e.current_dir??e.project_root)}function Ti(e){let t=J(e.project);if(t)return t;let n=Ni(e);if(n)return J(Le.basename(n));let r=fr(e.workspace);return r||""}function Ee(e){if(!(typeof e!="number"||!Number.isFinite(e)))return e}function Li(e){let t=Oi(e).toLowerCase();return t.includes("codex")?At.CODEX:t.includes("claude")||e.model?.display_name||e.transcript_path||e.rate_limits?At.CLAUDE_CODE:e.run_state||e.runState||e.thread_title||e.threadTitle||e.git_branch||Ee(e.context_used)!==void 0?At.CODEX:At.UNKNOWN}function Di(e){return Li(e)===At.CODEX}function Ui(e){let t=Oi(e),n=Ni(e),r=fr(e.workspace),s=Ee(e.context_used)??Ee(e.context_window?.used_percentage??void 0),o=Ee(e.context_remaining)??Ee(e.context_window?.remaining_percentage??void 0);return{...t?{app:t}:{},...pr(e)?{model:pr(e)}:{},...Ti(e)?{project:Ti(e)}:{},...r?{workspace:r}:{},...n?{cwd:n}:{},...J(e.git_branch??e.branch)?{gitBranch:J(e.git_branch??e.branch)}:{},...J(e.status??e.run_state??e.runState)?{status:J(e.status??e.run_state??e.runState)}:{},...J(e.thread_title??e.threadTitle)?{threadTitle:J(e.thread_title??e.threadTitle)}:{},...s!==void 0?{contextUsedPercent:s}:{},...o!==void 0?{contextRemainingPercent:o}:{},...Ee(e.used_tokens)!==void 0?{usedTokens:Ee(e.used_tokens)}:{},...Ee(e.total_input_tokens)!==void 0?{totalInputTokens:Ee(e.total_input_tokens)}:{},...Ee(e.total_output_tokens)!==void 0?{totalOutputTokens:Ee(e.total_output_tokens)}:{}}}function As(e){return e.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"")}async function Rt(e,t){let n=t?.timeoutMs??3e4,r=new AbortController,s=setTimeout(()=>r.abort(),n);try{let{timeoutMs:o,...i}=t??{};return await fetch(e,{...i,signal:r.signal})}finally{clearTimeout(s)}}var $t=class extends Error{code="ATTESTATION_KEY_DRIFT";hint;constructor(t,n){super(t),this.name="AttestationDriftError",this.hint=n}},en=class extends Error{code;budgetId;status;constructor(t,n,r={}){super(t),this.name="SessionInvalidError",this.code=n,this.budgetId=r.budgetId,this.status=r.status}},It=class extends Error{code="SESSION_LOCK_CONTENDED";retryAfterSecs;status;constructor(t,n=1,r){super(t),this.name="SessionLockContendedError",this.retryAfterSecs=n,this.status=r}},re=class extends Error{retryable;code;reason;paymentErrorClass;correlationId;transactionId;retryAfter;constructor(t,n,r,s,o,i,a,l){super(t),this.name="CardDeclinedError",this.retryable=n,this.code=r,this.reason=s,this.paymentErrorClass=o,this.correlationId=i,this.transactionId=a,this.retryAfter=l}};var ji={ENOTFOUND:"Cannot resolve the Visa CLI server hostname (DNS error). Check your internet connection or the auth.serverUrl setting.",EAI_AGAIN:"DNS lookup for the Visa CLI server failed temporarily. Check your internet connection and try again.",ECONNREFUSED:"The Visa CLI server refused the connection. The service may be down \u2014 check https://visacli.sh for status.",ECONNRESET:"The connection to the Visa CLI server was reset mid-request. Try again in a moment.",EHOSTUNREACH:"The Visa CLI server is unreachable from this network. Check your internet connection.",ETIMEDOUT:"The connection to the Visa CLI server timed out. Try again or check https://visacli.sh for status.",CERT_HAS_EXPIRED:"The Visa CLI server's TLS certificate is expired. Check https://visacli.sh for status; do not bypass the cert.",UND_ERR_CONNECT_TIMEOUT:"The connection to the Visa CLI server timed out before it could be established. Try again in a moment.",UND_ERR_SOCKET:"The connection to the Visa CLI server was interrupted. Try again in a moment."};function $s(e){let t=e&&typeof e=="object"?e:{};if(t.name==="AbortError"||typeof t.message=="string"&&t.message.includes("aborted"))return"The request timed out. The server may be under heavy load. Please try again.";let n=(t.cause&&typeof t.cause=="object"?t.cause.code:void 0)??(typeof t.code=="string"?t.code:void 0);return n&&ji[n]?ji[n]:`Network error contacting the Visa CLI server (${n?`${n}: ${typeof t.message=="string"?t.message:"unknown"}`:typeof t.message=="string"&&t.message.length>0?t.message:"unknown error"}). Check https://visacli.sh for status.`}var wu=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function Vi(e,t){let n=qi(e),r=qi(t);if(!n||!r)return!1;for(let s=0;s<3;s++)if(n.main[s]!==r.main[s])return n.main[s]>r.main[s];return n.pre&&!r.pre?!1:!n.pre&&r.pre?!0:!n.pre&&!r.pre?!1:xu(n.pre,r.pre)>0}function qi(e){if(typeof e!="string")return null;let n=e.trim().replace(/^v/,"").match(wu);return n?{main:[Number(n[1]),Number(n[2]),Number(n[3])],pre:n[4]??null}:null}function xu(e,t){let n=e.split("."),r=t.split("."),s=Math.max(n.length,r.length);for(let o=0;o<s;o++){if(o>=n.length)return-1;if(o>=r.length)return 1;let i=n[o],a=r[o],l=/^\d+$/.test(i),c=/^\d+$/.test(a);if(l&&c){let u=Number(i)-Number(a);if(u!==0)return u}else{if(l)return-1;if(c)return 1;if(i<a)return-1;if(i>a)return 1}}return 0}function De(){return!!(Fi(process.env.VISA_CLI_NO_UPDATE_CHECK)||Fi(process.env.CI)||process.env.NODE_ENV==="test")}function Fi(e){if(e===void 0)return!1;let t=e.trim().toLowerCase();return!(t===""||t==="0"||t==="false"||t==="no"||t==="off")}var pt=R(require("fs")),Ds=require("node:net"),zi=R(require("os")),Wi=R(require("path"));var gr=R(require("fs")),Bi=R(require("path")),Hi=R(require("os"));var Is=Bi.join(Hi.homedir(),".visa-mcp"),In=class{static ensureConfigDir(){gr.existsSync(Is)||gr.mkdirSync(Is,{recursive:!0,mode:448})}static getConfigDir(){return Is}static TOOL_STATES={login:!0,get_status:!0,get_cards:!0,add_card:!0,pay:!1,transaction_history:!0,update_spending_controls:!0,enroll_device:!1,verify_otp:!1,reset:!0,batch:!0,generate_x402_image:!1,browser_launch:!1,browser_navigate:!1,browser_snapshot:!1,browser_click:!1,browser_type:!1,browser_scroll:!1,generate_music_card:!1,generate_image_card:!1,query_onchain_prices_card:!1,generate_music_tempo_card:!1,check_music_status_tempo_card:!1,generate_image_fast_card:!1,generate_video_tempo_card:!1};static loadToolStates(){return{...this.TOOL_STATES}}static getDisabledTools(){let t=new Set;for(let[n,r]of Object.entries(this.TOOL_STATES))r||t.add(n);return t}static isToolDisabled(t){return this.TOOL_STATES[t]===!1}};var me=R(require("fs")),Os=R(require("path")),Ki=R(require("os")),Ms=Os.join(Ki.homedir(),".visa-mcp"),Pn=Os.join(Ms,"mcp-server.log"),Cu=5*1024*1024,Ps=null;function ku(){me.existsSync(Ms)||me.mkdirSync(Ms,{recursive:!0,mode:448})}function Tu(){if(!Ps){if(ku(),me.existsSync(Pn)&&me.statSync(Pn).size>Cu){let t=Pn+".1";me.existsSync(t)&&me.unlinkSync(t),me.renameSync(Pn,t)}Ps=me.createWriteStream(Pn,{flags:"a"})}return Ps}function Eu(e){return e==="WARN"||e==="ERROR"?!0:process.env.VISA_CLI_DEBUG==="1"||process.env.VISA_VERBOSE==="1"}function hr(e,...t){let n=new Date().toISOString(),r=t.map(o=>typeof o=="string"?o:JSON.stringify(o,null,2)).join(" "),s=`[${n}] [${e}] ${r}
|
|
35
|
+
`;Eu(e)&&process.stderr.write(s),Tu().write(s)}var m={debug:(...e)=>hr("DEBUG",...e),info:(...e)=>hr("INFO",...e),warn:(...e)=>hr("WARN",...e),error:(...e)=>hr("ERROR",...e)};function Gi(e){let t=zi.homedir();return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}var Au="settings.json",Ru="must use https unless it points at localhost/loopback for local development";function Mn(){return Wi.join(In.getConfigDir(),Au)}function Ji(e){if((0,Ds.isIP)(e)!==4)return!1;let[t]=e.split(".").map(Number);return t===127}function $u(e){let t=e.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(!t)return!1;let n=Number.parseInt(t[1],16),r=Number.parseInt(t[2],16);if(!Number.isFinite(n)||!Number.isFinite(r))return!1;let s=[n>>8&255,n&255,r>>8&255,r&255].join(".");return Ji(s)}function Iu(e){let t=e.toLowerCase().replace(/^\[(.*)\]$/,"$1");if(t==="localhost")return!0;let n=(0,Ds.isIP)(t);return n===4?Ji(t):n===6?t==="::1"||$u(t):!1}function Ns(e,t="auth.serverUrl"){let n;try{n=new URL(e)}catch{throw new Error(`${t} must be a valid URL (got: ${JSON.stringify(e)})`)}if(n.username||n.password)throw new Error(`${t} must not include username or password credentials`);if(n.protocol!=="https:"&&!(n.protocol==="http:"&&Iu(n.hostname)))throw new Error(`${t} ${Ru}`)}var ft={"auth.serverUrl":{type:"string",description:"Auth server base URL. Override for staging / self-hosted backends.",requiresRestart:!0,validate:e=>{if(typeof e!="string")throw new Error("auth.serverUrl must be a string");Ns(e)}},"ui.suppressBrowser":{type:"boolean",description:"When true, the CLI/MCP server stops auto-opening result URLs in your browser."},"ui.suppressFeed":{type:"boolean",description:"When true, generated images/music are not auto-submitted to the public Made-with-Visa feed."},"tools.meta":{type:"boolean",description:"Show category meta-tools (generate_image, generate_video, generate_music, run_llm, ...). Restart required.",requiresRestart:!0},"tools.discover":{type:"boolean",description:"Show the dynamic-catalog tools (discover_tools, execute_tool). Restart required.",requiresRestart:!0},"merchants.discover":{type:"string",description:'Platform-merchant JIT tool discovery: "all" = every live merchant, "off" = none, comma-separated slugs = exactly those. Equivalent to VISA_MERCHANT_DISCOVER / VISA_MERCHANT_SLUGS env. Restart required.',requiresRestart:!0,validate:e=>{if(typeof e!="string")throw new Error("merchants.discover must be a string");let t=e.trim().toLowerCase();if(t===""||t==="all"||t==="off"||t==="*")return;let n=/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/,r=e.split(",").map(s=>s.trim()).filter(Boolean);for(let s of r)if(!n.test(s))throw new Error(`merchants.discover: "${s}" is not a valid merchant slug`)}},"credit.sessionCapCents":{type:"number",description:"Default cap (in cents) for start_session and pay-as-you-go one-shot approvals. Server clamps to [10, 10000] = $0.10\u2013$100. Default 500 ($5).",validate:e=>{if(typeof e!="number"||!Number.isFinite(e))throw new Error("credit.sessionCapCents must be a number");if(!Number.isInteger(e))throw new Error("credit.sessionCapCents must be a whole number of cents (no fractional cents)");if(e<10||e>1e4)throw new Error("credit.sessionCapCents must be between 10 ($0.10) and 10000 ($100)")}}},Us=500,yr={"tools.specific":"Legacy direct _card MCP tools are retired. Use category meta-tools or discover_tools/execute_tool.","credit.sessionMode":"The session-mode toggle is retired. Use start_session, close_session, and get_session_status."};function Pt(){let e=Mn();if(!pt.existsSync(e))return{};try{let t=pt.readFileSync(e,"utf-8"),n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?(m.warn("settings:corrupt",{path:Gi(e),reason:"not_object"}),{}):n}catch(t){return m.warn("settings:corrupt",{path:Gi(e),error:t?.message||String(t)}),{}}}function Ls(e){In.ensureConfigDir();let t=Mn(),n=`${t}.tmp`,r=JSON.stringify(e,null,2)+`
|
|
36
|
+
`;pt.writeFileSync(n,r,{mode:384}),pt.renameSync(n,t)}function js(e){let t=Pt()[e];return typeof t=="string"?t:void 0}function _r(e){let t=Pt()[e];if(typeof t=="boolean")return t;if(t==="true")return!0;if(t==="false")return!1}function qs(e){let t=Pt()[e];if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t.trim().length>0){let n=Number(t);if(Number.isFinite(n))return n}}var ze=class extends Error{constructor(t){let n=Object.keys(ft).sort().join(", ");super(`Unknown setting "${t}". Settable keys: ${n}. For server-controlled values (biometric.*, spending.*) use the dedicated tools (biometric_on/off, update_spending_controls).`),this.name="UnknownSettingKeyError"}},We=class extends Error{constructor(t){let n="";t.startsWith("biometric.")?n="biometric_on / biometric_off":t.startsWith("spending.")?n="update_spending_controls":t.startsWith("cards.")?n="add_card / remove_card / set_default_card":t.startsWith("account.")&&(n="login / reset"),super(`"${t}" is a server-controlled value and cannot be set via config set. `+(n?`Use ${n} instead.`:"No client-side override is supported.")),this.name="ServerOnlySettingError"}},mt=class extends Error{constructor(t){super(`"${t}" is retired and ignored. Remove it with \`visa-cli config unset ${t}\`. `+yr[t]),this.name="RetiredSettingKeyError"}},Yi=["biometric.","spending.","account.","cards.","biometric"];function vr(e,t){if(Yi.some(o=>e.startsWith(o)))throw new We(e);if(e in yr)throw new mt(e);let n=ft[e];if(!n)throw new ze(e);let r;if(n.type==="boolean")if(typeof t=="boolean")r=t;else if(typeof t=="string"){let o=t.toLowerCase();if(o==="true")r=!0;else if(o==="false")r=!1;else throw new Error(`${e} expects true or false (got: ${JSON.stringify(t)})`)}else throw new Error(`${e} expects a boolean (got: ${typeof t})`);else if(n.type==="number")if(typeof t=="number")r=t;else if(typeof t=="string"&&t.trim().length>0){let o=Number(t);if(!Number.isFinite(o))throw new Error(`${e} expects a number (got: ${JSON.stringify(t)})`);r=o}else throw new Error(`${e} expects a number (got: ${typeof t})`);else{if(typeof t!="string"||t.length===0)throw new Error(`${e} expects a non-empty string`);r=t}n.validate&&n.validate(r);let s=Pt();return s[e]=r,Ls(s),{key:e,value:r,requiresRestart:!!n.requiresRestart,path:Mn()}}function br(e){if(Yi.some(o=>e.startsWith(o)))throw new We(e);let t=ft[e];if(e in yr){let o=Pt(),i=e in o;return i&&(delete o[e],Ls(o)),{key:e,removed:i,requiresRestart:!1,path:Mn()}}if(!t)throw new ze(e);let r=Pt(),s=e in r;return s&&(delete r[e],Ls(r)),{key:e,removed:s,requiresRestart:s&&!!t.requiresRestart,path:Mn()}}function Zi(){let e=Pt();return Object.entries(yr).filter(([t])=>t in e).map(([t,n])=>({key:t,value:e[t],hint:n}))}var Pu="https://auth.visacli.sh";function Mu(e){return typeof e=="string"&&/-(?:rc|alpha|beta)\./i.test(e)}function Ou(){try{let e=ar();return Mu(e.version)}catch{return!1}}function Nu(e){return e.envVar!==void 0&&e.envVar!==""?(Ns(e.envVar,"VISA_AUTH_URL"),e.envVar):e.settingValue!==void 0?(Ns(e.settingValue,"auth.serverUrl"),e.settingValue):Pu}function we(){return Nu({envVar:process.env.VISA_AUTH_URL,settingValue:js("auth.serverUrl"),isPrerelease:Ou()})}function Xi(){let e=process.env.VISA_SUPPRESS_BROWSER;return e!==void 0?e==="true":_r("ui.suppressBrowser")??!1}function Qi(){let e=process.env.VISA_SUPPRESS_FEED;return e!==void 0?e==="true":_r("ui.suppressFeed")??!1}function ea(){let e=process.env.VISA_CREDIT_SESSION_CAP_CENTS;if(e!==void 0){let n=Number(e);if(Number.isFinite(n)&&n>=10&&n<=1e4)return Math.floor(n)}let t=qs("credit.sessionCapCents");return t!==void 0&&t>=10&&t<=1e4?Math.floor(t):Us}var On="2.0.0",Lu=/^vk_[A-Za-z0-9_-]{32,}$/;function Du(e){if(typeof e!="string")return null;switch(e){case"BUDGET_CLOSED":case"BUDGET_NOT_FOUND":case"BUDGET_EXPIRED":return e;default:return null}}var Uu="Visa CLI is temporarily unavailable. Try again, or report at https://github.com/Visa-Crypto-Labs/Visa-mono/issues if it persists.";function tn(e){return typeof e=="string"?e.trim():""}function ta(e){let t=e&&typeof e=="object"?e:{},n=tn(t.error)||tn(t.message);if(!n)return Uu;let r=tn(t.error_code),s=[["surface",tn(t.disabled_surface)],["flag",tn(t.flag)],["correlation_id",tn(t.correlation_id)]].filter(([,i])=>i).map(([i,a])=>`${i}=${a}`),o=s.length?` (${s.join(" ")})`:"";return r?`503 [${r}] ${n}${o}`:`503 ${n}${o}`}function na(e=process.env,t=process.stdin.isTTY){let n=["Not logged in. No local Visa CLI session credentials were found."],r=e.VISA_CLI_API_KEY?.trim();return r?Lu.test(r)?(n.push("VISA_CLI_API_KEY is set, but MCP bearer tools currently require a local session from visa-cli setup."),n.push("For headless API-key use, call the /v1/api/* HTTP routes with X-Api-Key instead of MCP bearer tools.")):(n.push("VISA_CLI_API_KEY is set but has invalid format (expected vk_<32+ base64url chars>)."),n.push("Create a new token with: visa-cli tokens create <app-name>")):n.push("Run `visa-cli setup` in an interactive terminal to authenticate."),t===!1&&n.push("This process appears to be running without a TTY; complete setup in a normal terminal, then restart the MCP client."),n.join(`
|
|
37
|
+
`)}var pe=class{constructor(t){this.getSessionToken=t;this.baseUrl=we()}getSessionToken;baseUrl;lastSignals={};parseServerSignals(t){if(this.lastSignals={},!De()){let r=t.headers.get("X-Latest-Version");r&&Vi(r,On)&&(this.lastSignals.updateAvailable={currentVersion:On,latestVersion:r})}let n=t.headers.get("X-Feedback-Prompt");if(n)try{this.lastSignals.feedbackPrompt=JSON.parse(n)}catch{}}getClientVersion(){return On}throwIfAttestationDrift(t){if(t?.error_code==="ATTESTATION_KEY_DRIFT")throw new $t(t.error||"Your biometric key is out of sync with the server.",typeof t.hint=="string"?t.hint:void 0)}async throwServerUnavailable(t){let n=null;try{n=await t.json()}catch{}throw new Error(ta(n))}async request(t,n,r,s,o,i){let a=await this.getSessionToken();if(!a)throw new Error(na());let l={Authorization:`Bearer ${a}`};o&&(t==="GET"?l["X-User-Context"]=encodeURIComponent(o.replace(/[\r\n\0]/g," ").slice(0,1e3)):r={...r||{},user_context:o}),i&&(l["X-Visa-Meta-Tool"]=i),r&&(l["Content-Type"]="application/json");let c;try{c=await Rt(`${this.baseUrl}${n}`,{method:t,headers:{...l,"X-Visa-CLI-Version":On,"X-Source":"cli"},body:r?JSON.stringify(r):void 0,timeoutMs:s})}catch(d){throw new Error($s(d))}if(this.parseServerSignals(c),c.status===401)throw new Error("Your session has expired. Run: visa-cli setup");if(c.status===429){let d=c.headers.get("Retry-After")||"3";throw new Error(`Rate limited \u2014 wait ${d}s. Tip: use the batch tool to combine multiple requests into one.`)}c.status===503&&await this.throwServerUnavailable(c);let u;try{u=await c.json()}catch{throw c.status===500?new Error(`Server error on ${n}. Try again or check https://visacli.sh for status.`):new Error(`Unexpected response from ${n}. Try again.`)}if(!c.ok){if(c.status===500)throw new Error(`Server error on ${n}. Try again or check https://visacli.sh for status.`);if(this.throwIfAttestationDrift(u),u?.declined){let d=Number(u.retryAfter??c.headers.get("Retry-After"));throw new re(u.error||"Your card was declined.",!!u.retryable,u.code,u.reason,u.payment_error_class,u.correlation_id,u.transactionId,Number.isFinite(d)&&d>0?d:void 0)}if(c.status===402){let d=u?.error||"Gateway returned 402",g=typeof u?.error_code=="string"?u.error_code:"";throw g==="SPENDING_LIMIT_EXCEEDED"||g==="DAILY_LIMIT_EXCEEDED"||g==="PER_TXN_LIMIT_EXCEEDED"?new Error(`${d}. Check your limits with get_status or run: visa-cli update-spending-controls`):new Error(d)}throw new Error(u?.error||`Request failed (${c.status}). Try again.`)}return u}async pay(t,n){return this.request("POST","/v1/pay",t,void 0,n)}async shortcut(t,n,r,s,o){return this.request("POST",`/v1/shortcuts/${encodeURIComponent(t)}`,n,r,s,o)}async shortcutWithSession(t,n,r,s,o,i){let a=`/v1/shortcuts/${encodeURIComponent(t)}`,l=await this.getSessionToken();if(!l)throw new Error(na());let c={Authorization:`Bearer ${l}`,"X-Visa-CLI-Version":On,"X-Source":"cli","Content-Type":"application/json"};i&&(c["X-Visa-Meta-Tool"]=i);let u={...n,...r};o&&(u.user_context=o.replace(/[\r\n\0]/g," ").slice(0,1e3));let d;try{d=await Rt(`${this.baseUrl}${a}`,{method:"POST",headers:c,body:JSON.stringify(u),timeoutMs:s})}catch(x){throw new Error($s(x))}if(this.parseServerSignals(d),d.status===401)throw new Error("Your session has expired. Run: visa-cli setup");if(d.status===429){let x=d.headers.get("Retry-After")||"3";throw new Error(`Rate limited \u2014 wait ${x}s. Tip: use the batch tool to combine multiple requests into one.`)}let g=d.headers.get("X-Voucher-Receipt"),f;try{f=await d.json()}catch{throw d.status===500?new Error(`Server error on ${a}. Try again or check https://visacli.sh for status.`):d.status===503?new Error("Visa CLI is temporarily unavailable. Check https://visacli.sh for status."):new Error(`Unexpected response from ${a}. Try again.`)}if(!d.ok){if(d.status===500)throw new Error(`Server error on ${a}. Try again or check https://visacli.sh for status.`);if(this.throwIfAttestationDrift(f),d.status===503){if(f?.error_code==="SESSION_LOCK_CONTENDED"){let y=Number(d.headers.get("Retry-After"))||1;throw new It(f?.message||f?.error||"Session budget is being modified by another request. Retry shortly.",y,d.status)}throw new Error(ta(f))}let x=Du(f?.error_code);if(x||d.status===410){let y=x??"BUDGET_CLOSED";throw new en(f?.message||f?.error||"Your session was invalidated by the server.",y,{budgetId:n.session_budget_id,status:d.status})}if(f?.declined){let y=Number(f.retryAfter??d.headers.get("Retry-After"));throw new re(f.error||"Your card was declined.",!!f.retryable,f.code,f.reason,f.payment_error_class,f.correlation_id,f.transactionId,Number.isFinite(y)&&y>0?y:void 0)}throw new Error(f?.error||`Request failed (${d.status}). Try again.`)}return{data:f,voucherReceiptHeader:g}}async batch(t,n,r){return this.request("POST","/v1/batch",t,n,r)}async emitTelemetry(t){return this.request("POST","/v1/telemetry",{rows:t})}async catalogSearch(t,n,r){let s=r??"discover_tools",o=new URLSearchParams;t&&o.set("q",t),n&&o.set("category",n);let i=o.toString();return this.request("GET",`/v1/catalog${i?`?${i}`:""}`,void 0,void 0,void 0,s)}async catalogTool(t,n){let r=n??"discover_tools";try{return await this.request("GET",`/v1/catalog/${encodeURIComponent(t)}`,void 0,void 0,void 0,r)}catch{return null}}async discoverMerchantRoutes(t){try{return await this.request("GET",`/v1/platform/discover/${encodeURIComponent(t)}`)}catch{return null}}async listPublicMerchants(){try{let t=await Rt(`${this.baseUrl}/v1/platform/merchants/public`,{method:"GET",timeoutMs:8e3});if(!t.ok)return[];let n=await t.json();return Array.isArray(n.merchants)?n.merchants:[]}catch{return[]}}async getPublicMerchantDiscover(t){try{let n=await Rt(`${this.baseUrl}/v1/platform/discover/${encodeURIComponent(t)}`,{method:"GET",timeoutMs:8e3});return n.ok?await n.json():null}catch{return null}}async paymentPreview(t,n){return this.request("POST","/v1/payment-preview",t,void 0,n)}async getBalance(){return this.request("GET","/v1/balance")}async topupBalance(t){return this.request("POST","/v1/balance/topup",t)}async getAutoTopup(){let t=await this.getBalance();return{success:t.success,targetCents:t.autoTopupCents??null,thresholdCents:t.autoTopupThresholdCents??0}}async disableAutoTopup(){return this.request("PATCH","/v1/balance/auto-topup",{auto_topup_cents:null})}async createSessionBudget(t){return this.request("POST","/v1/session-budget/create",{...t,mode:"prepaid"})}async closeSession(t){return this.request("POST","/v1/session/close",{session_budget_id:t})}async getSessionBudget(t){return this.request("GET",`/v1/session-budget/${encodeURIComponent(t)}`)}async getSessionLedger(t){return this.request("GET",`/v1/session/${encodeURIComponent(t)}/ledger`)}async getStatus(t){return this.request("GET","/v1/status",void 0,void 0,t)}async getFeatureFlags(){return this.request("GET","/v1/feature-flags")}async getVisaSmi(t,n){return this.request("POST","/v1/visa/smi",t,6e4,n)}async getTransactions(t,n){let r=new URLSearchParams;t?.limit!=null&&r.set("limit",String(t.limit)),t?.offset!=null&&r.set("offset",String(t.offset));let s=r.toString(),o=s?`/v1/transactions?${s}`:"/v1/transactions";return this.request("GET",o,void 0,void 0,n)}async updateSpendingControls(t,n){return this.request("POST","/v1/spending-controls",t,void 0,n)}async removeCard(t,n,r){return this.request("DELETE",`/v1/cards/${encodeURIComponent(String(t))}`,n,void 0,r)}async setDefaultCard(t,n,r){return this.request("POST",`/v1/cards/${encodeURIComponent(String(t))}/default`,n,void 0,r)}async getAttestationChallenge(){return this.request("GET","/v1/attestation-challenge")}async registerAttestationKey(t){return this.request("POST","/v1/attestation-key",{publicKey:t})}async startAttestationRecovery(t,n){return this.request("POST","/v1/attestation-key/recovery/start",{state:t},void 0,n)}async setBiometricPreference(t,n){return this.request("POST","/v1/biometric-preference",{...t,confirm:!0},void 0,n)}async logout(t,n){return this.request("POST","/v1/logout",t,void 0,n)}async feedback(t,n,r){return this.request("POST","/v1/feedback",{message:t,...n&&{transaction_id:n}},void 0,r)}async createAppApiKey(t){return this.request("POST","/v1/api/keys",t)}async listAppApiKeys(){return this.request("GET","/v1/api/keys")}async revokeAppApiKey(t){return this.request("DELETE",`/v1/api/keys/${encodeURIComponent(String(t))}`)}async feedSubmit(t){return this.request("POST","/v1/feed",t)}async feedList(t){let n=new URLSearchParams;t?.tab&&n.set("tab",t.tab),t?.limit&&n.set("limit",String(t.limit)),t?.offset&&n.set("offset",String(t.offset));let r=n.toString();return this.request("GET",`/v1/feed${r?"?"+r:""}`)}async feedVote(t,n){return this.request("POST",`/v1/feed/${encodeURIComponent(t)}/vote`,{direction:n})}async feedApprove(t){return this.request("POST",`/v1/feed/${encodeURIComponent(t)}/approve`)}async feedDelete(t){return this.request("DELETE",`/v1/feed/${encodeURIComponent(t)}`)}async feedPending(){return this.request("GET","/v1/feed/pending")}async submitFeedback(t,n,r){return this.request("POST","/v1/feedback",{message:t,...n&&{transaction_id:n}},void 0,r)}async getFeedback(t,n){let r=new URLSearchParams;t&&r.set("limit",String(t));let s=r.toString();return this.request("GET",`/v1/feedback${s?"?"+s:""}`,void 0,void 0,n)}async submitRatedFeedback(t){return this.request("POST","/v1/feedback",t)}};var p={};Qo(p,{BRAND:()=>ud,DIRTY:()=>Mt,EMPTY_PATH:()=>Fu,INVALID:()=>k,NEVER:()=>Wd,OK:()=>ae,ParseStatus:()=>se,Schema:()=>M,ZodAny:()=>yt,ZodArray:()=>Xe,ZodBigInt:()=>Nt,ZodBoolean:()=>Lt,ZodBranded:()=>Ln,ZodCatch:()=>zt,ZodDate:()=>Dt,ZodDefault:()=>Gt,ZodDiscriminatedUnion:()=>xr,ZodEffects:()=>ke,ZodEnum:()=>Ht,ZodError:()=>fe,ZodFirstPartyTypeKind:()=>E,ZodFunction:()=>kr,ZodIntersection:()=>Vt,ZodIssueCode:()=>h,ZodLazy:()=>Ft,ZodLiteral:()=>Bt,ZodMap:()=>cn,ZodNaN:()=>un,ZodNativeEnum:()=>Kt,ZodNever:()=>Ae,ZodNull:()=>jt,ZodNullable:()=>qe,ZodNumber:()=>Ot,ZodObject:()=>ge,ZodOptional:()=>xe,ZodParsedType:()=>v,ZodPipeline:()=>Dn,ZodPromise:()=>_t,ZodReadonly:()=>Wt,ZodRecord:()=>Cr,ZodSchema:()=>M,ZodSet:()=>ln,ZodString:()=>ht,ZodSymbol:()=>on,ZodTransformer:()=>ke,ZodTuple:()=>je,ZodType:()=>M,ZodUndefined:()=>Ut,ZodUnion:()=>qt,ZodUnknown:()=>Ze,ZodVoid:()=>an,addIssueToContext:()=>_,any:()=>vd,array:()=>xd,bigint:()=>fd,boolean:()=>pa,coerce:()=>zd,custom:()=>ua,date:()=>gd,datetimeRegex:()=>ca,defaultErrorMap:()=>Je,discriminatedUnion:()=>Ed,effect:()=>jd,enum:()=>Ld,function:()=>Md,getErrorMap:()=>nn,getParsedType:()=>Ue,instanceof:()=>md,intersection:()=>Ad,isAborted:()=>Sr,isAsync:()=>rn,isDirty:()=>wr,isValid:()=>gt,late:()=>dd,lazy:()=>Od,literal:()=>Nd,makeIssue:()=>Nn,map:()=>Id,nan:()=>pd,nativeEnum:()=>Dd,never:()=>Sd,null:()=>_d,nullable:()=>Vd,number:()=>ma,object:()=>Cd,objectUtil:()=>Vs,oboolean:()=>Gd,onumber:()=>Kd,optional:()=>qd,ostring:()=>Hd,pipeline:()=>Bd,preprocess:()=>Fd,promise:()=>Ud,quotelessJson:()=>ju,record:()=>$d,set:()=>Pd,setErrorMap:()=>Vu,strictObject:()=>kd,string:()=>da,symbol:()=>hd,transformer:()=>jd,tuple:()=>Rd,undefined:()=>yd,union:()=>Td,unknown:()=>bd,util:()=>O,void:()=>wd});var O;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},e.getValidEnumValues=s=>{let o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(let i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(O||(O={}));var Vs;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Vs||(Vs={}));var v=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ue=e=>{switch(typeof e){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(e)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?v.promise:typeof Map<"u"&&e instanceof Map?v.map:typeof Set<"u"&&e instanceof Set?v.set:typeof Date<"u"&&e instanceof Date?v.date:v.object;default:return v.unknown}};var h=O.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"]),ju=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),fe=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){let c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];n[o]=n[o]||[],n[o].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};fe.create=e=>new fe(e);var qu=(e,t)=>{let n;switch(e.code){case h.invalid_type:e.received===v.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,O.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:n=`Unrecognized key(s) in object: ${O.joinValues(e.keys,", ")}`;break;case h.invalid_union:n="Invalid input";break;case h.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${O.joinValues(e.options)}`;break;case h.invalid_enum_value:n=`Invalid enum value. Expected ${O.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:n="Invalid function arguments";break;case h.invalid_return_type:n="Invalid function return type";break;case h.invalid_date:n="Invalid date";break;case h.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:O.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case h.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case h.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case h.custom:n="Invalid input";break;case h.invalid_intersection_types:n="Intersection results could not be merged";break;case h.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:n="Number must be finite";break;default:n=t.defaultError,O.assertNever(e)}return{message:n}},Je=qu;var ra=Je;function Vu(e){ra=e}function nn(){return ra}var Nn=e=>{let{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Fu=[];function _(e,t){let n=nn(),r=Nn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Je?void 0:Je].filter(s=>!!s)});e.common.issues.push(r)}var se=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let s of n){if(s.status==="aborted")return k;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let s of n){let o=await s.key,i=await s.value;r.push({key:o,value:i})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let s of n){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return k;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}},k=Object.freeze({status:"aborted"}),Mt=e=>({status:"dirty",value:e}),ae=e=>({status:"valid",value:e}),Sr=e=>e.status==="aborted",wr=e=>e.status==="dirty",gt=e=>e.status==="valid",rn=e=>typeof Promise<"u"&&e instanceof Promise;var b;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(b||(b={}));var Ce=class{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}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}},sa=(e,t)=>{if(gt(t))return{success:!0,data:t.value};if(!e.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 fe(e.common.issues);return this._error=n,this._error}}};function I(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{let{message:l}=e;return i.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}var M=class{get description(){return this._def.description}_getType(t){return Ue(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ue(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new se,ctx:{common:t.parent.common,data:t.data,parsedType:Ue(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(rn(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ue(t)},s=this._parseSync({data:t,path:r.path,parent:r});return sa(r,s)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ue(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return gt(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:t,path:[],parent:n}).then(r=>gt(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ue(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(rn(s)?s:Promise.resolve(s));return sa(r,o)}refine(t,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{let i=t(s),a=()=>o.addIssue({code:h.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new ke({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 xe.create(this,this._def)}nullable(){return qe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xe.create(this)}promise(){return _t.create(this,this._def)}or(t){return qt.create([this,t],this._def)}and(t){return Vt.create(this,t,this._def)}transform(t){return new ke({...I(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Gt({...I(this._def),innerType:this,defaultValue:n,typeName:E.ZodDefault})}brand(){return new Ln({typeName:E.ZodBranded,type:this,...I(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new zt({...I(this._def),innerType:this,catchValue:n,typeName:E.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Dn.create(this,t)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bu=/^c[^\s-]{8,}$/i,Hu=/^[0-9a-z]+$/,Ku=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gu=/^[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,zu=/^[a-z0-9_-]{21}$/i,Wu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ju=/^[-+]?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)?)??$/,Yu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fs,Xu=/^(?:(?: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])$/,Qu=/^(?:(?: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])$/,ed=/^(([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]))$/,td=/^(([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])$/,nd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ia="((\\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])))",sd=new RegExp(`^${ia}$`);function aa(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function od(e){return new RegExp(`^${aa(e)}$`)}function ca(e){let t=`${ia}T${aa(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function id(e,t){return!!((t==="v4"||!t)&&Xu.test(e)||(t==="v6"||!t)&&ed.test(e))}function ad(e,t){if(!Wu.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function cd(e,t){return!!((t==="v4"||!t)&&Qu.test(e)||(t==="v6"||!t)&&td.test(e))}var ht=class e extends M{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==v.string){let o=this._getOrReturnCtx(t);return _(o,{code:h.invalid_type,expected:v.string,received:o.parsedType}),k}let r=new se,s;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),_(s,{code:h.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),_(s,{code:h.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?_(s,{code:h.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&_(s,{code:h.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Yu.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"email",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Fs||(Fs=new RegExp(Zu,"u")),Fs.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"emoji",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Gu.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"uuid",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")zu.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"nanoid",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Bu.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"cuid",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Hu.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"cuid2",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Ku.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"ulid",code:h.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),_(s,{validation:"url",code:h.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"regex",code:h.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?ca(o).test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?sd.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?od(o).test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{code:h.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Ju.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"duration",code:h.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?id(t.data,o.version)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"ip",code:h.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?ad(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"jwt",code:h.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?cd(t.data,o.version)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"cidr",code:h.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nd.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"base64",code:h.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?rd.test(t.data)||(s=this._getOrReturnCtx(t,s),_(s,{validation:"base64url",code:h.invalid_string,message:o.message}),r.dirty()):O.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:h.invalid_string,...b.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...b.errToObj(t)})}url(t){return this._addCheck({kind:"url",...b.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...b.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...b.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...b.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...b.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...b.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...b.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...b.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...b.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...b.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...b.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...b.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...b.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...b.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...b.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...b.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...b.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...b.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...b.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...b.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...b.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...b.errToObj(n)})}nonempty(t){return this.min(1,b.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};ht.create=e=>new ht({checks:[],typeName:E.ZodString,coerce:e?.coerce??!1,...I(e)});function ld(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}var Ot=class e extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==v.number){let o=this._getOrReturnCtx(t);return _(o,{code:h.invalid_type,expected:v.number,received:o.parsedType}),k}let r,s=new se;for(let o of this._def.checks)o.kind==="int"?O.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:h.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?ld(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:h.not_finite,message:o.message}),s.dirty()):O.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,b.toString(n))}gt(t,n){return this.setLimit("min",t,!1,b.toString(n))}lte(t,n){return this.setLimit("max",t,!0,b.toString(n))}lt(t,n){return this.setLimit("max",t,!1,b.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:b.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:b.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:b.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&O.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Ot.create=e=>new Ot({checks:[],typeName:E.ZodNumber,coerce:e?.coerce||!1,...I(e)});var Nt=class e extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==v.bigint)return this._getInvalidInput(t);let r,s=new se;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),_(r,{code:h.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):O.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return _(n,{code:h.invalid_type,expected:v.bigint,received:n.parsedType}),k}gte(t,n){return this.setLimit("min",t,!0,b.toString(n))}gt(t,n){return this.setLimit("min",t,!1,b.toString(n))}lte(t,n){return this.setLimit("max",t,!0,b.toString(n))}lt(t,n){return this.setLimit("max",t,!1,b.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:b.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Nt.create=e=>new Nt({checks:[],typeName:E.ZodBigInt,coerce:e?.coerce??!1,...I(e)});var Lt=class extends M{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==v.boolean){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.boolean,received:r.parsedType}),k}return ae(t.data)}};Lt.create=e=>new Lt({typeName:E.ZodBoolean,coerce:e?.coerce||!1,...I(e)});var Dt=class e extends M{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==v.date){let o=this._getOrReturnCtx(t);return _(o,{code:h.invalid_type,expected:v.date,received:o.parsedType}),k}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return _(o,{code:h.invalid_date}),k}let r=new se,s;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),_(s,{code:h.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),_(s,{code:h.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):O.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:b.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:b.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Dt.create=e=>new Dt({checks:[],coerce:e?.coerce||!1,typeName:E.ZodDate,...I(e)});var on=class extends M{_parse(t){if(this._getType(t)!==v.symbol){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.symbol,received:r.parsedType}),k}return ae(t.data)}};on.create=e=>new on({typeName:E.ZodSymbol,...I(e)});var Ut=class extends M{_parse(t){if(this._getType(t)!==v.undefined){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.undefined,received:r.parsedType}),k}return ae(t.data)}};Ut.create=e=>new Ut({typeName:E.ZodUndefined,...I(e)});var jt=class extends M{_parse(t){if(this._getType(t)!==v.null){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.null,received:r.parsedType}),k}return ae(t.data)}};jt.create=e=>new jt({typeName:E.ZodNull,...I(e)});var yt=class extends M{constructor(){super(...arguments),this._any=!0}_parse(t){return ae(t.data)}};yt.create=e=>new yt({typeName:E.ZodAny,...I(e)});var Ze=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ae(t.data)}};Ze.create=e=>new Ze({typeName:E.ZodUnknown,...I(e)});var Ae=class extends M{_parse(t){let n=this._getOrReturnCtx(t);return _(n,{code:h.invalid_type,expected:v.never,received:n.parsedType}),k}};Ae.create=e=>new Ae({typeName:E.ZodNever,...I(e)});var an=class extends M{_parse(t){if(this._getType(t)!==v.undefined){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.void,received:r.parsedType}),k}return ae(t.data)}};an.create=e=>new an({typeName:E.ZodVoid,...I(e)});var Xe=class e extends M{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==v.array)return _(n,{code:h.invalid_type,expected:v.array,received:n.parsedType}),k;if(s.exactLength!==null){let i=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(i||a)&&(_(n,{code:i?h.too_big:h.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(_(n,{code:h.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(_(n,{code:h.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new Ce(n,i,n.path,a)))).then(i=>se.mergeArray(r,i));let o=[...n.data].map((i,a)=>s.type._parseSync(new Ce(n,i,n.path,a)));return se.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:b.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:b.toString(n)}})}nonempty(t){return this.min(1,t)}};Xe.create=(e,t)=>new Xe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...I(t)});function sn(e){if(e instanceof ge){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=xe.create(sn(r))}return new ge({...e._def,shape:()=>t})}else return e instanceof Xe?new Xe({...e._def,type:sn(e.element)}):e instanceof xe?xe.create(sn(e.unwrap())):e instanceof qe?qe.create(sn(e.unwrap())):e instanceof je?je.create(e.items.map(t=>sn(t))):e}var ge=class e extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=O.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==v.object){let c=this._getOrReturnCtx(t);return _(c,{code:h.invalid_type,expected:v.object,received:c.parsedType}),k}let{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ae&&this._def.unknownKeys==="strip"))for(let c in s.data)i.includes(c)||a.push(c);let l=[];for(let c of i){let u=o[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ce(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ae){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(_(s,{code:h.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ce(s,d,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,g=await u.value;c.push({key:d,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>se.mergeObjectSync(r,c)):se.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return b.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:b.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:E.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of O.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of O.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return sn(this)}partial(t){let n={};for(let r of O.objectKeys(this.shape)){let s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of O.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof xe;)o=o._def.innerType;n[r]=o}return new e({...this._def,shape:()=>n})}keyof(){return la(O.objectKeys(this.shape))}};ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:Ae.create(),typeName:E.ZodObject,...I(t)});ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:Ae.create(),typeName:E.ZodObject,...I(t)});ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:Ae.create(),typeName:E.ZodObject,...I(t)});var qt=class extends M{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new fe(a.ctx.common.issues));return _(n,{code:h.invalid_union,unionErrors:i}),k}if(n.common.async)return Promise.all(r.map(async o=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(l=>new fe(l));return _(n,{code:h.invalid_union,unionErrors:a}),k}}get options(){return this._def.options}};qt.create=(e,t)=>new qt({options:e,typeName:E.ZodUnion,...I(t)});var Ye=e=>e instanceof Ft?Ye(e.schema):e instanceof ke?Ye(e.innerType()):e instanceof Bt?[e.value]:e instanceof Ht?e.options:e instanceof Kt?O.objectValues(e.enum):e instanceof Gt?Ye(e._def.innerType):e instanceof Ut?[void 0]:e instanceof jt?[null]:e instanceof xe?[void 0,...Ye(e.unwrap())]:e instanceof qe?[null,...Ye(e.unwrap())]:e instanceof Ln||e instanceof Wt?Ye(e.unwrap()):e instanceof zt?Ye(e._def.innerType):[],xr=class e extends M{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==v.object)return _(n,{code:h.invalid_type,expected:v.object,received:n.parsedType}),k;let r=this.discriminator,s=n.data[r],o=this.optionsMap.get(s);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let s=new Map;for(let o of n){let i=Ye(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new e({typeName:E.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...I(r)})}};function Bs(e,t){let n=Ue(e),r=Ue(t);if(e===t)return{valid:!0,data:e};if(n===v.object&&r===v.object){let s=O.objectKeys(t),o=O.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(let a of o){let l=Bs(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===v.array&&r===v.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=t[o],l=Bs(i,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===v.date&&r===v.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Vt=class extends M{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(Sr(o)||Sr(i))return k;let a=Bs(o.value,i.value);return a.valid?((wr(o)||wr(i))&&n.dirty(),{status:n.value,value:a.data}):(_(r,{code:h.invalid_intersection_types}),k)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Vt.create=(e,t,n)=>new Vt({left:e,right:t,typeName:E.ZodIntersection,...I(n)});var je=class e extends M{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==v.array)return _(r,{code:h.invalid_type,expected:v.array,received:r.parsedType}),k;if(r.data.length<this._def.items.length)return _(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((i,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Ce(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>se.mergeArray(n,i)):se.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};je.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new je({items:e,typeName:E.ZodTuple,rest:null,...I(t)})};var Cr=class e extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==v.object)return _(r,{code:h.invalid_type,expected:v.object,received:r.parsedType}),k;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in r.data)s.push({key:o._parse(new Ce(r,a,r.path,a)),value:i._parse(new Ce(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?se.mergeObjectAsync(n,s):se.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof M?new e({keyType:t,valueType:n,typeName:E.ZodRecord,...I(r)}):new e({keyType:ht.create(),valueType:t,typeName:E.ZodRecord,...I(n)})}},cn=class extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==v.map)return _(r,{code:h.invalid_type,expected:v.map,received:r.parsedType}),k;let s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Ce(r,a,r.path,[c,"key"])),value:o._parse(new Ce(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of i){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return k;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of i){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return k;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};cn.create=(e,t,n)=>new cn({valueType:t,keyType:e,typeName:E.ZodMap,...I(n)});var ln=class e extends M{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==v.set)return _(r,{code:h.invalid_type,expected:v.set,received:r.parsedType}),k;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(_(r,{code:h.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(_(r,{code:h.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let o=this._def.valueType;function i(l){let c=new Set;for(let u of l){if(u.status==="aborted")return k;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>o._parse(new Ce(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:b.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};ln.create=(e,t)=>new ln({valueType:e,minSize:null,maxSize:null,typeName:E.ZodSet,...I(t)});var kr=class e extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==v.function)return _(n,{code:h.invalid_type,expected:v.function,received:n.parsedType}),k;function r(a,l){return Nn({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nn(),Je].filter(c=>!!c),issueData:{code:h.invalid_arguments,argumentsError:l}})}function s(a,l){return Nn({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nn(),Je].filter(c=>!!c),issueData:{code:h.invalid_return_type,returnTypeError:l}})}let o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof _t){let a=this;return ae(async function(...l){let c=new fe([]),u=await a._def.args.parseAsync(l,o).catch(f=>{throw c.addIssue(r(l,f)),c}),d=await Reflect.apply(i,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw c.addIssue(s(d,f)),c})})}else{let a=this;return ae(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new fe([r(l,c.error)]);let u=Reflect.apply(i,this,c.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new fe([s(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:je.create(t).rest(Ze.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||je.create([]).rest(Ze.create()),returns:n||Ze.create(),typeName:E.ZodFunction,...I(r)})}},Ft=class extends M{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ft.create=(e,t)=>new Ft({getter:e,typeName:E.ZodLazy,...I(t)});var Bt=class extends M{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return _(n,{received:n.data,code:h.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:t.data}}get value(){return this._def.value}};Bt.create=(e,t)=>new Bt({value:e,typeName:E.ZodLiteral,...I(t)});function la(e,t){return new Ht({values:e,typeName:E.ZodEnum,...I(t)})}var Ht=class e extends M{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{expected:O.joinValues(r),received:n.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{received:n.data,code:h.invalid_enum_value,options:r}),k}return ae(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};Ht.create=la;var Kt=class extends M{_parse(t){let n=O.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==v.string&&r.parsedType!==v.number){let s=O.objectValues(n);return _(r,{expected:O.joinValues(s),received:r.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(O.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let s=O.objectValues(n);return _(r,{received:r.data,code:h.invalid_enum_value,options:s}),k}return ae(t.data)}get enum(){return this._def.values}};Kt.create=(e,t)=>new Kt({values:e,typeName:E.ZodNativeEnum,...I(t)});var _t=class extends M{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==v.promise&&n.common.async===!1)return _(n,{code:h.invalid_type,expected:v.promise,received:n.parsedType}),k;let r=n.parsedType===v.promise?n.data:Promise.resolve(n.data);return ae(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};_t.create=(e,t)=>new _t({type:e,typeName:E.ZodPromise,...I(t)});var ke=class extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{_(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return k;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?k:l.status==="dirty"?Mt(l.value):n.value==="dirty"?Mt(l.value):l});{if(n.value==="aborted")return k;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?k:a.status==="dirty"?Mt(a.value):n.value==="dirty"?Mt(a.value):a}}if(s.type==="refinement"){let i=a=>{let l=s.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l 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"?k:(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"?k:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!gt(i))return k;let a=s.transform(i.value,o);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=>gt(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):k);O.assertNever(s)}};ke.create=(e,t,n)=>new ke({schema:e,typeName:E.ZodEffects,effect:t,...I(n)});ke.createWithPreprocess=(e,t,n)=>new ke({schema:t,effect:{type:"preprocess",transform:e},typeName:E.ZodEffects,...I(n)});var xe=class extends M{_parse(t){return this._getType(t)===v.undefined?ae(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xe.create=(e,t)=>new xe({innerType:e,typeName:E.ZodOptional,...I(t)});var qe=class extends M{_parse(t){return this._getType(t)===v.null?ae(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qe.create=(e,t)=>new qe({innerType:e,typeName:E.ZodNullable,...I(t)});var Gt=class extends M{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===v.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:E.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...I(t)});var zt=class extends M{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new fe(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new fe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};zt.create=(e,t)=>new zt({innerType:e,typeName:E.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...I(t)});var un=class extends M{_parse(t){if(this._getType(t)!==v.nan){let r=this._getOrReturnCtx(t);return _(r,{code:h.invalid_type,expected:v.nan,received:r.parsedType}),k}return{status:"valid",value:t.data}}};un.create=e=>new un({typeName:E.ZodNaN,...I(e)});var ud=Symbol("zod_brand"),Ln=class extends M{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Dn=class e extends M{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?k:o.status==="dirty"?(n.dirty(),Mt(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?k:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:E.ZodPipeline})}},Wt=class extends M{_parse(t){let n=this._def.innerType._parse(t),r=s=>(gt(s)&&(s.value=Object.freeze(s.value)),s);return rn(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Wt.create=(e,t)=>new Wt({innerType:e,typeName:E.ZodReadonly,...I(t)});function oa(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function ua(e,t={},n){return e?yt.create().superRefine((r,s)=>{let o=e(r);if(o instanceof Promise)return o.then(i=>{if(!i){let a=oa(t,r),l=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:l})}});if(!o){let i=oa(t,r),a=i.fatal??n??!0;s.addIssue({code:"custom",...i,fatal:a})}}):yt.create()}var dd={object:ge.lazycreate},E;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(E||(E={}));var md=(e,t={message:`Input not instance of ${e.name}`})=>ua(n=>n instanceof e,t),da=ht.create,ma=Ot.create,pd=un.create,fd=Nt.create,pa=Lt.create,gd=Dt.create,hd=on.create,yd=Ut.create,_d=jt.create,vd=yt.create,bd=Ze.create,Sd=Ae.create,wd=an.create,xd=Xe.create,Cd=ge.create,kd=ge.strictCreate,Td=qt.create,Ed=xr.create,Ad=Vt.create,Rd=je.create,$d=Cr.create,Id=cn.create,Pd=ln.create,Md=kr.create,Od=Ft.create,Nd=Bt.create,Ld=Ht.create,Dd=Kt.create,Ud=_t.create,jd=ke.create,qd=xe.create,Vd=qe.create,Fd=ke.createWithPreprocess,Bd=Dn.create,Hd=()=>da().optional(),Kd=()=>ma().optional(),Gd=()=>pa().optional(),zd={string:(e=>ht.create({...e,coerce:!0})),number:(e=>Ot.create({...e,coerce:!0})),boolean:(e=>Lt.create({...e,coerce:!0})),bigint:(e=>Nt.create({...e,coerce:!0})),date:(e=>Dt.create({...e,coerce:!0}))};var Wd=k;var fa=["tempo","mpp_self","merchant_self"];var Ks=p.object({inputPerMillion:p.number().positive(),outputPerMillion:p.number().positive(),contextWindow:p.number().int().positive().optional(),maxOutput:p.number().int().positive().optional(),perRequestFeeCents:p.number().nonnegative().optional()}),Jd=p.object({strategy:p.enum(["flat","token","band"]).optional(),pricingModel:p.enum(["per-call","per-token","band"]).optional(),priceCents:p.number().nonnegative().optional(),currency:p.string().optional(),display:p.string().optional(),estimate:p.boolean().optional(),source:p.string().optional(),priceBand:p.record(p.unknown()).optional(),tokenPricing:Ks.optional()}).passthrough(),Gs=p.discriminatedUnion("type",[p.object({type:p.literal("shortcut"),routedPath:p.string().min(1).startsWith("/")}),p.object({type:p.literal("custom"),merchantSlug:p.string().min(1),subPath:p.string().optional()}),p.object({type:p.literal("local"),fn:p.string().min(1)}),p.object({type:p.literal("read")})]),zs=p.object({amount:p.number().nonnegative(),currency:p.string().length(3).optional(),display:p.string().optional(),free:p.boolean().optional(),batchDiscount:p.number().min(0).max(100).optional()}),ga=p.object({attestation:p.boolean().optional(),rateLimitMs:p.number().positive().optional()}),ha=p.object({displayName:p.string().optional(),feedbackEligible:p.boolean().optional(),suggestionEligible:p.boolean().optional(),batchable:p.boolean().optional()}),Yd=p.enum(["image","video","audio","3d","llm","upscale","tts","transcription","utility","onchain"]),Zd=120,Xd=120,Qd=1200,em=/^[^\u0000-\u001F\u007F]+$/;function Hs(e,t){return p.string().min(1).max(e).regex(em,`${t} must not contain control characters`)}var Ws={id:p.string().min(1),name:Hs(Zd,"name"),description:Hs(Qd,"description"),provider:p.string().min(1),model:p.string().min(1),category:Yd,priceCents:p.number().nonnegative(),inputSchema:p.record(p.unknown()),gatewayUrl:p.string().min(1),merchantName:Hs(Xd,"merchantName"),isAsync:p.boolean().optional(),pollUrl:p.string().optional(),pollInterval:p.number().positive().optional(),pollTimeout:p.number().positive().optional(),tags:p.array(p.string()).optional(),tokenPricing:Ks.optional(),priceDisplay:p.string().optional(),pricingModel:p.enum(["per-call","per-token","band"]).optional(),pricingInfo:Jd.optional(),status:p.enum(["available","unavailable"]).optional(),handler:Gs.optional(),pricing:zs.optional(),security:ga.optional(),engagement:ha.optional(),enabled:p.boolean().optional(),beta:p.boolean().optional(),deprecated:p.boolean().optional(),replacementTool:p.string().optional(),minCliVersion:p.string().optional(),sunsetAt:p.string().optional(),rail:p.enum(fa).optional(),pricingStrategy:p.enum(["flat","token","band"]).optional()},ya=p.object({...Ws,dispatch:p.literal("routed"),routedPath:p.string().min(1).startsWith("/")}).strict(),_a=p.object({...Ws,dispatch:p.literal("enveloped")}).strict(),va=p.object({...Ws,handler:Gs,pricing:zs}).strict(),ba=p.union([p.discriminatedUnion("dispatch",[ya,_a]),va]);var Js=/^[a-z0-9][a-z0-9_-]*$/;var nm="https://fal.run",Ca="https://openrouter.mpp.tempo.xyz";function rm(e){let{attestation:t,tool_id:n,...r}=e;return r}var Sa={"1:1":"square_hd","16:9":"landscape_16_9","9:16":"portrait_16_9","4:3":"landscape_4_3","3:4":"portrait_4_3"};function Tr(e){let{attestation:t,tool_id:n,aspect_ratio:r,image_size:s,...o}=e,i={...o};return typeof s=="string"&&s.length>0?(i.image_size=s,i):(typeof r=="string"&&Sa[r]&&(i.image_size=Sa[r]),i)}function wa(e){let t={chain:e.chain,token_address:e.token_address};if(e.start_timestamp){let n=e.end_timestamp||new Date().toISOString(),r=e.time_granularity;if(!r){let s=new Date(e.start_timestamp).getTime();(new Date(n).getTime()-s)/(1e3*60*60*24)<=2?r="1h":r="1d"}return{addresses:[t],start_timestamp:e.start_timestamp,end_timestamp:n,time_granularity:r}}return[t]}function sm(e,t,n,r,s,o,i,a,l){return{id:e,name:t,description:n,provider:r,model:s.replace(/^\//,""),category:o,gatewayUrl:`https://${r}${s}`,merchantName:t,inputSchema:a,handler:{type:"custom",merchantSlug:r,subPath:s},pricing:{amount:i,currency:"USD",display:`$${(i/100).toFixed(2)}`},priceCents:i,tags:[],...l}}function om(e,t,n,r,s,o,i,a){return sm(e,t,n,"suno-ai",r,s,o,i,{merchantName:"Suno AI",...a})}function Y(e,t,n,r,s,o,i,a){return{dispatch:"routed",id:e,name:t,description:n,provider:"fal",model:r,category:s,priceCents:o,inputSchema:i,routedPath:`/api/v1/fal/${r}`,gatewayUrl:`${nm}/${r}`,merchantName:"fal.ai",buildBody:rm,tags:[],...a}}function im(e){return t=>{let{attestation:n,tool_id:r,prompt:s,system_prompt:o,max_tokens:i,temperature:a,...l}=t;return{model:e,messages:[...o?[{role:"system",content:o}]:[],{role:"user",content:s}],max_tokens:i??1024,temperature:a??.7,...l}}}function am(e){return t=>{let{attestation:n,tool_id:r,prompt:s,image_url:o,aspect_ratio:i,max_tokens:a,temperature:l,...c}=t,u=[{type:"text",text:s}];return typeof o=="string"&&o.length>0&&u.push({type:"image_url",image_url:{url:o}}),{model:e,messages:[{role:"user",content:u}],max_tokens:a??1024,temperature:l??.7,...typeof i=="string"&&i.length>0?{image_config:{aspect_ratio:i}}:{},...c}}}function Q(e,t,n,r,s,o,i){let a=i?.perRequestFeeCents??0,l=500/1e6*s*100,c=500/1e6*o*100,u=Math.max(1,Math.ceil(l+c+a)),{perRequestFeeCents:d,...g}=i??{};return{dispatch:"routed",id:e,name:t,description:n,provider:"openrouter",model:r,category:"llm",priceCents:u,inputSchema:{type:"object",properties:{prompt:{type:"string",description:"The prompt or question to send to the model"},system_prompt:{type:"string",description:"Optional system prompt to set model behavior"},max_tokens:{type:"integer",description:"Maximum tokens in response (default: 1024)",minimum:1,maximum:8192},temperature:{type:"number",description:"Sampling temperature 0-2 (default: 0.7)",minimum:0,maximum:2}},required:["prompt"]},routedPath:"/api/v1/chat/completions",gatewayUrl:`${Ca}/v1/chat/completions`,merchantName:"OpenRouter",buildBody:im(r),tags:["llm","chat","text"],tokenPricing:{inputPerMillion:s,outputPerMillion:o,...a>0?{perRequestFeeCents:a}:{}},...g}}function Ys(e,t,n,r,s,o){return{dispatch:"routed",id:e,name:t,description:n,provider:"openrouter",model:r,category:"image",priceCents:s,inputSchema:{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate or edit"},image_url:{type:"string",description:"Optional source image URL for edits"},aspect_ratio:{type:"string",description:"Aspect ratio (e.g. 16:9, 1:1, 9:16)",default:"1:1"},max_tokens:{type:"integer",description:"Maximum text tokens in response metadata (default: 1024)",minimum:1,maximum:8192},temperature:{type:"number",description:"Sampling temperature 0-2 (default: 0.7)",minimum:0,maximum:2}},required:["prompt"]},routedPath:"/api/v1/chat/completions",gatewayUrl:`${Ca}/v1/chat/completions`,merchantName:"OpenRouter",buildBody:am(r),tags:["image","gemini","google","nano-banana","edit"],tokenPricing:{inputPerMillion:.3,outputPerMillion:2.5},...o}}var Zs=[Y("fal-flux-pro-ultra","FLUX Pro Ultra","Highest quality image generation. Best for detailed, photorealistic images.","fal-ai/flux-pro/v1.1-ultra","image",6,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio (e.g. 16:9, 1:1, 9:16)",default:"16:9"}},required:["prompt"]},{tags:["image","flux","photorealistic","high-quality"]}),Y("fal-flux-pro","FLUX Pro","Fast, high-quality image generation. Good balance of speed and quality.","fal-ai/flux-pro/v1.1","image",4,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio (e.g. 16:9, 1:1, 9:16)",default:"16:9"}},required:["prompt"]},{tags:["image","flux","fast"],buildBody:Tr}),Y("fal-flux-dev","FLUX Dev","Open-source image generation. Cheaper, good for experimentation.","fal-ai/flux/dev","image",3,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"16:9"}},required:["prompt"]},{tags:["image","flux","open-source","cheap"],buildBody:Tr}),Y("fal-flux-schnell","FLUX Schnell","Fastest image generation. Ultra-cheap, great for drafts and iteration.","fal-ai/flux/schnell","image",1,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"16:9"}},required:["prompt"]},{tags:["image","flux","fast","cheap","draft"],buildBody:Tr}),Y("fal-recraft-v3","Recraft V3","Design-focused image generation. Great for illustrations, icons, and graphic design.","fal-ai/recraft/v3/text-to-image","image",5,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},style:{type:"string",description:"Style preset: realistic_image, digital_illustration, vector_illustration, icon"}},required:["prompt"]},{tags:["image","design","illustration","icon","vector"]}),Ys("or-gemini-nano-banana","Nano Banana","Google Gemini 2.5 Flash Image via OpenRouter for image generation and edits.","google/gemini-2.5-flash-image",4),Ys("or-gemini-nano-banana-2","Nano Banana 2","Google Gemini 3.1 Flash Image Preview via OpenRouter for fast image generation and edits.","google/gemini-3.1-flash-image-preview",5,{tags:["image","gemini","google","nano-banana","edit","fast"],tokenPricing:{inputPerMillion:.5,outputPerMillion:3}}),Ys("or-gemini-nano-banana-pro","Nano Banana Pro","Google Gemini 3 Pro Image Preview via OpenRouter for professional image generation, edits, and text rendering.","google/gemini-3-pro-image-preview",8,{tags:["image","gemini","google","nano-banana","pro","text-rendering"],tokenPricing:{inputPerMillion:2,outputPerMillion:12}}),Y("fal-ideogram-v2","Ideogram V2","Excellent text rendering in images. Best for logos, posters, and text-heavy visuals.","fal-ai/ideogram/v2","image",8,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"1:1"}},required:["prompt"]},{tags:["image","text-rendering","logo","poster","typography"]}),Y("fal-ideogram-v2-turbo","Ideogram V2 Turbo","Fast text rendering in images. Good balance of speed and text accuracy.","fal-ai/ideogram/v2/turbo","image",5,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"1:1"}},required:["prompt"]},{tags:["image","text-rendering","fast"]}),Y("fal-fast-sdxl","Fast SDXL","Ultra-fast Stable Diffusion. 4-step inference, cheapest option.","fal-ai/fast-sdxl","image",1,{type:"object",properties:{prompt:{type:"string",description:"Text description of the image to generate"}},required:["prompt"]},{tags:["image","stable-diffusion","fast","cheap"]}),Y("fal-wan-video","Wan Video","Text-to-video generation. Create short video clips from text descriptions.","fal-ai/wan/v2.1/1.3b/text-to-video","video",10,{type:"object",properties:{prompt:{type:"string",description:"Text description of the video to generate"},num_frames:{type:"number",description:"Number of frames (default: 81)"}},required:["prompt"]},{tags:["video","text-to-video","wan"]}),Y("fal-minimax-video","MiniMax Video","High-quality video generation with excellent motion and coherence.","fal-ai/minimax-video/video-01-live","video",15,{type:"object",properties:{prompt:{type:"string",description:"Text description of the video to generate"}},required:["prompt"]},{tags:["video","text-to-video","high-quality"]}),Y("fal-kling-video","Kling Video","Professional video generation with cinematic quality.","fal-ai/kling-video/v2/master/text-to-video","video",20,{type:"object",properties:{prompt:{type:"string",description:"Text description of the video to generate"},duration:{type:"string",description:"Duration: 5 or 10 seconds",default:"5"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"16:9"}},required:["prompt"]},{tags:["video","text-to-video","cinematic","professional"]}),Y("fal-kling-i2v","Kling Image-to-Video","Animate a still image into a 5\u201310s video clip. Cinematic motion quality.","fal-ai/kling-video/v1.6/standard/image-to-video","video",35,{type:"object",properties:{image_url:{type:"string",description:"URL of the source image (jpg, png, webp, gif, avif)"},prompt:{type:"string",description:"Text description of the motion to animate"},duration:{type:"string",description:"Duration: 5 or 10 seconds",default:"5"},aspect_ratio:{type:"string",description:"Aspect ratio (e.g. 16:9, 9:16, 1:1)",default:"16:9"},negative_prompt:{type:"string",description:"Elements to avoid in the generated motion"},cfg_scale:{type:"number",description:"Classifier-free guidance (default 0.5)",default:.5}},required:["image_url","prompt"]},{tags:["video","image-to-video","kling","cinematic"]}),Y("fal-stable-audio","Stable Audio","Generate sound effects and ambient audio from text descriptions.","fal-ai/stable-audio","audio",4,{type:"object",properties:{prompt:{type:"string",description:"Description of the audio to generate"},seconds_total:{type:"number",description:"Duration in seconds (max 47)",default:30}},required:["prompt"]},{tags:["audio","sound-effects","ambient"]}),Y("fal-ace-step-music","ACE-Step Music","Generate full music tracks from a prompt, with optional vocals or instrumentals.","fal-ai/ace-step/prompt-to-audio","audio",2,{type:"object",properties:{prompt:{type:"string",description:"Description of the song, genre, mood, instruments, and lyrics direction"},instrumental:{type:"boolean",description:"Generate instrumental music without vocals",default:!1},duration:{type:"number",description:"Duration in seconds",default:60}},required:["prompt"]},{tags:["music","song","vocals","instrumental","ace-step"]}),om("suno-music","Suno Music","AI music generation. Create full songs with vocals or instrumentals.","/suno/generate-music","audio",10,{type:"object",properties:{prompt:{type:"string",description:"Description of the song (genre, mood, instruments)"},instrumental:{type:"boolean",description:"Instrumental only, no vocals",default:!1}},required:["prompt"]},{isAsync:!0,pollUrl:"https://api.sunoapi.org/suno/get-music-status",deprecated:!0,tags:["music","song","vocals","instrumental"],buildBody:e=>{let{attestation:t,tool_id:n,prompt:r,instrumental:s,...o}=e;return{prompt:r,customMode:!1,instrumental:typeof s=="boolean"?s:!1,model:"V4",...o}}}),Y("fal-trellis-3d","Trellis 3D","Generate 3D models from images. Upload a photo, get a 3D asset.","fal-ai/trellis","3d",8,{type:"object",properties:{image_url:{type:"string",description:"URL of the image to convert to 3D"}},required:["image_url"]},{tags:["3d","model","image-to-3d"]}),Y("fal-aura-sr","Aura SR","Upscale images to higher resolution. 4x upscaling with detail enhancement.","fal-ai/aura-sr","upscale",3,{type:"object",properties:{image_url:{type:"string",description:"URL of the image to upscale"}},required:["image_url"]},{tags:["upscale","super-resolution","enhance"]}),Y("fal-metavoice","MetaVoice Voice Cloning","Voice cloning TTS \u2014 clone any voice from an audio sample. Provide text and a voice sample URL.","fal-ai/metavoice-v1","tts",3,{type:"object",properties:{text:{type:"string",description:"Text to convert to speech"},audio_url:{type:"string",description:"URL of the voice sample to clone"}},required:["text","audio_url"]},{tags:["tts","voice","voice-cloning","speech"]}),Y("fal-whisper","Whisper Transcription","Transcribe audio to text. Supports multiple languages.","fal-ai/whisper","transcription",2,{type:"object",properties:{audio_url:{type:"string",description:"URL of the audio to transcribe"},language:{type:"string",description:"Language code (e.g. en, es, fr)"}},required:["audio_url"]},{tags:["transcription","speech-to-text","whisper"]}),Q("or-gpt-4o","GPT-4o","OpenAI's flagship multimodal model. Best for complex reasoning and analysis.","openai/gpt-4o",2.5,10,{tags:["llm","gpt","openai","multimodal","reasoning"]}),Q("or-gpt-4o-mini","GPT-4o Mini","Fast, affordable GPT-4o. Great for everyday tasks, chat, and simple analysis.","openai/gpt-4o-mini",.15,.6,{tags:["llm","gpt","openai","fast","cheap"]}),Q("or-claude-opus","Claude Opus 4.7","Anthropic's most capable model. 1M context, reasoning, best for complex tasks.","anthropic/claude-opus-4.7",15,75,{tags:["llm","claude","anthropic","reasoning","coding"]}),Q("or-claude-sonnet","Claude Sonnet 4.6","Anthropic's best balance of intelligence and speed. Excellent for coding and analysis.","anthropic/claude-sonnet-4.6",3,15,{tags:["llm","claude","anthropic","coding","analysis"]}),Q("or-claude-opus-fast","Claude Opus 4.6 Fast","Fast Opus variant with lower latency.","anthropic/claude-opus-4.6-fast",15,75,{tags:["llm","claude","anthropic","fast"]}),Q("or-claude-haiku","Claude 3.5 Haiku","Anthropic's fastest model. Great for quick tasks, chat, and simple reasoning.","anthropic/claude-3.5-haiku",.8,4,{tags:["llm","claude","anthropic","fast"]}),Q("or-gemini-pro","Gemini 2.0 Flash","Google's fast multimodal model. Good for general tasks with long context.","google/gemini-2.0-flash-001",.1,.4,{tags:["llm","gemini","google","multimodal","fast","cheap"]}),Q("or-gemini-3-flash","Gemini 3 Flash","Google's high-speed thinking model for agentic workflows, coding, and multimodal tasks.","google/gemini-3-flash-preview",.5,3,{tags:["llm","gemini","google","agentic","coding","fast"]}),Q("or-gemini-3-pro","Gemini 3 Pro","Google's flagship frontier model for deep reasoning, multimodal analysis, and agentic coding.","google/gemini-3-pro-preview",2,12,{tags:["llm","gemini","google","reasoning","coding","multimodal"]}),Q("or-gemini-3-lite","Gemini 3.1 Flash Lite","Google's efficient multimodal model optimized for low-latency, high-volume agent workloads.","google/gemini-3.1-flash-lite",.25,1.5,{tags:["llm","gemini","google","fast","cheap","multimodal"]}),Q("or-llama-70b","Llama 3.3 70B","Meta's best open model. Strong reasoning, fully open-source.","meta-llama/llama-3.3-70b-instruct",.3,.4,{tags:["llm","llama","meta","open-source","reasoning"]}),Q("or-llama-8b","Llama 3.1 8B","Fast, lightweight open model. Great for simple tasks at minimal cost.","meta-llama/llama-3.1-8b-instruct",.05,.08,{tags:["llm","llama","meta","open-source","fast","cheap"]}),Q("or-mistral-large","Mistral Large","Mistral's flagship model. Strong at multilingual and European languages.","mistralai/mistral-large-2411",2,6,{tags:["llm","mistral","multilingual","european"]}),Q("or-mistral-small","Mistral Small","Fast, efficient Mistral model. Good for everyday tasks.","mistralai/mistral-small-3.1-24b-instruct",.1,.3,{tags:["llm","mistral","fast","cheap"]}),Q("or-deepseek-chat","DeepSeek Chat V3","Strong reasoning model at very low cost. Excellent for coding and math.","deepseek/deepseek-chat-v3-0324",.3,.88,{tags:["llm","deepseek","coding","math","cheap","reasoning"]}),Q("or-deepseek-r1","DeepSeek R1","Advanced reasoning model with chain-of-thought. Best for complex problems.","deepseek/deepseek-r1",.55,2.19,{tags:["llm","deepseek","reasoning","chain-of-thought","math"]}),Q("or-qwen-72b","Qwen 2.5 72B","Alibaba's large model. Strong at coding, math, and multilingual tasks.","qwen/qwen-2.5-72b-instruct",.3,.4,{tags:["llm","qwen","alibaba","coding","multilingual"]}),Q("or-phi-4","Phi-4","Microsoft's compact reasoning model. Punches above its weight for size.","microsoft/phi-4",.07,.14,{tags:["llm","phi","microsoft","compact","cheap","reasoning"]}),Q("or-perplexity-sonar","Perplexity Sonar","Search-augmented LLM. Answers with real-time web sources and citations.","perplexity/sonar",1,1,{perRequestFeeCents:.5,tags:["llm","perplexity","search","web","citations","real-time"]}),{dispatch:"enveloped",id:"query_onchain_prices",name:"Query On-Chain Prices",description:"Query real-time or historical on-chain token prices via Allium. Use this for current prices, price history over any date range, price trends, comparisons between time periods, and analytics like monthly/weekly price charts. Supports hourly and daily granularity.",provider:"allium",model:"allium-prices",category:"onchain",priceCents:1,inputSchema:{type:"object",properties:{chain:{type:"string",description:"Chain name (e.g. ethereum, solana, base, polygon)"},token_address:{type:"string",description:"Token contract address. Use the native token address for chain-native assets (e.g. ETH, SOL)."},start_timestamp:{type:"string",description:"ISO 8601 timestamp for historical range start (e.g. '2024-01-01T00:00:00Z'). Omit for current price only."},end_timestamp:{type:"string",description:"ISO 8601 timestamp for historical range end. Defaults to now if start_timestamp is set."},time_granularity:{type:"string",description:"Data resolution: '1h' (hourly) or '1d' (daily). Auto-selected based on date range if omitted."}},required:["chain","token_address"]},gatewayUrl:"https://agents.allium.so/api/v1/developer/prices",merchantName:"Allium",buildUrl:e=>e.start_timestamp?"https://agents.allium.so/api/v1/developer/prices/history":"https://agents.allium.so/api/v1/developer/prices",buildBody:wa,tags:["onchain","prices","allium","crypto"]},{dispatch:"enveloped",id:"generate_image_card",name:"Generate Image (Ultra)",description:"Generate a high-quality AI image (FLUX Pro Ultra, 2K, ~$0.06).",provider:"fal",model:"fal-ai/flux-pro/v1.1-ultra",category:"image",priceCents:6,inputSchema:{type:"object",properties:{prompt:{type:"string",description:"Text description of the image"},aspect_ratio:{type:"string",description:"Aspect ratio (e.g. 16:9, 1:1, 9:16)",default:"16:9"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/flux-pro/v1.1-ultra",merchantName:"fal.ai",deprecated:!0,replacementTool:"fal-flux-pro-ultra",buildBody:e=>{let t={prompt:e.prompt};return e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),t},tags:["image","flux","ultra","legacy"]},{dispatch:"enveloped",id:"generate_image_fast_card",name:"Generate Image (Fast)",description:"Generate an AI image (FLUX Pro v1.1, 1K, ~$0.04).",provider:"fal",model:"fal-ai/flux-pro/v1.1",category:"image",priceCents:4,inputSchema:{type:"object",properties:{prompt:{type:"string",description:"Text description of the image"},aspect_ratio:{type:"string",description:"Aspect ratio",default:"16:9"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/flux-pro/v1.1",merchantName:"fal.ai",deprecated:!0,replacementTool:"fal-flux-pro",buildBody:e=>Tr({prompt:e.prompt,aspect_ratio:e.aspect_ratio}),tags:["image","flux","legacy"]},{dispatch:"enveloped",id:"generate_image_schnell_card",name:"Generate Image (Cheap)",description:"Cheap, fast FLUX image generation (~$0.01).",provider:"fal",model:"fal-ai/flux/schnell",category:"image",priceCents:1,inputSchema:{type:"object",properties:{prompt:{type:"string"},image_size:{type:"string"},num_inference_steps:{type:"number"},seed:{type:"number"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/flux/schnell",merchantName:"fal.ai",deprecated:!0,replacementTool:"fal-flux-schnell",buildBody:e=>{let t={prompt:e.prompt};return e.image_size&&(t.image_size=e.image_size),e.num_inference_steps!==void 0&&(t.num_inference_steps=e.num_inference_steps),e.seed!==void 0&&(t.seed=e.seed),t},tags:["image","flux","schnell","legacy"]},{dispatch:"enveloped",id:"generate_image_recraft_card",name:"Generate Image (Recraft)",description:"Recraft V3 image generation with style control.",provider:"fal",model:"fal-ai/recraft-v3",category:"image",priceCents:5,inputSchema:{type:"object",properties:{prompt:{type:"string"},style:{type:"string"},image_size:{type:"string"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/recraft-v3",merchantName:"fal.ai",deprecated:!0,replacementTool:"fal-recraft-v3",buildBody:e=>{let t={prompt:e.prompt};return e.style&&(t.style=e.style),e.image_size&&(t.image_size=e.image_size),t},tags:["image","recraft","legacy"]},{dispatch:"enveloped",id:"generate_image_ideogram_card",name:"Generate Image (Ideogram)",description:"Ideogram V2 image generation, strong with text rendering.",provider:"fal",model:"fal-ai/ideogram/v2",category:"image",priceCents:8,inputSchema:{type:"object",properties:{prompt:{type:"string"},aspect_ratio:{type:"string"},style_type:{type:"string"},negative_prompt:{type:"string"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/ideogram/v2",merchantName:"fal.ai",deprecated:!0,replacementTool:"fal-ideogram-v2",buildBody:e=>{let t={prompt:e.prompt};return e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),e.style_type&&(t.style_type=e.style_type),e.negative_prompt&&(t.negative_prompt=e.negative_prompt),t},tags:["image","ideogram","text","legacy"]},Y("upscale_image_card","Upscale Image","Upscale an image using ESRGAN.","fal-ai/esrgan","upscale",2,{type:"object",properties:{image_url:{type:"string"},scale:{type:"number"}},required:["image_url"]},{buildBody:e=>{let t={image_url:e.image_url};return e.scale!==void 0&&(t.scale=e.scale),t},tags:["upscale","esrgan"],deprecated:!0,replacementTool:"fal-aura-sr"}),Y("edit_image_seed_card","Edit Image (SeedEdit)","Inpaint/edit an image with a prompt using SeedEdit.","fal-ai/bytedance/seededit","image",5,{type:"object",properties:{image_url:{type:"string"},prompt:{type:"string"},seed:{type:"number"}},required:["image_url","prompt"]},{buildBody:e=>{let t={image_url:e.image_url,prompt:e.prompt};return e.seed!==void 0&&(t.seed=e.seed),t},tags:["image","edit","inpaint","seededit"],deprecated:!0,replacementTool:"or-gemini-nano-banana"}),{dispatch:"enveloped",id:"generate_video_tempo_card",name:"Generate Video (Grok)",description:"Generate a video from a text prompt using Grok Imagine Video.",provider:"fal",model:"xai/grok-imagine-video/text-to-video",category:"video",priceCents:30,inputSchema:{type:"object",properties:{prompt:{type:"string"},aspect_ratio:{type:"string"},duration:{type:"number"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/xai/grok-imagine-video/text-to-video",merchantName:"Grok Video via fal.ai",deprecated:!0,replacementTool:"fal-minimax-video",buildBody:e=>{let t={prompt:e.prompt};return e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),e.duration&&(t.duration=e.duration),t},tags:["video","grok","legacy"]},{dispatch:"enveloped",id:"generate_video_kling_card",name:"Generate Video (Kling)",description:"Generate a video using Kling v1.6 (async, ~$0.40).",provider:"fal",model:"fal-ai/kling-video/v1.6/standard/text-to-video",category:"video",priceCents:40,inputSchema:{type:"object",properties:{prompt:{type:"string"},negative_prompt:{type:"string"},aspect_ratio:{type:"string"},duration:{type:"number"},seed:{type:"number"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/queue/fal-ai/kling-video/v1.6/standard/text-to-video",merchantName:"Kling via fal.ai",deprecated:!0,replacementTool:"fal-kling-video",buildBody:e=>{let t={prompt:e.prompt};return e.negative_prompt&&(t.negative_prompt=e.negative_prompt),e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),e.duration&&(t.duration=e.duration),e.seed!==void 0&&(t.seed=e.seed),t},tags:["video","kling","legacy"]},{dispatch:"enveloped",id:"generate_video_wan_card",name:"Generate Video (Wan)",description:"Generate a video using Wan T2V (async, ~$0.25).",provider:"fal",model:"fal-ai/wan/t2v-1.3b",category:"video",priceCents:25,inputSchema:{type:"object",properties:{prompt:{type:"string"},negative_prompt:{type:"string"},aspect_ratio:{type:"string"},seed:{type:"number"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/queue/fal-ai/wan/t2v-1.3b",merchantName:"Wan T2V via fal.ai",deprecated:!0,replacementTool:"fal-wan-video",buildBody:e=>{let t={prompt:e.prompt};return e.negative_prompt&&(t.negative_prompt=e.negative_prompt),e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),e.seed!==void 0&&(t.seed=e.seed),t},tags:["video","wan","legacy"]},{dispatch:"enveloped",id:"generate_video_minimax_card",name:"Generate Video (MiniMax)",description:"Generate a video using MiniMax (async, ~$0.35).",provider:"fal",model:"fal-ai/minimax/video-01",category:"video",priceCents:35,inputSchema:{type:"object",properties:{prompt:{type:"string"},aspect_ratio:{type:"string"},seed:{type:"number"}},required:["prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/queue/fal-ai/minimax/video-01",merchantName:"MiniMax via fal.ai",deprecated:!0,replacementTool:"fal-minimax-video",buildBody:e=>{let t={prompt:e.prompt};return e.aspect_ratio&&(t.aspect_ratio=e.aspect_ratio),e.seed!==void 0&&(t.seed=e.seed),t},tags:["video","minimax","legacy"]},{dispatch:"enveloped",id:"check_fal_status_card",name:"Check fal Async Job Status",description:"Poll an async fal.ai queue job for completion.",provider:"fal",model:"queue-status",category:"image",priceCents:0,inputSchema:{type:"object",properties:{model_path:{type:"string",description:"Model path (e.g. fal-ai/kling-video/v1.6/standard/text-to-video)"},request_id:{type:"string"}},required:["model_path","request_id"]},gatewayUrl:"https://fal.mpp.tempo.xyz/queue",merchantName:"fal.ai",buildUrl:e=>`https://fal.mpp.tempo.xyz/queue/${e.model_path}/requests/${e.request_id}`,buildBody:()=>({}),tags:["status","fal","async","legacy"]},{dispatch:"enveloped",id:"generate_3d_card",name:"Generate 3D Model",description:"Generate a 3D mesh from a text prompt using Meshy (async, ~$0.50).",provider:"fal",model:"fal-ai/meshy-ai/text-to-3d",category:"3d",priceCents:50,inputSchema:{type:"object",properties:{object_prompt:{type:"string"},style_prompt:{type:"string"},negative_prompt:{type:"string"},art_style:{type:"string"},seed:{type:"number"}},required:["object_prompt"]},gatewayUrl:"https://fal.mpp.tempo.xyz/queue/fal-ai/meshy-ai/text-to-3d",merchantName:"Meshy via fal.ai",deprecated:!0,replacementTool:"fal-trellis-3d",buildBody:e=>{let t={object_prompt:e.object_prompt};return e.style_prompt&&(t.style_prompt=e.style_prompt),e.negative_prompt&&(t.negative_prompt=e.negative_prompt),e.art_style&&(t.art_style=e.art_style),e.seed!==void 0&&(t.seed=e.seed),t},tags:["3d","mesh","meshy","legacy"]},{dispatch:"enveloped",id:"generate_speech_card",name:"Generate Speech",description:"Text-to-speech using F5-TTS with optional voice cloning.",provider:"fal",model:"fal-ai/f5-tts",category:"tts",priceCents:3,inputSchema:{type:"object",properties:{gen_text:{type:"string",description:"Text to synthesize"},ref_audio_url:{type:"string",description:"Reference audio URL (for voice cloning)"},ref_text:{type:"string",description:"Transcription of ref audio"},remove_silence:{type:"boolean"}},required:["gen_text"]},gatewayUrl:"https://fal.mpp.tempo.xyz/fal-ai/f5-tts",merchantName:"fal.ai",buildBody:e=>{let t={gen_text:e.gen_text};return e.ref_audio_url&&(t.ref_audio_url=e.ref_audio_url),e.ref_text&&(t.ref_text=e.ref_text),e.remove_silence!==void 0&&(t.remove_silence=e.remove_silence),t},deprecated:!0,replacementTool:"fal-metavoice",tags:["tts","speech","f5-tts","legacy"]},{dispatch:"enveloped",id:"generate_music_tempo_card",name:"Generate Music (Suno)",description:"Generate a music track using Suno (async, ~$0.50).",provider:"suno",model:"suno-v4",category:"audio",priceCents:50,inputSchema:{type:"object",properties:{prompt:{type:"string"},instrumental:{type:"boolean"},model:{type:"string",default:"V4"}},required:["prompt"]},gatewayUrl:"https://suno.mpp.paywithlocus.com/suno/generate-music",merchantName:"Suno via Tempo",buildBody:e=>({prompt:e.prompt,customMode:!1,instrumental:e.instrumental??!1,model:e.model||"V4"}),isAsync:!0,pollUrl:"https://suno.mpp.paywithlocus.com/suno/get-music-status",pollInterval:15e3,pollTimeout:3e5,deprecated:!0,tags:["music","audio","suno","async","legacy"]},{dispatch:"enveloped",id:"check_music_status_tempo_card",name:"Check Music Status",description:"Poll a Suno music generation task for completion.",provider:"suno",model:"suno-status",category:"audio",priceCents:0,inputSchema:{type:"object",properties:{taskId:{type:"string"}},required:["taskId"]},gatewayUrl:"https://suno.mpp.paywithlocus.com/suno/get-music-status",merchantName:"Suno Status",buildBody:e=>({taskId:e.taskId}),deprecated:!0,tags:["music","status","suno","legacy"]},{dispatch:"enveloped",id:"query_onchain_prices_card",name:"Query On-Chain Prices",description:"Query real-time or historical on-chain token prices via Allium. Use this for current prices, price history over any date range, price trends, comparisons between time periods, and analytics like monthly/weekly price charts. Supports hourly, daily, and weekly granularity.",provider:"allium",model:"allium-prices",category:"llm",priceCents:1,inputSchema:{type:"object",properties:{chain:{type:"string",description:"Chain name (e.g. ethereum, solana, base, polygon)"},token_address:{type:"string",description:"Token contract address. Use the native token address for chain-native assets (e.g. ETH, SOL)."},start_timestamp:{type:"string",description:"ISO 8601 timestamp for historical range start (e.g. '2024-01-01T00:00:00Z'). Omit for current price only."},end_timestamp:{type:"string",description:"ISO 8601 timestamp for historical range end. Defaults to now if start_timestamp is set."},time_granularity:{type:"string",description:"Data resolution: '1h' (hourly), '1d' (daily), or '1w' (weekly). Auto-selected based on date range if omitted."}},required:["chain","token_address"]},gatewayUrl:"https://agents.allium.so/api/v1/developer/prices",merchantName:"Allium",deprecated:!0,replacementTool:"query_onchain_prices",buildUrl:e=>e.start_timestamp?"https://agents.allium.so/api/v1/developer/prices/history":"https://agents.allium.so/api/v1/developer/prices",buildBody:wa,tags:["onchain","prices","allium","crypto","legacy"]}];function Un(e){return Zs.find(t=>t.id===e)}var ka=1,Ta=["pick_one","fan_out"],Ea=["concat","dedupe_by_url","top_k_by_score"],um=8,dm=p.object({type:p.string().min(1),description:p.string().min(1),enum:p.array(p.string()).optional(),default:p.unknown().optional(),minimum:p.number().optional(),maximum:p.number().optional()}),mm=p.object({toolId:p.string().min(1),notes:p.string().min(1)}),pm=p.string().regex(/^[a-z0-9_-]{1,32}$/,"tier key must be 1-32 chars [a-z0-9_-]"),fm=p.object({providers:p.array(p.string().min(1)).min(1).max(um),merge:p.enum(Ea),maxResults:p.number().int().positive().optional()}),Aa=p.object({mode:p.enum(Ta).default("pick_one"),intro:p.string().min(1),defaultTier:p.string().min(1),tiers:p.record(pm,mm).refine(e=>Object.keys(e).length>0,{message:"must have at least one tier"}),fanOut:fm.optional(),guidance:p.string().min(1),inputProperties:p.record(p.string(),dm),required:p.array(p.string())}).refine(e=>e.tiers[e.defaultTier]!==void 0,{message:"defaultTier must exist in tiers",path:["defaultTier"]}).refine(e=>e.mode!=="fan_out"||e.fanOut!==void 0,{message:"fan_out mode requires fanOut config",path:["fanOut"]}).refine(e=>e.required.every(t=>t in e.inputProperties),{message:"required entries must exist in inputProperties",path:["required"]}),gm=p.object({version:p.literal(ka),generatedAt:p.string().datetime(),tools:p.record(p.string().regex(Js,"tool name must match MCP naming rules"),Aa).refine(e=>Object.keys(e).length>0,{message:"manifest must have at least one tool"})});var Qs=require("child_process"),Ma=require("util"),Oa=R(require("crypto")),ce=R(require("fs")),Na=R(require("os")),Ve=R(require("path"));var dn=(0,Ma.promisify)(Qs.execFile),Rr=Ve.join(Na.homedir(),".visa-mcp","bin"),Jt=Ve.join(Rr,"Visa CLI"),_m=Ve.join(__dirname,"..","native"),Ra="5",$a=Ve.join(Rr,"visa-keychain.version"),Ia=Ve.join(Rr,"visa-keychain.sha256");function Pa(e){let t=ce.readFileSync(e);return Oa.createHash("sha256").update(t).digest("hex")}async function La(){try{if(ce.readFileSync($a,"utf-8").trim()===Ra&&ce.existsSync(Jt)){let r=ce.readFileSync(Ia,"utf-8").trim();if(Pa(Jt)!==r)m.warn("binary:hash-mismatch",{message:"Binary hash mismatch \u2014 possible tampering detected. Recompiling from source."}),ce.unlinkSync(Jt);else return Jt}}catch{}let e=Ve.join(_m,"visa-keychain.m");if(ce.existsSync(e)||(e=Ve.resolve(__dirname,"..","..","native","visa-keychain.m")),ce.existsSync(e)||(e=Ve.resolve(__dirname,"..","native","visa-keychain.m")),!ce.existsSync(e))throw new Error("visa-keychain.m source not found. Reinstall Visa CLI.");ce.mkdirSync(Rr,{recursive:!0,mode:448});try{await dn("clang",["-framework","Security","-framework","LocalAuthentication","-framework","Foundation","-framework","AppKit","-o",Jt,e],{timeout:3e4})}catch(n){throw n.code==="ENOENT"?new Error("Xcode Command Line Tools required. Install: xcode-select --install"):n}let t=Pa(Jt);return ce.writeFileSync(Ia,t,{mode:384}),ce.writeFileSync($a,Ra,{mode:384}),Jt}async function Da(e){let t=await La(),n;try{n=(await dn(t,e,{timeout:6e4})).stdout}catch(o){n=o.stdout||"";let i=n.trim();throw i.startsWith("ERROR:")?new Error(i.slice(6)):new Error(o.stderr?.trim()||o.message||"Unknown error")}let r=n.trim();if(r.startsWith("OK:"))return r.slice(3);if(r==="OK")return;let s=r.startsWith("ERROR:")?r.slice(6):"Unknown error";throw new Error(s)}var Xs=null;function Z(){return En()?!0:process.platform!=="darwin"?!1:Xs!==null?Xs:(Xs=!0,!0)}var Er="visa-cli",Ar="attestation-key";async function vm(e){try{await dn("security",["delete-generic-password","-s",Er,"-a",Ar],{timeout:5e3})}catch{}await dn("security",["add-generic-password","-s",Er,"-a",Ar,"-w",e],{timeout:5e3})}async function bm(){try{let{stdout:e}=await dn("security",["find-generic-password","-s",Er,"-a",Ar,"-w"],{timeout:5e3});return e.trim()||null}catch{return null}}async function jn(){let e=await Da(["generate-key"]);if(!e)throw new Error("Key generation returned no output");let t=e.indexOf(":");if(t<0)throw new Error("Unexpected generate-key output format");let n=e.slice(0,t),r=e.slice(t+1);return await vm(n),r}async function mn(e,t){if(En())return Promise.resolve(ci());let n=await bm();if(!n)throw new Error("Attestation key not found. Run setup to generate a new key.");let r=await La(),s=["sign",e];return t&&s.push(t),new Promise((o,i)=>{let a=(0,Qs.execFile)(r,s,{timeout:6e4},(l,c)=>{let u=(c||"").trim();if(l){u.startsWith("ERROR:")?i(new Error(u.slice(6))):i(new Error(l.stderr?.trim()||l.message||"Unknown error"));return}u.startsWith("OK:")?o(u.slice(3)):i(new Error(u.startsWith("ERROR:")?u.slice(6):"Unknown error"))});a.stdin.write(n),a.stdin.end()})}async function $r(){try{await dn("security",["delete-generic-password","-s",Er,"-a",Ar],{timeout:5e3})}catch{}try{await Da(["delete-key"])}catch{}}var Sm=["generate_image_card","generate_image_fast_card","generate_video_tempo_card","generate_music_tempo_card","check_music_status_tempo_card","query_onchain_prices_card"],wm=[...Sm.map(e=>({id:`legacy.${e}`,match:{kind:"exact_tool",toolId:e},targetToolId:e,rail:"tempo",reason:"Preserve legacy Tempo _card target while the top-level MCP surface is opt-in."}))];function to(e,t=wm){for(let r of t)if(r.match.kind==="exact_tool"&&r.match.toolId===e.requestedTool)return r.targetToolId;let n=eo(e.intentText);for(let r of t)if(r.match.kind==="intent"&&r.match.metaTool===e.metaTool&&!(r.match.tier&&r.match.tier!==e.tier)&&!(r.match.provider&&!n.includes(eo(r.match.provider)))&&r.match.keywords.every(s=>n.includes(eo(s))))return r.targetToolId;return null}function eo(e){return(e??"").toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}var Ua={generate_image:{intro:'Generate an AI image from a text prompt \u2014 useful for hero shots, marketing assets, social posts, blog covers, app mockups, or any time the user asks for art, a logo, an icon, a thumbnail, or "a picture of \u2026". From $0.01 (fast) to $0.06 (pro), returns a hosted PNG/JPG URL. Default tier: balanced ($0.04, 1K, ~10s).',tiers:{balanced:{toolId:"fal-flux-pro",notes:"FLUX Pro v1.1, 1K, ~10s (DEFAULT \u2014 good quality/speed tradeoff)"},fast:{toolId:"fal-flux-schnell",notes:"FLUX Schnell, 1K, ~3s (drafts, iteration, cheapest)"},pro:{toolId:"fal-flux-pro-ultra",notes:"FLUX Pro Ultra, 2K, ~30s (hero images, detail)"},text_heavy:{toolId:"fal-ideogram-v2",notes:"Ideogram V2 \u2014 best when the image contains rendered text/logos"},vector:{toolId:"fal-recraft-v3",notes:"Recraft V3 \u2014 vector/flat/illustration styles"}},guidance:"If the user didn't specify a tier, pick 'balanced' unless the prompt clearly signals otherwise (text \u2192 text_heavy, logo/icon \u2192 vector, quick test \u2192 fast, hero/print \u2192 pro).",inputProperties:{prompt:{type:"string",description:"Text description of the image to generate."},aspect_ratio:{type:"string",description:'Aspect ratio, e.g. "16:9", "1:1", "9:16".',default:"16:9"}},required:["prompt"]},generate_video:{intro:'Generate a short AI video from a text prompt \u2014 useful for product demos, social clips, mood reels, ad concepts, or any "make me a video of \u2026" request. $0.10\u2013$0.40 per ~6s clip depending on tier. Async: returns a request_id; use execute_tool with tool_id "check_fal_status_card" to resolve it (60\u2013180s).',tiers:{balanced:{toolId:"fal-minimax-video",notes:"MiniMax \u2014 good quality/price balance (DEFAULT)"},fast:{toolId:"fal-wan-video",notes:"Wan \u2014 cheapest, shorter clips"},pro:{toolId:"fal-kling-video",notes:"Kling \u2014 highest quality, cinematic"}},guidance:'Show the tier menu with prices unless the user specified one. Videos take 60-180s to generate and are processed asynchronously. The response includes a request_id and model_path. Poll with execute_tool using tool_id "check_fal_status_card" and params {request_id, model_path}. Do not poll more than once per 30 seconds.',inputProperties:{prompt:{type:"string",description:"Text description of the video scene."},aspect_ratio:{type:"string",description:'Aspect ratio, e.g. "16:9" or "9:16".',default:"16:9"}},required:["prompt"]},generate_music:{intro:'Generate an original music track from a prompt via ACE-Step. ~$0.02 for the default 60s track. Use for songs, backing tracks, jingles, vocal music, instrumental music, or any "make a song/music/track" request. Takes ~60-90s and may return a request_id to poll with check_fal_status_card. For SFX, chimes, ambient beds, or TTS, use generate_audio instead.',tiers:{ace_step:{toolId:"fal-ace-step-music",notes:"ACE-Step \u2014 prompt-to-music with vocals or instrumentals"}},guidance:"Use for songs and music tracks. Takes ~60-90s and may return a request_id to poll with check_fal_status_card. For sound effects, chimes, ambient beds, or TTS, use generate_audio instead.",inputProperties:{prompt:{type:"string",description:"Musical style, mood, instruments, subject, and lyrics direction."},instrumental:{type:"boolean",description:"True for instrumental music with no vocals; false for vocal tracks.",default:!1},duration:{type:"number",description:"Duration in seconds.",default:60}},required:["prompt"]},generate_audio:{intro:'Generate sound effects from a text prompt (sfx tier \u2014 default), or voice-cloned speech from text + a reference audio URL (tts tier). $0.03\u2013$0.04. Use for SFX, chimes, UI sounds, ambient audio (default sfx), or voice cloning when a reference audio URL is available (pass tier:"tts"). Default tier is sfx; pass tier:"tts" for voice cloning.',tiers:{sfx:{toolId:"fal-stable-audio",notes:"Stable Audio \u2014 sound effects and ambient from a prompt"},tts:{toolId:"fal-metavoice",notes:"MetaVoice \u2014 voice cloning TTS (requires a voice sample URL)"}},guidance:'Default tier is sfx: pass prompt describing the sound. For tts (voice cloning): pass tier:"tts" + text + audio_url.',inputProperties:{prompt:{type:"string",description:"Description of sound to generate (sfx tier, default)."},text:{type:"string",description:"Text to speak aloud (tts tier)."},audio_url:{type:"string",description:"URL of a voice sample to clone (tts tier, required for voice cloning)."}},required:[]},generate_3d:{intro:"Generate a 3D mesh (GLB) from an image URL via Trellis. ~$0.08, ~30\u201360s. Use when the user shares an image and asks for a 3D model, asset, AR-ready mesh, or game-ready GLB.",tiers:{trellis:{toolId:"fal-trellis-3d",notes:"Trellis \u2014 image-to-3D, returns a GLB mesh URL"}},guidance:"Pass an image URL. Takes ~30-60s. Returns a downloadable 3D mesh URL.",inputProperties:{image_url:{type:"string",description:"URL of the image to convert to a 3D model."}},required:["image_url"]},upscale_image:{intro:'Upscale an image to 4\xD7 resolution via Aura SR (preserves detail without hallucination). ~$0.03. Use whenever the user shares a low-res image and asks to "upscale", "make this higher resolution", "4x this", "enhance", or to print/export at larger size.',tiers:{aura:{toolId:"fal-aura-sr",notes:"Aura SR \u2014 default; preserves detail without hallucination"}},guidance:"Pass the existing image URL. Returns an upscaled version.",inputProperties:{image_url:{type:"string",description:"URL of the image to upscale."}},required:["image_url"]},transcribe_audio:{intro:'Transcribe speech in an audio or video file (URL) to text via OpenAI Whisper. ~$0.02 per file, multilingual, handles long files. Use whenever the user asks to "transcribe this", "what does this audio say", "make subtitles", "convert this to text", or shares an audio/video URL with no other clear intent.',tiers:{whisper:{toolId:"fal-whisper",notes:"OpenAI Whisper \u2014 fast, multilingual"}},guidance:"Pass the URL. Returns the transcript text.",inputProperties:{audio_url:{type:"string",description:"URL of the audio or video file to transcribe."}},required:["audio_url"]},run_llm:{intro:"Run a text prompt through a different LLM (GPT-4o-mini, Claude Sonnet, DeepSeek R1/V3, Perplexity Sonar with web search, or Llama 70B). Token-metered, typically ~$0.01\u2013$0.10 per call. Use for: web-grounded answers (search tier), second-opinion reasoning (reasoning tier), code generation in a different family (coding tier), deep math/logic (deep_reasoning tier), or fast cheap text cleanup (fast tier). Pair with batch for multi-model councils.",tiers:{fast:{toolId:"or-gpt-4o-mini",notes:"GPT-4o Mini. Fastest, cheapest, good general-purpose (DEFAULT)"},reasoning:{toolId:"or-claude-sonnet",notes:"Claude Sonnet. Strong reasoning, long-context. Warn user it is materially pricier than `fast`."},deep_reasoning:{toolId:"or-deepseek-r1",notes:"DeepSeek R1. Deep chain-of-thought reasoning, mid-range pricing."},search:{toolId:"or-perplexity-sonar",notes:"Perplexity Sonar. Search-augmented, web-grounded with citations."},open_source:{toolId:"or-llama-70b",notes:"Llama 3.3 70B. Open-source large model."},coding:{toolId:"or-deepseek-chat",notes:"DeepSeek Chat V3. Strong at code generation."}},guidance:"Pick based on the user's need: fast (most questions, cheapest), reasoning (complex analysis; warn user it is materially pricier than fast), search (questions about current events), coding (code generation), deep_reasoning (hard math/logic problems).",inputProperties:{prompt:{type:"string",description:"The user query."},system_prompt:{type:"string",description:"Optional system prompt to set model behavior."},max_tokens:{type:"number",description:"Maximum output tokens.",default:1024,minimum:1,maximum:8192},temperature:{type:"number",description:"Sampling temperature \u2014 0 is deterministic, higher is more creative.",default:.7,minimum:0,maximum:2}},required:["prompt"]}};function no(e,t,n){if(!qa(e))return Tm(e,n);let r=ja[e];if(!r)return e;let s=Object.keys(r.tiers),o=t||s[0],i=Em(e,o,n);return i||Am(e,r,o,s)}function Tm(e,t){return to({requestedTool:e,intentText:t})??e}function Em(e,t,n){return to({requestedTool:e,metaTool:e,tier:t,intentText:n})}function Am(e,t,n,r){let s=t.tiers[n];if(!s)throw new Error(`Unknown tier '${n}' for ${e}. Valid tiers: ${r.join(", ")}`);return s.toolId}var ja=Ua;function qa(e){return e in ja}var qn=Object.keys(Ua);function ro(e=process.env){let t=e.VISA_DRY_RUN;return t==="true"||t==="1"||t==="mock"?"mock":t==="preflight"?"preflight":null}function Va(e=process.env){return ro(e)!==null}var oe=R(require("crypto")),$e=R(require("fs")),$o=R(require("os")),Qr=R(require("path"));var j=R(require("fs")),hn=R(require("os")),H=R(require("path")),Ka=require("child_process");var Fa=R(require("fs")),Rm=["npm","pnpm","yarn","bun"],$m=/\s+/;function Im(){let e=process.env.npm_config_user_agent;if(!e)return;let t=e.trim();if(t==="")return;let n=t.split($m)[0]??"",r=n.indexOf("/"),s=r===-1?n:n.slice(0,r);return Rm.includes(s)?s:void 0}function so(e){if(!e)return;let t=e;try{t=Fa.realpathSync(e)}catch{}let n=t.replace(/\\/g,"/").toLowerCase();if(n.includes("/pnpm/")||n.includes("/.pnpm/"))return"pnpm";if(n.includes("/yarn/")||n.includes("/.yarn/"))return"yarn";if(n.includes("/bun/")||n.includes("/.bun/"))return"bun";if(n.includes("/npm/")||n.includes("/node_modules/@visa/cli/"))return"npm"}function Pm(e=process.argv[1]){return Im()??so(process.env.npm_execpath)??so(process.env.npm_node_execpath)??so(e)}function oo(e,t,n){let r=t??Pm(n)??"npm",o=`@visa/cli@${e??"latest"}`;switch(r){case"npm":return{packageManager:r,command:"npm",args:["install","-g",o],display:`npm install -g ${o}`};case"pnpm":return{packageManager:r,command:"pnpm",args:["add","-g",o],display:`pnpm add -g ${o}`};case"yarn":return{packageManager:r,command:"yarn",args:["global","add",o],display:`yarn global add ${o}`};case"bun":return{packageManager:r,command:"bun",args:["add","-g",o],display:`bun add -g ${o}`}}}function pn(e,t,n){return oo(e,t,n).display}var Mm=2,Vn="# >>> visa-cli shell hud v2 >>>",Pr="# <<< visa-cli shell hud v2 <<<",Ga="# >>> visa-cli shell hud >>>",Om="# <<< visa-cli shell hud <<<",za=3e4,Nm=6e4,Lm="VISA | HUD not ready \u2014 run: visa-cli config hud doctor",Dm={currentVersion:"0.0.0"},Um=3e4;function co(){try{return H.join(po(),".visa-cli")}catch{return H.join(hn.tmpdir(),".visa-cli")}}function vt(){return H.join(co(),"shell-hud.json")}function Mr(){return H.join(co(),"shell-hud.line")}function Wa(){return H.join(co(),"shell-hud.lock")}function yn(e){let t=e??process.env.SHELL;if(!t)return null;let n=H.basename(t.replace(/\\/g,"/")).toLowerCase();return n==="zsh"?"zsh":n==="bash"?"bash":n==="pwsh"||n==="pwsh.exe"||n==="powershell"||n==="powershell.exe"?"powershell":null}function Bn(e){let t=po();if(e==="zsh")return H.join(t,".zshrc");if(e==="bash")return H.join(t,".bashrc");let n=(process.platform==="win32","PowerShell");return H.join(t,"Documents",n,"Microsoft.PowerShell_profile.ps1")}function jm(e){let t=po(),n=[{shell:"zsh",rcPath:H.join(t,".zshrc")},{shell:"bash",rcPath:H.join(t,".bashrc")},{shell:"bash",rcPath:H.join(t,".bash_profile")},{shell:"powershell",rcPath:H.join(t,"Documents","PowerShell","Microsoft.PowerShell_profile.ps1")}];if(!e)return n;let r=n.filter(o=>o.shell===e),s=n.filter(o=>o.shell!==e);return[...r,...s]}function qm(e){let t="$HOME/.visa-cli/shell-hud.line",n=Qm(e),r=ep(e);if(e==="zsh")return`${Vn}
|
|
49
38
|
_visa_cli_shell_hud_precmd() {
|
|
50
39
|
setopt localoptions no_bg_nice
|
|
51
|
-
if [[ -f "${
|
|
52
|
-
print -r -- "$(cat "${
|
|
40
|
+
if [[ -f "${t}" ]]; then
|
|
41
|
+
print -r -- "$(cat "${t}")"
|
|
53
42
|
fi
|
|
54
43
|
if ${r}; then
|
|
55
|
-
local _vhud_count=$(pgrep -f "visa-cli shell-hud refresh" 2>/dev/null | wc -l | tr -d ' ')
|
|
44
|
+
local _vhud_count=$(pgrep -f "visa-cli config shell-hud refresh" 2>/dev/null | wc -l | tr -d ' ')
|
|
56
45
|
if [[ "\${_vhud_count:-0}" -lt 3 ]]; then
|
|
57
46
|
${n} &>/dev/null &!
|
|
58
47
|
fi
|
|
@@ -62,13 +51,13 @@ autoload -Uz add-zsh-hook
|
|
|
62
51
|
if [[ -z "\${precmd_functions[(r)_visa_cli_shell_hud_precmd]}" ]]; then
|
|
63
52
|
add-zsh-hook precmd _visa_cli_shell_hud_precmd
|
|
64
53
|
fi
|
|
65
|
-
${
|
|
54
|
+
${Pr}`;if(e==="powershell"){let s="(Join-Path $HOME '.visa-cli/shell-hud.line')";return`${Vn}
|
|
66
55
|
if (-not (Test-Path Function:\\global:__visa_cli_original_prompt)) {
|
|
67
56
|
$function:global:__visa_cli_original_prompt = if (Test-Path Function:\\prompt) { $function:prompt } else { { '' } }
|
|
68
57
|
}
|
|
69
58
|
function global:prompt {
|
|
70
|
-
if (Test-Path ${
|
|
71
|
-
Write-Host (Get-Content ${
|
|
59
|
+
if (Test-Path ${s}) {
|
|
60
|
+
Write-Host (Get-Content ${s} -Raw)
|
|
72
61
|
}
|
|
73
62
|
if (${r}) {
|
|
74
63
|
# Reap any completed visa-hud jobs before starting a new one so the session
|
|
@@ -81,14 +70,14 @@ function global:prompt {
|
|
|
81
70
|
}
|
|
82
71
|
& $function:global:__visa_cli_original_prompt
|
|
83
72
|
}
|
|
84
|
-
${
|
|
73
|
+
${Pr}`}return`${Vn}
|
|
85
74
|
__visa_cli_shell_hud_precmd() {
|
|
86
|
-
if [ -f "${
|
|
87
|
-
cat "${
|
|
75
|
+
if [ -f "${t}" ]; then
|
|
76
|
+
cat "${t}"
|
|
88
77
|
fi
|
|
89
78
|
if ${r}; then
|
|
90
79
|
local _vhud_count
|
|
91
|
-
_vhud_count=$(pgrep -f "visa-cli shell-hud refresh" 2>/dev/null | wc -l | tr -d ' ')
|
|
80
|
+
_vhud_count=$(pgrep -f "visa-cli config shell-hud refresh" 2>/dev/null | wc -l | tr -d ' ')
|
|
92
81
|
if [ "\${_vhud_count:-0}" -lt 3 ]; then
|
|
93
82
|
${n} &>/dev/null &
|
|
94
83
|
fi
|
|
@@ -98,64 +87,94 @@ case ";$PROMPT_COMMAND;" in
|
|
|
98
87
|
*";__visa_cli_shell_hud_precmd;"*) ;;
|
|
99
88
|
*) PROMPT_COMMAND="__visa_cli_shell_hud_precmd\${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
|
|
100
89
|
esac
|
|
101
|
-
${
|
|
90
|
+
${Pr}`}function Ja(e){let t=e;for(let[n,r]of[[Vn,Pr],[Ga,Om]])t=t.replace(new RegExp(`\\n?${Ha(n)}[\\s\\S]*?${Ha(r)}\\n?`,"g"),"");return t.trimEnd()}function Vm(e,t){let n=Ja(e).trimEnd(),r=qm(t);return n.length>0?`${n}
|
|
102
91
|
|
|
103
92
|
${r}
|
|
104
93
|
`:`${r}
|
|
105
|
-
`}function
|
|
106
|
-
`:""),{removed:!0,shell:
|
|
107
|
-
`),
|
|
108
|
-
`)
|
|
109
|
-
`)
|
|
110
|
-
`)
|
|
111
|
-
`)
|
|
112
|
-
`),
|
|
113
|
-
`)
|
|
114
|
-
`);return
|
|
115
|
-
`)?c:c
|
|
116
|
-
`}let a=t.trimEnd();return a+(a.length>0?`
|
|
117
|
-
|
|
118
|
-
`:"")+o.join(`
|
|
94
|
+
`}function Or(e=yn()){if(!e)return!1;try{let t=Bn(e),n=j.readFileSync(t,"utf-8");return n.includes(Vn)||n.includes(Ga)}catch{return!1}}function Nr(e=yn()){if(!e)return{installed:!1,changed:!1,shell:null,message:"Shell HUD auto-install skipped: supported shells are zsh, bash, and PowerShell."};let t;try{t=Bn(e);let n=j.existsSync(t)?j.readFileSync(t,"utf-8"):"",r=Vm(n,e),s=r!==n;return s&&gn(t,r),{installed:!0,changed:s,shell:e,rcPath:t,message:s?`Persistent shell HUD installed in ${t}. Open a new terminal to start seeing it. Disable it any time with: visa-cli config shell-hud disable`:`Persistent shell HUD already installed in ${t}. Disable it any time with: visa-cli config shell-hud disable`}}catch(n){return{installed:!1,changed:!1,shell:e,rcPath:t,message:`Failed to install persistent shell HUD in ${t}: ${ao(n)}`}}}function Lr(e=yn()){let t=[],n=[],r=[];try{for(let s of jm(e))if(n.push(s.rcPath),!!j.existsSync(s.rcPath))try{let o=j.readFileSync(s.rcPath,"utf-8"),i=Ja(o);if(i===o.trimEnd())continue;gn(s.rcPath,i.length>0?`${i}
|
|
95
|
+
`:""),t.push(s.rcPath)}catch(o){r.push(`${s.rcPath}: ${ao(o)}`)}return t.length>0?{removed:!0,shell:e,rcPath:t[0],rcPaths:t,message:r.length>0?`Removed persistent shell HUD from ${t.join(", ")}. Some rc files could not be updated: ${r.join("; ")}.`:`Removed persistent shell HUD from ${t.join(", ")}.`}:r.length>0?{removed:!1,shell:e,rcPath:n[0],rcPaths:n,message:`Failed to remove persistent shell HUD: ${r.join("; ")}`}:{removed:!0,shell:e,rcPath:n[0],rcPaths:n,message:"Persistent shell HUD was not installed in any supported shell rc file."}}catch(s){return{removed:!1,shell:e,message:`Failed to remove persistent shell HUD: ${ao(s)}`}}}function lo(e,t){let n=t??Dm,r=n.currentVersion==="0.0.0"&&e.version?e.version:n.currentVersion,s=Qe(r),o=` ${B("\u2502",q.dim)} `,i=Ya(n),a=Gm(n,i),l=a||n.updateCheckDisabled?"":i,c=Km(s,l);if(!e.enrolled)return[c,B("setup needed",q.visaGold),a].filter(Boolean).join(o);let u=Zm(e),d=Hm(e),g=Qe(hn.hostname().split(".")[0]),f=[c,g?B(g,q.dim):"",B(u,q.visaGold),a].filter(Boolean).join(o),x=[d,Fm(e)].filter(Boolean),y=x.length>0?x.join(o):"";return y?`${f}
|
|
96
|
+
${y}`:f}function Fm(e){let t=` ${B("\u2502",q.dim)} `,n=[];if(typeof e.dailySpent=="number"&&Number.isFinite(e.dailySpent)){let r=Math.max(0,e.dailySpent);n.push(B(`spent today ${fn(r)}`,q.dim))}if(typeof e.apiKeyCount=="number"&&Number.isFinite(e.apiKeyCount)){let r=Math.max(0,Math.floor(e.apiKeyCount)),s=r===1?"api key":"api keys";n.push(B(`${r} ${s}`,q.dim))}if(e.lastService&&typeof e.lastService.toolName=="string"&&e.lastService.toolName.length>0){let r=Qe(e.lastService.toolName),s=Bm(e.lastService.createdAt),o=B(s?`last ${r} ${s}`:`last ${r}`,q.dim);n.push(o)}return n.join(t)}function Bm(e){if(!e)return"";let t=Date.parse(e);if(!Number.isFinite(t))return"";let n=Date.now()-t;if(n<0)return"";let r=Math.floor(n/1e3);if(r<60)return`${r}s`;let s=Math.floor(r/60);if(s<60)return`${s}m`;let o=Math.floor(s/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function Hm(e){let t=typeof e.balanceCents=="number"?e.balanceCents:typeof e.prepaidBalance?.cents=="number"?e.prepaidBalance.cents:null,n=e.activeSession;if(t===null)return B("balance unknown",q.dim);let r=t/100;if(n){let i=Math.max(0,n.capCents),a=Math.max(0,n.estimatedRemainingCents),l=Math.max(0,i-a),c=i>0?Math.max(0,Math.min(1,l/i)):0;return`${Ym(c)} ${B(`${fn(a/100)} in session`,q.green)} ${B(`(${fn(l/100)}/${fn(i/100)} cap)`,q.dim)} ${B("\xB7",q.dim)} ${B(`${fn(r)} balance`,q.dim)}`}let s=10,o=`balance ${fn(r)}`;return t>=s?B(o,q.green):B(`${o} \u2014 top up via buy_credits`,q.visaGold)}function Km(e,t){let n=e,r=`${B("VISA CLI",q.visaBlue)} ${B(`v${n}`,q.visaBlueSoft)}`;if(!t)return r;let s=t;return`${r} ${B("\u2B06 update",q.visaGold)} ${B(`v${s}`,q.visaGold)}`}function Gm(e,t){if(t&&!e.updateCheckDisabled){let n=Qe(pn(t));return B(`run: ${n}`,q.visaGold)}return t?null:zm(e)}function Ya(e){return e.latestVersion?Qe(e.latestVersion):""}function zm(e){let t=Ya(e);return t?B(`update ready v${t}`,q.visaGold):null}function Za(){let e=Hn();return!(!e||Date.now()-e.renderedAt>za||e.cwd&&e.cwd!==process.cwd())}function Dr(){let e=Hn(),t=Date.now();if(e&&t-e.renderedAt<=za||(Jm(),e?.line))return Ba(e.line,e,t);try{let n=Mr();if(j.existsSync(n))return j.readFileSync(n,"utf-8").trimEnd()}catch{}return Lm}function Ba(e,t,n){let r=n-t.renderedAt,s=typeof t.refreshFailedAt=="number"&&t.refreshFailedAt>t.renderedAt,o=[];if(r>=Nm&&o.push(`stale ${Wm(r)}`),s&&o.push("\u26A0 refresh failed"),o.length===0)return e;let i=` ${B("\xB7",q.dim)} ${B(o.join(" \xB7 "),q.visaGold)}`,a=e.split(`
|
|
97
|
+
`);for(let l=a.length-1;l>=0;l--)if(a[l].length>0)return a[l]=`${a[l]}${i}`,a.join(`
|
|
98
|
+
`);return`${e}${i}`}function Wm(e){if(e<0)return"0s";let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function uo(e,t){try{let n=H.dirname(vt());j.mkdirSync(n,{recursive:!0});let r=e.split(`
|
|
99
|
+
`).map(o=>Qe(o)).filter(o=>o.length>0).join(`
|
|
100
|
+
`),s={hudVersion:Mm,renderedAt:Date.now(),line:r,cwd:process.cwd(),status:t};gn(vt(),JSON.stringify(s)+`
|
|
101
|
+
`),gn(Mr(),r+`
|
|
102
|
+
`)}catch{}}function Xa(e){try{let t=Hn();if(!t)return;let n=Math.max(Date.now(),t.renderedAt+1),r={...t,refreshFailedAt:n,refreshErrorReason:Qe(e).slice(0,200)};gn(vt(),JSON.stringify(r)+`
|
|
103
|
+
`)}catch{}}function mo(){try{let e=Hn();if(!e)return;let t={...e,renderedAt:0};gn(vt(),JSON.stringify(t)+`
|
|
104
|
+
`)}catch{}}function Fn(){try{j.unlinkSync(Wa())}catch{}}function Hn(){let e=vt();if(!j.existsSync(e))return null;try{return JSON.parse(j.readFileSync(e,"utf-8"))}catch{return null}}function Qa(){return Hn()?.status??null}function Jm(){if(process.env.JEST_WORKER_ID)return;let e=Wa();try{if(j.mkdirSync(H.dirname(e),{recursive:!0}),!tp(e))return;let t=process.argv[1]?H.resolve(process.argv[1]):"";if(!t){Fn();return}let n=(0,Ka.spawn)(process.execPath,[t,"shell-hud","refresh"],{detached:!0,stdio:"ignore",env:{...process.env,VISA_CLI_SHELL_HUD_BACKGROUND:"1"}});n.once("error",Fn),n.unref()}catch{Fn()}}function Qe(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g,"").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\u001B[P_^][^\u001B]*(?:\u001B\\|\u0007)/g,"").replace(/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g,"").replace(/\s+/g," ").trim()}function Ym(e){let n=Math.round(Math.max(0,Math.min(1,e))*10),r="\u2588".repeat(n),s="\u2591".repeat(10-n);return`${B(r||"",q.green)}${B(s||"",q.dim)}`}function fn(e){return`$${e.toFixed(2)}`}function Zm(e){let t=e.cards?.find(a=>a.isDefault)??e.cards?.[0];if(!t)return"card none";let n=typeof t.brand=="string"?t.brand:"card",r=typeof t.last4=="string"?t.last4:"????",s=Qe(n.toUpperCase()),o=Qe(r);return`${t.isDefault?"default":"active"} ${s} ****${o}`}function Xm(){let e=(process.env.COLORTERM??"").toLowerCase();if(e==="truecolor"||e==="24bit")return!0;let t=(process.env.TERM??"").toLowerCase();return t.includes("truecolor")||t.includes("24bit")}var io=Xm(),q={reset:"\x1B[0m",visaBlue:io?"\x1B[38;2;20;52;203m":"\x1B[38;5;27m",visaBlueSoft:io?"\x1B[38;2;97;126;229m":"\x1B[38;5;111m",visaGold:io?"\x1B[38;2;247;182;0m":"\x1B[38;5;220m",green:"\x1B[38;5;48m",dim:"\x1B[2m"};function B(e,t){return e.length===0||process.env.NO_COLOR?e:`${t}${e}${q.reset}`}function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function po(){let e=hn.homedir();if(!e||!H.isAbsolute(e))throw new Error("unable to determine a valid home directory");return H.resolve(e)}function Qm(e){return e==="powershell"?"& visa-cli config shell-hud refresh":"visa-cli config shell-hud refresh"}function ep(e){return e==="powershell"?"Get-Command visa-cli -ErrorAction SilentlyContinue -CommandType Application":"command -v visa-cli >/dev/null 2>&1"}function tp(e){for(let t=0;t<2;t+=1){let n;try{return n=j.openSync(e,"wx"),j.writeFileSync(n,String(Date.now())),!0}catch(r){if(r?.code!=="EEXIST")return!1;try{let s=j.statSync(e);if(Date.now()-s.mtimeMs<=Um)return!1;j.unlinkSync(e)}catch{}}finally{n!==void 0&&j.closeSync(n)}}return!1}function ao(e){return e instanceof Error?e.message:"unknown file system error"}function gn(e,t){j.mkdirSync(H.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.${Date.now()}.tmp`;j.writeFileSync(n,t),j.renameSync(n,e)}async function _n(e,t,n){try{return await t()}catch(r){if(!(r.message==="Invalid signature"||r.code==="ATTESTATION_KEY_DRIFT"||r.name==="AttestationDriftError")||!Z())throw r;m.warn("attestation:key-mismatch",{action:"reregistering"});try{let o=await jn();return await e.registerAttestationKey(o),m.info("attestation:key-reregistered"),await t()}catch(o){m.warn("attestation:fast-reregister-blocked",{error:o.message})}if(n){m.info("attestation:starting-browser-recovery");try{let o=await n();if(!o.success)throw m.error("attestation:browser-recovery-failed",{message:o.message}),r;let i=await jn();return await e.registerAttestationKey(i),m.info("attestation:key-reregistered-after-recovery"),await t()}catch(o){throw m.error("attestation:recovery-failure",{error:o.message}),r}}throw r}}var ec="2.0.0";function fo(e,t){return t?{kind:"env",var:e}:{kind:"default"}}function Ur(e,t,n){let r=process.env[e];if(r!==void 0)return{value:n==="opt-in"?r==="true":r!=="false",source:{kind:"env",var:e}};let s=_r(t);return s!==void 0?{value:s,source:{kind:"settings"}}:{value:n!=="opt-in",source:{kind:"default"}}}function ve(e){return e==null?"\u2014":e?"yes":"no"}function jr(e){return e==null?"\u2014":`$${e.toFixed(2)}`}function np(e){return e==null?"\u2014":`$${(e/100).toFixed(2)}`}function rp(){let e=process.env.VISA_CREDIT_SESSION_CAP_CENTS;if(e!==void 0){let n=Number(e);if(Number.isFinite(n)&&n>=10&&n<=1e4)return{value:Math.floor(n),source:{kind:"env",var:"VISA_CREDIT_SESSION_CAP_CENTS"}}}let t=qs("credit.sessionCapCents");return t!==void 0&&t>=10&&t<=1e4?{value:Math.floor(t),source:{kind:"settings"}}:{value:Us,source:{kind:"default"}}}async function qr(e){let t=null,n=null;try{t=await e.api.getStatus()}catch(F){n=F?.message||"unknown error"}let r=[],s=process.env.VISA_AUTH_URL,o=js("auth.serverUrl"),i=we(),a=s!==void 0&&s!==""?{kind:"env",var:"VISA_AUTH_URL"}:o!==void 0?{kind:"settings"}:{kind:"default"};r.push({key:"auth.serverUrl",value:i,formatted:i,source:a,hint:a.kind==="default"?"Persist with `visa-cli config set auth.serverUrl <url>` (or set VISA_AUTH_URL for one-off overrides).":void 0}),r.push({key:"account.enrolled",value:t?.enrolled??null,formatted:ve(t?.enrolled),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),t?.githubUser&&r.push({key:"account.githubUser",value:t.githubUser,formatted:t.githubUser,source:{kind:"server"}});let l=t?t.attestationRequired!==!1:void 0;r.push({key:"biometric.required",value:l,formatted:ve(l),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"},hint:l===!1?"Touch ID prompts are suppressed. Re-enable with `visa-cli config biometric on`.":void 0}),r.push({key:"biometric.keyRegistered",value:t?.hasAttestationKey??null,formatted:ve(t?.hasAttestationKey),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"biometric.deviceAvailable",value:Z(),formatted:ve(Z()),source:{kind:"device"}});let c=t?.spendingControls,u=c?c.max_transaction_amount??c.maxTransactionAmount??null:null,d=c?c.daily_limit??c.dailyLimit??null:null;r.push({key:"spending.maxPerTxn",value:u,formatted:jr(u),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailyLimit",value:d,formatted:jr(d),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailySpent",value:t?.dailySpent??null,formatted:jr(t?.dailySpent),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailyRemaining",value:t?.dailyRemaining??null,formatted:jr(t?.dailyRemaining),source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"cards.count",value:t?.cardCount??null,formatted:t?.cardCount!=null?String(t.cardCount):"\u2014",source:t?{kind:"server"}:{kind:"unknown",reason:n||"offline"}});let g=t?.cards?.find(F=>F.isDefault)??t?.cards?.[0];g&&r.push({key:"cards.default",value:{brand:g.brand??null,last4:g.last4},formatted:`${g.brand||"card"} \u2022\u2022\u2022\u2022 ${g.last4}`,source:{kind:"server"}});let f=rp();r.push({key:"credit.sessionCapCents",value:f.value,formatted:np(f.value),source:f.source});let x=Zi();x.length>0&&r.push({key:"settings.retired",value:x.map(F=>F.key),formatted:x.map(F=>F.key).join(", "),source:{kind:"settings"},hint:`Ignored retired settings found. Remove with: ${x.map(F=>`visa-cli config unset ${F.key}`).join(" && ")}`});let y=Ur("VISA_SUPPRESS_BROWSER","ui.suppressBrowser","opt-in");r.push({key:"ui.suppressBrowser",value:y.value,formatted:ve(y.value),source:y.source,hint:"Persist with `visa-cli config set ui.suppressBrowser true` to stop auto-opening result URLs."});let A=Ur("VISA_SUPPRESS_FEED","ui.suppressFeed","opt-in");r.push({key:"ui.suppressFeed",value:A.value,formatted:ve(A.value),source:A.source});let N=De(),L;process.env.VISA_CLI_NO_UPDATE_CHECK?L={kind:"env",var:"VISA_CLI_NO_UPDATE_CHECK"}:process.env.CI?L={kind:"env",var:"CI"}:process.env.NODE_ENV==="test"?L={kind:"env",var:"NODE_ENV"}:L={kind:"default"},r.push({key:"ui.updateCheck",value:!N,formatted:ve(!N),source:L});let T=Ur("VISA_META_TOOLS","tools.meta","opt-out");r.push({key:"tools.meta",value:T.value,formatted:ve(T.value),source:T.source,hint:"Persist with `visa-cli config set tools.meta false`. Restart Claude Code for changes to take effect."});let C=Ur("VISA_DISCOVER_TOOLS","tools.discover","opt-out");r.push({key:"tools.discover",value:C.value,formatted:ve(C.value),source:C.source});let V=process.env.VISA_DRY_RUN,G=Va();if(r.push({key:"tools.dryRun",value:G,formatted:ve(G),source:V===void 0?{kind:"default"}:{kind:"env",var:"VISA_DRY_RUN"},hint:"VISA_DRY_RUN=true|1|mock returns deterministic paid-tool fixtures (no card, no upstream). VISA_DRY_RUN=preflight makes a real zero-cost OpenRouter call for LLM tools (image/video still mocked)."}),r.push({key:"client.version",value:ec,formatted:ec,source:{kind:"default"}}),e.includeDev){let F=process.env.VISA_MOCK_KEYCHAIN,it=ct();r.push({key:"dev.mockKeychain",value:it,formatted:ve(it),source:fo("VISA_MOCK_KEYCHAIN",!!F),hint:fs()});let te=process.env.VISA_MOCK_TOUCHID,ue=En();r.push({key:"dev.mockTouchid",value:ue,formatted:ve(ue),source:fo("VISA_MOCK_TOUCHID",!!te),hint:fs()});let at=process.env.VISA_CLI_DEBUG;r.push({key:"dev.debug",value:!!at,formatted:ve(!!at),source:fo("VISA_CLI_DEBUG",!!at)})}return{entries:r,statusError:n}}function sp(e){switch(e.kind){case"default":return"default";case"env":return`env ${e.var}`;case"settings":return"settings.json";case"server":return"server";case"device":return"device";case"unset":return"unset";case"unknown":return`unknown (${e.reason})`}}function tc(e,t={}){if(e.length===0)return"";let n=Math.max(...e.map(o=>o.key.length)),r=Math.max(...e.map(o=>o.formatted.length)),s=[];for(let o of e){let i=o.key.padEnd(n+2),a=o.formatted.padEnd(r+2);s.push(`${i}${a}(${sp(o.source)})`),t.verbose&&o.hint&&s.push(` ${"\u21B3".padStart(n)} ${o.hint}`)}return s.join(`
|
|
105
|
+
`)}function nc(e){return JSON.stringify({config:e.entries.map(t=>({key:t.key,value:t.value,source:t.source,hint:t.hint})),statusError:e.statusError},null,2)}function rc(e){if(e<=0)return null;let t=(e/100).toFixed(2);return{_credits_prompt:{message:`You've got $${t} in free credits \u2014 enough for about ${Math.floor(e/6)} images. Try something now, or save them for later.`,balanceUsd:t,examples:[{tool:"generate_image",cost:"$0.06",what:"an AI image"},{tool:"run_llm",cost:"token-priced",what:"a quick model call"},{tool:"generate_music",cost:"$0.02",what:"a music track"}]}}}var he=class extends Error{constructor(t){super(t),this.name="PayValidationError"}},sc=["GET","POST"];function oc(e){let t;try{t=new URL(e)}catch{throw new he(`Invalid URL: ${e}. Expected a fully-qualified http(s) URL.`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new he(`Unsupported URL scheme "${t.protocol}". Only http and https are allowed.`);return t}function ic(e){let t=(e??"GET").toUpperCase();if(!sc.includes(t))throw new he(`Unsupported HTTP method "${e}". Supported: ${sc.join(", ")}.`);return t}function ac(e){if(e!==void 0){try{JSON.parse(e)}catch(t){throw new he(`--body is not valid JSON: ${t?.message??"parse error"}`)}return e}}function Vr(e){let t;if(typeof e=="string")try{t=new URL(e)}catch{t=void 0}else t=e;let n=t?.host.trim();return n?`merchant at ${n}`:"payment URL"}function cc(e){if(!e||typeof e!="object")throw new he("Merchant returned no payment preview.");let t=e;if(typeof t.amount!="number"||!Number.isFinite(t.amount)||t.amount<=0)throw new he("Could not determine payment amount from merchant.");if(typeof t.merchantName!="string"||t.merchantName.trim().length===0)throw new he("Merchant returned an empty merchant name.");if(t.merchantName.length>200)throw new he(`Merchant name too long (${t.merchantName.length} chars).`);if(typeof t.currency!="string"||t.currency.trim().length===0)throw new he("Merchant returned an empty currency.");if(t.currency.length>10)throw new he(`Currency code too long (${t.currency.length} chars).`);return{amount:t.amount,currency:t.currency,merchantName:t.merchantName}}var bt=require("fs"),uc=require("os"),go=require("path"),op=(0,go.join)((0,uc.homedir)(),".visa-mcp"),lc=(0,go.join)(op,"mcp-session-budget.json");function Fr(){try{(0,bt.existsSync)(lc)&&(0,bt.unlinkSync)(lc)}catch{}}var yo=require("crypto"),Re=R(Br()),Yt=null,be=0,vn=0,ye=0,St=null,_o=null,vo=null,Kr=Promise.resolve();function xp(e){return Number((0,Re.fromCents)(e))}function pc(e){return(0,Re.toCents)((0,Re.micros)(BigInt(e)))}function mc(e){return(0,Re.toWire)((0,Re.fromCents)(e))}function ho(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Hr(e){return typeof e=="string"&&/^\d+$/.test(e)}var Cp=43,kp=new RegExp(`^[A-Za-z0-9_-]{${Cp}}$`);function Tp(e){return typeof e=="string"&&kp.test(e)}function Ep(e){return!(e.status!=="accepted"||typeof e.session_id!="string"||e.session_id.length===0||Yt&&e.session_id!==Yt||typeof e.nonce!="string"||e.nonce.length===0||!Tp(e.server_signature)||!ho(e.cumulative)||!ho(e.remaining)||!ho(e.delta)||e.cumulative<be||ye>0&&e.cumulative>ye||ye>0&&e.remaining>ye||e.cumulative_micros!==void 0&&!Hr(e.cumulative_micros)||e.remaining_micros!==void 0&&!Hr(e.remaining_micros)||e.delta_micros!==void 0&&!Hr(e.delta_micros)||e.reserved_micros!==void 0&&!Hr(e.reserved_micros))}function tt(e){Yt=e,be=0,vn=0,ye=0,St=null,_o=null,vo=null,Kr=Promise.resolve()}function Kn(e){ye=Math.max(0,Math.floor(e))}function bo(){return Yt}function So(e){if(!Yt)return null;let t=be+vn;return ye>0&&t>ye&&(t=ye),{session_budget_id:Yt,cumulative_micros:xp(t),nonce:(0,yo.randomUUID)(),idempotency_key:e||(0,yo.randomUUID)()}}function wo(e){if(!e)return null;let t;try{t=Buffer.from(e,"base64").toString("utf-8")}catch{return null}let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!="object")return null;let r=n;return Ep(r)?(be=Math.max(be,r.cumulative),vn=0,St=r,r):null}function fc(){return St}function xo(e){let t=pc(e.cumulative_micros);be=Math.max(be,t),vn=0;let n={status:"accepted",session_id:e.session_budget_id,cumulative:be,remaining:Math.max(0,ye-be),delta:0,cumulative_micros:mc(be),remaining_micros:mc(Math.max(0,ye-be)),delta_micros:"0",nonce:e.nonce};return St=n,n}function Co(e){if(!e||typeof e!="object")return;let t=e.cumulative_micros;if(typeof t!="string"||!/^\d+$/.test(t))return;let n;try{n=BigInt(t)}catch{return}if(n<0n)return;let r=(0,Re.toCents)((0,Re.micros)(n));if(!Number.isFinite(r)||r<0)return;_o=t;let s=e,o=typeof s.session_id=="string"?s.session_id:Yt??"";St?(typeof s.remaining_micros=="string"&&/^\d+$/.test(s.remaining_micros)&&(St.remaining_micros=s.remaining_micros),typeof s.charged_micros=="string"&&/^\d+$/.test(s.charged_micros)&&(St.delta_micros=s.charged_micros)):St={session_id:o,cumulative:r,remaining:0,delta:0,nonce:typeof s.transaction_id=="string"?s.transaction_id:"",remaining_micros:typeof s.remaining_micros=="string"&&/^\d+$/.test(s.remaining_micros)?s.remaining_micros:void 0,delta_micros:typeof s.charged_micros=="string"&&/^\d+$/.test(s.charged_micros)?s.charged_micros:void 0}}function gc(e){let t=e.receipt??null;vo={toolName:e.toolName,resolvedToolId:e.resolvedToolId,estimatedAmountCents:Math.max(0,Math.ceil(e.estimatedAmountCents)),voucherCumulativeCents:pc(e.voucher.cumulative_micros),estimatedCumulativeCents:Gr(),receiptDeltaCents:typeof t?.delta=="number"?t.delta:null,receiptCumulativeCents:typeof t?.cumulative=="number"?t.cumulative:null,receiptRemainingCents:typeof t?.remaining=="number"?t.remaining:null,receiptDeltaMicros:typeof t?.delta_micros=="string"?t.delta_micros:null,receiptCumulativeMicros:typeof t?.cumulative_micros=="string"?t.cumulative_micros:null,receiptRemainingMicros:typeof t?.remaining_micros=="string"?t.remaining_micros:null,recordedAt:new Date().toISOString()}}function hc(){return vo}function yc(){return be}function _c(){return _o}function Gr(){let e=be+vn;return ye>0&&e>ye&&(e=ye),e}function vc(e){if(!Number.isFinite(e)||e<=0)return Promise.resolve();let t=Math.ceil(e);return Kr=Kr.then(()=>{vn+=t}),Kr}var Ap=10,Rp=1,z=null,bc=Promise.resolve();function ko(e){let t=bc.catch(()=>{}).then(e);return bc=t.then(()=>{},()=>{}),t}var le=class extends Error{balanceCents;minRequiredCents;constructor(t,n){super(`Prepaid balance is $${(t/100).toFixed(2)}; at least $${(n/100).toFixed(2)} required to open a credit session. Top up via the buy_credits tool first.`),this.name="InsufficientBalanceError"}};async function To(e,t,n){return ko(()=>Sc(e,t,n))}async function Sc(e,t,n){if(Fr(),z&&new Date(z.expiresAt).getTime()>Date.now())return bo()!==z.budgetId&&(tt(z.budgetId),Kn(z.totalCents)),m.info("mcp-session:active-hit",{budgetId:z.budgetId,tool:n.toolName,remainingEstimatedCents:z.totalCents-Gr()}),{budgetId:z.budgetId,isFresh:!1,totalCents:z.totalCents,requestedCapCents:z.totalCents,appliedCapCents:z.totalCents,clampedReason:null};z&&(z=null,tt(null));let r=await e.getBalance();if(!r.success)throw new Error(`Could not read balance: ${r.error||"unknown error"}`);let s=n.sessionKind??"explicit",o=s==="one_shot"?Rp:Ap,i=Math.max(o,Math.ceil(n.minRequiredCents??o));if(r.balanceCents<i)throw new le(r.balanceCents,i);let a=n.capCentsOverride??ea(),l=Math.min(a,r.balanceCents),c=l<a?"balance":null,u=await t("session_create",l,"Visa CLI Session",`open credit-model session with $${(l/100).toFixed(2)} cap`,n.userContext),d=await e.createSessionBudget({total_cents:l,session_kind:s,...u?{attestation:u}:{}});if(!d.success||!d.budget){let f=d.error||"unknown error";throw new Error(`Failed to open credit session: ${f}`)}let g={budgetId:d.budget.id,expiresAt:d.budget.expiresAt,totalCents:d.budget.totalCents,createdAt:d.budget.createdAt};return z=g,tt(g.budgetId),Kn(g.totalCents),m.info("mcp-session:opened",{budgetId:g.budgetId,capCents:g.totalCents,requestedCapCents:a,clampedReason:c,sessionKind:s,expiresAt:g.expiresAt,tool:n.toolName}),{budgetId:g.budgetId,isFresh:!0,totalCents:g.totalCents,requestedCapCents:a,appliedCapCents:g.totalCents,clampedReason:c}}async function wc(e,t,n){return ko(async()=>{let s=wt()?await xc(e):null,o=await Sc(e,t,n);return{budgetId:o.budgetId,totalCents:o.totalCents,closedPrevious:s,requestedCapCents:o.requestedCapCents,appliedCapCents:o.appliedCapCents,clampedReason:o.clampedReason}})}async function xc(e){let n=wt()?.budgetId??bo(),r=!1;if(n)try{r=!!(await e.closeSession(n))?.success}catch(s){m.warn("mcp-session:close-server-failed",{budgetId:n,error:s?.message||String(s)})}return Fr(),z=null,tt(null),{closedServerSide:r,budgetId:n}}async function zr(e){return ko(()=>xc(e))}function wt(){return Fr(),z?new Date(z.expiresAt).getTime()<=Date.now()?(z=null,tt(null),null):{budgetId:z.budgetId,totalCents:z.totalCents,lastReceiptCumulative:yc(),lastReceiptCumulativeMicros:fc()?.cumulative_micros??null,ledgerReceiptCumulativeMicros:_c(),estimatedCumulative:Gr(),lastToolSpend:hc(),expiresAt:z.expiresAt}:null}var kc=R(Br()),Cc=10000n;function $p(e){return e<=0n?0:Number((e+Cc-1n)/Cc)}function Tc(e){return $p((0,kc.fromUsd)(e))}var Wr="Buying credits currently requires local biometric attestation from a macOS Touch ID-capable CLI/MCP process. This device cannot create the required attestation, so no card charge was attempted. Credits are account-level, so you can top up this account from any interactive Touch ID-capable CLI, then use the balance from this remote server. For unattended workloads, scoped API keys with daily caps are also supported.",Ec="Tell the user that buying credits requires a local Touch ID-capable CLI/MCP process today. Credits are account-level: suggest topping up the same account from any interactive Touch ID-capable CLI, then continuing on this remote server. For unattended workloads, scoped API keys with daily caps are also supported. Do not retry buy_credits from this process; it cannot produce the required card-charge attestation.";var Ac=Promise.resolve(),Rc=!1;function es(e){let t=Ac.catch(()=>{}).then(e);return Ac=t.then(()=>{},()=>{}),t}async function qc(e){let t=await To($,Pe,{toolName:e.toolId,userContext:e.userContext}),n=So(e.idempotencyKey);if(!n)throw new Error(`Internal: failed to mint voucher for active session ${t.budgetId}`);let r=await Dp(),s,o,i=async()=>$.shortcutWithSession(e.toolId,n,e.toolParams,e.timeoutMs,e.userContext,e.metaTool);try{try{({data:s,voucherReceiptHeader:o}=await i())}catch(u){if(u instanceof It){let d=Math.min(Math.max(u.retryAfterSecs,0),5)*1e3;m.warn("mcp-session:lock-contended-retrying",{tool:e.toolId,retryAfterSecs:u.retryAfterSecs}),await new Promise(g=>setTimeout(g,d)),{data:s,voucherReceiptHeader:o}=await i()}else throw u}}catch(u){if(u instanceof en){if(m.warn("mcp-session:server-invalidated-budget",{code:u.code,budgetId:u.budgetId??t.budgetId,tool:e.toolId}),await zr($),process.env.VISA_REQUIRE_EXPLICIT_SESSION==="true")throw new Error(`Your session was closed by another process (${u.code}). Restart MCP or run start_session again.`);return Rc||(Rc=!0,console.error(`[visa-cli] Your session was closed by another process; reopened automatically as pay-as-you-go.
|
|
106
|
+
To require an explicit session approval instead, set VISA_REQUIRE_EXPLICIT_SESSION=true.`)),m.info("mcp-session:falling-back-to-payg",{code:u.code,tool:e.toolId}),Vc(e)}throw u instanceof It?(m.warn("mcp-session:lock-contended-give-up",{tool:e.toolId}),new Error("Another paid call is currently in progress on this session. Wait a moment and try again.")):u}let a=wo(o)??(n?xo(n):null);if(Co(s?.receipt_v2),await vc(e.estimatedAmountCents),gc({toolName:e.metaTool??e.toolId,resolvedToolId:e.toolId,estimatedAmountCents:e.estimatedAmountCents,voucher:n,receipt:a}),Bc(s))return s;let l=await Fc();if(e.idempotencyKey&&Hc(s,l,e.idempotencyKey))return s;let c=l?Zr(l):null;return Kc(s,r,c)}function Be(e){return{success:!1,error:e.message,error_code:"INSUFFICIENT_BALANCE",balanceCents:e.balanceCents,suggestedTool:"buy_credits"}}function Ro(e){if(e===null||typeof e!="object"){let n=JSON.stringify(e);return n===void 0?String(e):n}return Array.isArray(e)?`[${e.map(Ro).join(",")}]`:`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${JSON.stringify(n)}:${Ro(r)}`).join(",")}}`}function Ip(e,t,n,r){let s=oe.createHash("sha256").update(`${n}:${Ro(r)}`).digest("hex").slice(0,24);return`batch:${e}:${t}:${s}`}function Pp(e,t){return`${e}:${t}`}function Mp(e){if(e==null)return;let t=String(e);if(t.length!==0)return t.startsWith("ledger_")?t:/^\d+$/.test(t)?`ledger_${t}`:t}function $c(e,t,n){let r=n?.amountMicros??n?.amount_micros??n?.charged_micros??n?.receipt_v2?.charged_micros??n?.receipt_v2?.actual_micros,s=nt(r),o=s!==null?s.toString():void 0,i=n?.transaction_id??n?.transactionId??n?.receipt_v2?.transaction_id,a=Mp(n?.ledger_id??n?.ledgerId??n?.receipt_v2?.ledger_id),l=i!=null?String(i):a;return{batch_id:e,item_id:Pp(e,t),index:t,...l!==void 0?{transaction_id:l}:{},...a!==void 0?{ledger_id:a}:{},...o?{amountMicros:o,amount_micros:o,cost_micros:o}:{}}}async function Vc(e){let t=Math.max(1,Math.ceil(e.estimatedAmountCents)),n=await $.getBalance();if(!n.success)throw new Error(`Could not read balance: ${n.error||"unknown error"}`);if(n.balanceCents<t)throw new le(n.balanceCents,t);let r=t,s=Zr(n),o=`spend up to $${(e.estimatedAmountCents/100).toFixed(2)} on ${e.toolId} (session cap $${(r/100).toFixed(2)})`,i=await Pe("session_create",r,"Visa CLI Session",o,e.userContext),a=await $.createSessionBudget({total_cents:r,session_kind:"one_shot",...i?{attestation:i}:{}});if(!a.success||!a.budget)throw new Error(`Failed to open on-demand session: ${a.error||"unknown error"}`);let l=a.budget.id;tt(l),Kn(a.budget.totalCents),m.info("on-demand-session:opened",{budgetId:l,capCents:a.budget.totalCents,tool:e.toolId});try{let c=So(e.idempotencyKey);if(!c)throw new Error(`Internal: mintVoucher returned null after on-demand session-open ${l}`);let{data:u,voucherReceiptHeader:d}=await $.shortcutWithSession(e.toolId,c,e.toolParams,e.timeoutMs,e.userContext,e.metaTool);if(wo(d)||xo(c),Co(u?.receipt_v2),Bc(u))return u;let g=await Fc();if(e.idempotencyKey&&Hc(u,g,e.idempotencyKey))return u;let f=g?Zr(g):null;return Kc(u,s,f)}finally{try{await $.closeSession(l)}catch(c){m.warn("on-demand-session:close-failed",{budgetId:l,error:c?.message||String(c)})}tt(null),m.info("on-demand-session:closed",{budgetId:l,tool:e.toolId})}}async function Ct(e){return es(async()=>wt()?qc(e):Vc(e))}function Io(){return we()}var $=new pe(()=>D.getSessionToken());function nt(e){if(typeof e!="string"||!/^-?\d+$/.test(e))return null;try{return BigInt(e)}catch{return null}}function Zr(e){return nt(e.balanceMicros)??BigInt(e.balanceCents)*10000n}function Op(e){if(e<0n&&(e=0n),e>=1000000n){let r=(e+5000n)/10000n,s=r/100n,o=r%100n;return`$${s.toString()}.${o.toString().padStart(2,"0")}`}let t=e%1000000n;return t===0n?"$0.00":`$0.${t.toString().padStart(6,"0").replace(/0+$/,"")}`}function Np(e){let t=nt(e.ledgerReceiptCumulativeMicros);if(t!==null)return{micros:t,source:"ledgerReceiptCumulativeMicros"};let n=nt(e.lastReceiptCumulativeMicros);if(n!==null)return{micros:n,source:"lastReceiptCumulativeMicros"};let r=nt(e.lastToolSpend?.receiptCumulativeMicros);return r!==null?{micros:r,source:"lastToolSpend.receiptCumulativeMicros"}:{micros:BigInt(Math.max(0,e.estimatedCumulative))*10000n,source:"estimatedCumulativeCents"}}function Jr(e,t="INVALID_TOOL_PARAMS"){return{success:!1,error_code:t,code:t,error:e,message:e}}function Lp(e){return{success:!1,error_code:"TOOL_EXECUTION_FAILED",code:"TOOL_EXECUTION_FAILED",error:e.message||"Tool execution failed.",message:e.message||"Tool execution failed.",tool_id:e.toolId,surface:e.surface,merchantName:e.merchantName,amount:e.amount,payment_finalized:!1,charged:!1}}async function Dp(){try{let e=await $.getBalance();return e.success?Zr(e):null}catch{return null}}async function Fc(){try{let e=await $.getBalance();return e.success?e:null}catch{return null}}function Bc(e){if(!e||e.success===!1)return!1;let t=nt(e.receipt_v2?.charged_micros??e.receipt_v2?.actual_micros),n=nt(e.amountMicros??e.amount_micros??e.charged_micros),r=t??n;if(r===null||r<=0n)return!1;let s=r.toString();return e.amountMicros??=s,e.amount_micros??=s,e.charged_micros??=s,(typeof e.amount!="number"||e.amount<=0)&&(e.amount=Number(r)/1e6),!0}function Hc(e,t,n){if(!e||e.success===!1||!t||!Array.isArray(t.ledger))return!1;let r=t.ledger.find(a=>a.idempotencyKey===n);if(!r)return!1;let s=nt(r.deltaMicros)??BigInt(r.deltaCents)*10000n,o=s<0n?-s:s;if(o<=0n)return!1;let i=o.toString();return e.amountMicros??=i,e.amount_micros??=i,e.charged_micros??=i,(typeof e.amount!="number"||e.amount<=0)&&(e.amount=Number(o)/1e6),!0}function Kc(e,t,n){if(!e||e.success===!1||t===null||n===null)return e;let r=t-n;if(r<=0n)return e;let s=r.toString();return e.amountMicros??=s,e.amount_micros??=s,(typeof e.amount!="number"||e.amount<=0)&&(e.amount=Number(r)/1e6),e}var Up="2.0.0",ev=["","","You're ready to go! Try:","","Core:",'\u2022 "Show my account status" \u2192 get_status','\u2022 "List my enrolled cards" \u2192 get_cards','\u2022 "Show my paid tool use history" \u2192 transaction_history','\u2022 "Set my daily limit to $50" \u2192 update_spending_controls','\u2022 "Generate 3 variations in parallel" \u2192 batch',"","Category tools:",'\u2022 "Generate an image of a sunset over Tokyo" \u2192 generate_image','\u2022 "Make a 4-second video of a penguin juggling" \u2192 generate_video','\u2022 "Make a song about coding late at night" \u2192 generate_music','\u2022 "Create a sound effect for a checkout chime" \u2192 generate_audio','\u2022 "Create a 3D asset from this product sketch" \u2192 generate_3d','\u2022 "Upscale this product image" \u2192 upscale_image','\u2022 "Transcribe this meeting recording" \u2192 transcribe_audio','\u2022 "Run a reasoning model on this prompt" \u2192 run_llm',"","Tool catalog:",'\u2022 "Find an image upscaler" \u2192 discover_tools','\u2022 "Run fal-aura-sr on this URL" \u2192 execute_tool'].join(`
|
|
107
|
+
`);function Te(e){if(!e||typeof e!="string"||Xi())return;let t;try{t=new URL(e)}catch{return}if(t.protocol!=="https:"&&t.protocol!=="http:")return;let n=t.toString(),r=ws();if(r.headless){m.info(`Browser auto-open skipped (${r.reason}). URL: ${n}`);return}m.info(`Browser auto-open disabled for security. Open manually: ${n}`)}async function _e(e){return _n($,e,Xc)}var Gc="get_cards",zc="set_default_card";function jp(e,t=60){return`The processor returned a transient decline (code ${e??"unknown"}). This is not a permanent failure \u2014 it usually clears within ~${t} seconds and is most often triggered by rapid successive charges on the same card. Tell the user the call was temporarily declined and that you will retry shortly, then wait at least ${t} seconds before retrying the SAME call exactly once. Do not retry more than once. Do not assume the user has run out of funds. IMPORTANT: If the retry also fails, do NOT retry again \u2014 instead tell the user their default card may be temporarily locked by the processor and suggest switching to a different card. They can run '${Gc}' to see enrolled cards and '${zc}' to switch, then retry the original request.`}function qp(e,t){return`The processor returned a non-retryable decline (code ${e??"unknown"}). Stop the current task and tell the user their card was declined for ${t||"the merchant"}. Suggest they check their card status or available balance. If they want to try a different default card, they can run '${Gc}' to see enrolled cards and '${zc}' to switch. Do not retry automatically.`}function Ie(e,t){let n=e.retryable?jp(e.code,e.retryAfter):qp(e.code,t.merchantName);return{success:!1,declined:!0,retryable:e.retryable,code:e.code,reason:e.reason,payment_error_class:e.paymentErrorClass,correlation_id:e.correlationId,transactionId:e.transactionId,retryAfter:e.retryAfter,merchantName:t.merchantName,amount:t.amount,message:e.message,agent_guidance:n}}var bn=null,Vp=3e4;function Wc(){bn=null}var xt=class extends Error{constructor(n){super(`${Xr()} attestation is required for this action, but it is not available in this MCP process. `+Po());this.context=n;this.name="AttestationUnavailableError"}context;code="BIOMETRIC_UNAVAILABLE"};function ts(e,t){return{success:!1,error:e.code,message:e.message,action:t,agent_guidance:`Biometric attestation is required for ${t}, but this MCP process cannot create a local attestation. `+Po()+" Do not retry this MCP tool until the user has completed the interactive step or changed their biometric policy."}}function Fp(){return{success:!1,error:"BIOMETRIC_UNAVAILABLE",error_code:"BIOMETRIC_UNAVAILABLE",action:"buy_credits",message:Wr,agent_guidance:Ec}}function Xr(){return process.platform==="darwin"?"Touch ID":"local biometric"}function Po(){return process.platform==="darwin"?"Run the action from an interactive terminal with Touch ID access, or use reset with confirm:true to clear stale server biometric state through GitHub re-authentication.":"This platform cannot create Visa CLI Touch ID attestations. Use reset with confirm:true to clear stale server biometric state through GitHub re-authentication."}function ns(e){return typeof e.hasAnyAttestationKey=="boolean"?e.hasAnyAttestationKey:typeof e.hasAttestationKey=="boolean"?e.hasAttestationKey:!0}async function Bp(e){let t=Date.now();if(bn&&bn.expiresAt>t)return{required:bn.required,hasRegisteredKey:bn.hasRegisteredKey};try{let n=await $.getStatus(e),r=n.attestationRequired!==!1,s=ns(n);return bn={required:r,hasRegisteredKey:s,expiresAt:t+Vp},{required:r,hasRegisteredKey:s}}catch{return{required:!0,hasRegisteredKey:!0}}}async function Pe(e,t,n,r,s,o){if(!o?.forceRequired){let i=await Bp(s);if(!i.required){m.info("attestation:skipped-by-server-policy",{context:e});return}if(!i.hasRegisteredKey){m.info("attestation:skipped-no-registered-key",{context:e});return}}if(!Z())throw m.warn("attestation:unavailable",{context:e}),new xt(e);m.info("attestation:attempt",{context:e,amount:t,merchant:n});try{let{nonce:i}=await $.getAttestationChallenge(),a=Buffer.from(JSON.stringify({nonce:i,amount:t,merchant:n,context:e})).toString("base64");m.info("touchid:prompt",{context:e,amount:t,merchant:n});let l=await mn(a,r);return m.info("attestation:success",{context:e,amount:t,merchant:n}),{signature:l,nonce:i,amount:t,merchant:n}}catch(i){throw m.error("attestation:failure",{context:e,amount:t,merchant:n,error:i.message}),i}}var Ic="[dry-run] https://placeholder.visa-cli.dev/image.png",Hp=new Set(["generate_image_card","generate_image_fast_card","generate_image_schnell_card","generate_image_recraft_card","generate_image_ideogram_card","edit_image_seed_card","fal-flux-pro-ultra","fal-flux-pro","fal-flux-dev","fal-flux-schnell","fal-ideogram-v2","fal-ideogram-v2-turbo","fal-recraft-v3","fal-fast-sdxl"]),Kp=new Set(["generate_video_tempo_card","generate_video_kling_card","generate_video_wan_card","generate_video_minimax_card","fal-kling-video","fal-wan-video","fal-kling-i2v","fal-minimax-video"]);function Gp(e,t){return t==="run_llm"||e.startsWith("or-")?"llm":t==="generate_image"||Hp.has(e)?"image":t==="generate_video"||Kp.has(e)?"video":null}function zp(e){return(typeof e.prompt=="string"?e.prompt:"").slice(0,100)}function Wp(e){return e==="llm"?"OpenRouter":"fal.ai"}function Sn(e,t,n,r){let s={success:!0,transactionId:`dry-run:${r??t}`,amount:0,rail:"dry_run",merchantName:Wp(e),dry_run:!0,metadata:{dry_run:!0}};if(e==="llm"){let i=`[dry-run] echo: ${zp(n)}`;return{...s,content:i,data:{content:i,model:t,dry_run:!0}}}return{...s,urls:[Ic],data:{[e==="video"?"videoUrl":"imageUrl"]:Ic,metadata:{dry_run:!0}}}}async function Eo(e){let t=e.mode??"mock",n=t==="preflight"?"/v1/telemetry/preflight":"/v1/telemetry/dry-run",r=t==="preflight"?"preflight":null;try{await $.emitTelemetry([{id:oe.randomUUID(),timestamp:new Date().toISOString(),tool_name:e.toolName,user_prompt:e.userContext??"",tool_params:JSON.stringify(e.toolParams),result_success:!0,result_error:null,result_json:JSON.stringify(e.result),payment_rail:r,payment_amount:0,payment_currency:"USD",merchant_name:e.result.merchantName,transaction_id:e.result.transactionId,tx_hash:null,protocol:null,http_status:200,duration_ms:Math.max(0,Date.now()-e.startedAt),source:"cli",event_kind:"mcp_tool",endpoint:n,resolved_model:e.resolvedModel,session_budget_id:null}])}catch(s){m.warn("dry_run:telemetry_failed",{tool:e.toolName,error:s?.message||String(s),mode:t})}}var Jp="https://openrouter.ai/api/v1/chat/completions",Yp="openrouter/free",Zp=50,Xp=15e3;function Qp(e){let t=[e.prompt,e.user_prompt,e.input,e.text];for(let n of t)if(typeof n=="string"&&n.trim().length>0)return n;return"preflight"}async function ef(e,t,n){let r=process.env.OPENROUTER_API_KEY;if(!r)return m.warn("preflight:no_openrouter_key_falling_back_to_mock",{tool:e}),{result:Sn("llm",e,t,n),degraded:!0,resolvedModel:null};let s=Qp(t),o;try{o=await Rt(Jp,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json","HTTP-Referer":"https://visacli.sh/preflight","X-Title":"Visa CLI Preflight"},body:JSON.stringify({model:Yp,messages:[{role:"user",content:s}],max_tokens:Zp}),timeoutMs:Xp})}catch(u){return m.warn("preflight:openrouter_network_error_falling_back_to_mock",{tool:e,error:u?.message||String(u)}),{result:Sn("llm",e,t,n),degraded:!0,resolvedModel:null}}if(!o.ok){let u=await o.text().catch(()=>"");return m.warn("preflight:openrouter_http_error_falling_back_to_mock",{tool:e,status:o.status,bodyExcerpt:u.slice(0,200)}),{result:Sn("llm",e,t,n),degraded:!0,resolvedModel:null}}let i;try{i=await o.json()}catch(u){return m.warn("preflight:openrouter_invalid_json_falling_back_to_mock",{tool:e,error:u?.message||String(u)}),{result:Sn("llm",e,t,n),degraded:!0,resolvedModel:null}}let a=typeof i?.choices?.[0]?.message?.content=="string"?i.choices[0].message.content:"",l=typeof i?.model=="string"?i.model:null;return{result:{success:!0,transactionId:`preflight:${n??e}`,amount:0,rail:"preflight",merchantName:"OpenRouter",dry_run:!0,preflight:!0,metadata:{dry_run:!0,preflight:!0,model_used:l},content:a,data:{content:a,model:l??e,dry_run:!0,preflight:!0}},degraded:!1,resolvedModel:l}}async function rs(e,t,n,r){let s=ro();if(!s)return null;let o=Gp(e,r);if(!o)return null;let i=Date.now();if(s==="mock"){let c=Sn(o,e,t,r);return await Eo({toolName:r??e,resolvedModel:r&&r!==e?e:null,toolParams:t,result:c,userContext:n,startedAt:i,mode:"mock"}),m.info("dry_run:payment_intercepted",{tool:e,metaTool:r,kind:o,mode:s}),c}if(o!=="llm"){m.warn("preflight:not_supported_for_kind_falling_back_to_mock",{tool:e,kind:o});let c=Sn(o,e,t,r);return await Eo({toolName:r??e,resolvedModel:r&&r!==e?e:null,toolParams:t,result:c,userContext:n,startedAt:i,mode:"preflight"}),c}let{result:a,resolvedModel:l}=await ef(e,t,r);return await Eo({toolName:r??e,resolvedModel:l??(r&&r!==e?e:null),toolParams:t,result:a,userContext:n,startedAt:i,mode:"preflight"}),m.info("dry_run:payment_intercepted",{tool:e,metaTool:r,kind:o,mode:s}),a}async function He(e,t,n){let r=await $.paymentPreview({tool:e,url:t},n);if(!r||!r.merchantName||r.amount===void 0||r.amount===null||r.amount<0)throw new Error("Could not determine payment amount and merchant. Try again.");if(!Number.isFinite(r.amount)||r.amount<0||r.amount>999999)throw new Error(`Invalid payment amount: ${r.amount}. Payment rejected for safety.`);return r}function rt(e){return Tc(e.amount)}function tf(e){if(e.pricingMode==="max-cap"){let t=typeof e.estimatedAmount=="number"&&e.estimatedAmount>0?` (estimated $${e.estimatedAmount.toFixed(2)})`:"";return`pay up to $${e.amount.toFixed(2)} to ${e.merchantName}${t}`}return`pay $${e.amount.toFixed(2)} to ${e.merchantName}`}function nf(){return Qr.join($o.homedir(),".visa-mcp","allium-results")}var tv=16*1024,nv=50*1024*1024;function rf(){let e=nf();try{if(!$e.existsSync(e))return{file_count:0,size_bytes:0,path:e};let t=$e.readdirSync(e),n=0,r=0;for(let s of t)try{let o=$e.statSync(Qr.join(e,s));o.isFile()&&(n+=o.size,r++)}catch{}return{file_count:r,size_bytes:n,path:e}}catch(t){return m.warn("allium:disk_usage_error",{error:t.message}),{file_count:0,size_bytes:0,path:e}}}var Pc=3600*1e3,Ao=0;function sf(e){let t=e instanceof Error?e.message:String(e);return/Unexpected response from \/v1\/feed/.test(t)}async function Gn(e){if(!Qi()&&!(Date.now()<Ao))try{if(!await D.getSessionToken())return;await $.feedSubmit({prompt:e.prompt,tool:e.tool,media_url:e.mediaUrl,media_type:e.mediaType,cost:e.cost,transaction_id:e.transactionId,auto:!0,...e.userContext&&{user_context:e.userContext}}),m.info("feed:submitted",{tool:e.tool,mediaType:e.mediaType,transactionId:e.transactionId})}catch(t){if(sf(t)){let n=Ao===0;Ao=Date.now()+Pc,n&&m.debug?.("feed:endpoint-unavailable",{tool:e.tool,backoff_ms:Pc});return}m.warn("feed:submit-failed",{tool:e.tool,error:t?.message||String(t)})}}async function of(e,t){if(!e.url||!e.url.trim())throw new Error("A URL is required for payments. Provide the merchant payment endpoint.");let n=await He(void 0,e.url,t),r=Vr(e.url);m.info("payment:attempt",{tool:"pay",amount:n.amount,merchant:n.merchantName,url:e.url});try{return await _e(async()=>{let s=await Pe(e.url||"pay",n.amount,r,tf({...n,merchantName:r})),o=await $.pay({url:e.url||"",merchantName:e.merchantName||"Unknown",description:e.description||"",method:e.method,body:e.body,attestation:s,idempotencyKey:oe.randomUUID()},t);return o.success?(m.info("payment:success",{tool:"pay",amount:n.amount,merchant:n.merchantName,rail:o.receipt?.rail}),o.receipt&&Kf(o.receipt)):m.warn("payment:declined",{tool:"pay",amount:n.amount,merchant:n.merchantName,message:o.message}),o})}catch(s){if(s instanceof re)return m.warn("payment:declined",{tool:"pay",amount:n.amount,merchant:n.merchantName,code:s.code,retryable:s.retryable}),Ie(s,n);throw m.error("payment:failure",{tool:"pay",amount:n.amount,merchant:n.merchantName,error:s.message}),s}}async function af(e,t){let n=(e.state||"").trim().toUpperCase(),r=(e.county||"").trim(),s=(e.start_date||"").trim(),o=(e.end_date||s).trim();if(!/^[A-Z]{2}$/.test(n))throw new Error('state must be a 2-letter US state code (e.g. "VA").');if(!r)throw new Error("county is required.");if(!/^\d{4}-\d{2}$/.test(s))throw new Error('start_date must be YYYY-MM (e.g. "2025-08").');if(o&&!/^\d{4}-\d{2}$/.test(o))throw new Error("end_date must be YYYY-MM.");let i="Visa SMI",a=.1,l=`Pay $0.10 to ${i} for SMI data (${n} / ${r})`;m.info("payment:attempt",{tool:"get_visa_smi",amount:a,merchant:i});try{return await _e(async()=>{let c=await Pe("get_visa_smi",a,i,l),u=await $.getVisaSmi({state:n,county:r,start_date:s,end_date:o,attestation:c,idempotencyKey:oe.randomUUID()},t);return u.success?m.info("payment:success",{tool:"get_visa_smi",merchant:i,charged_cents:u.charged_cents}):m.warn("payment:declined",{tool:"get_visa_smi",merchant:i,message:u.error}),u})}catch(c){if(c instanceof re)return m.warn("payment:declined",{tool:"get_visa_smi",merchant:i,code:c.code,retryable:c.retryable}),Ie(c,{amount:a,merchantName:i,description:"Visa SMI data"});throw m.error("payment:failure",{tool:"get_visa_smi",merchant:i,error:c.message}),c}}async function cf(e,t){if(!e.prompt||!e.prompt.trim())throw new Error("A prompt is required. Provide a description of what you want to generate.");let n=await rs("generate_image_card",e,t);if(n)return n;let r=await He("generate_image_card",void 0,t),s=oe.randomUUID();m.info("payment:attempt",{tool:"generate_image_card",amount:r.amount,merchant:r.merchantName});try{return await _e(async()=>{let o;try{o=await Ct({toolId:"generate_image_card",toolParams:e,estimatedAmountCents:rt(r),userContext:t,timeoutMs:12e4,idempotencyKey:s})}catch(i){if(i instanceof le)return Be(i);throw i}return m.info("payment:success",{tool:"generate_image_card",amount:r.amount,merchant:r.merchantName,mode:"session"}),o.urls?.length?(o.urls.forEach(i=>Te(i)),Gn({prompt:e.prompt,tool:"generate_image_card",mediaUrl:o.urls[0],mediaType:"image",cost:o.amount??r.amount,transactionId:o.transactionId,userContext:t})):m.warn("generation:no-urls",{tool:"generate_image_card",resultKeys:Object.keys(o||{})}),o})}catch(o){if(o instanceof re)return m.warn("payment:declined",{tool:"generate_image_card",amount:r.amount,merchant:r.merchantName,code:o.code,retryable:o.retryable}),Ie(o,r);throw m.error("payment:failure",{tool:"generate_image_card",amount:r.amount,merchant:r.merchantName,error:o.message}),o}}async function lf(e,t){if(!e.prompt||!e.prompt.trim())throw new Error("A prompt is required. Provide a description of what you want to generate.");let n=await rs("generate_image_fast_card",e,t);if(n)return n;let r=await He("generate_image_fast_card",void 0,t),s=oe.randomUUID();m.info("payment:attempt",{tool:"generate_image_fast_card",amount:r.amount,merchant:r.merchantName});try{return await _e(async()=>{let o;try{o=await Ct({toolId:"generate_image_fast_card",toolParams:e,estimatedAmountCents:rt(r),userContext:t,timeoutMs:6e4,idempotencyKey:s})}catch(i){if(i instanceof le)return Be(i);throw i}return m.info("payment:success",{tool:"generate_image_fast_card",amount:r.amount,merchant:r.merchantName,mode:"session"}),o.urls?.length?(o.urls.forEach(i=>Te(i)),Gn({prompt:e.prompt,tool:"generate_image_fast_card",mediaUrl:o.urls[0],mediaType:"image",cost:o.amount??r.amount,transactionId:o.transactionId,userContext:t})):m.warn("generation:no-urls",{tool:"generate_image_fast_card",resultKeys:Object.keys(o||{})}),o})}catch(o){if(o instanceof re)return m.warn("payment:declined",{tool:"generate_image_fast_card",amount:r.amount,merchant:r.merchantName,code:o.code,retryable:o.retryable}),Ie(o,r);throw m.error("payment:failure",{tool:"generate_image_fast_card",amount:r.amount,merchant:r.merchantName,error:o.message}),o}}async function uf(e,t){if(!e.prompt||!e.prompt.trim())throw new Error("A prompt is required. Provide a description of what you want to generate.");let n=await rs("generate_video_tempo_card",e,t);if(n)return n;let r=await He("generate_video_tempo_card",void 0,t),s=oe.randomUUID();m.info("payment:attempt",{tool:"generate_video_tempo_card",amount:r.amount,merchant:r.merchantName});try{return await _e(async()=>{let o;try{o=await Ct({toolId:"generate_video_tempo_card",toolParams:e,estimatedAmountCents:rt(r),userContext:t,timeoutMs:12e4,idempotencyKey:s})}catch(i){if(i instanceof le)return Be(i);throw i}return m.info("payment:success",{tool:"generate_video_tempo_card",amount:r.amount,merchant:r.merchantName,mode:"session"}),o.urls?.length?(o.urls.forEach(i=>Te(i)),Gn({prompt:e.prompt,tool:"generate_video_tempo_card",mediaUrl:o.urls[0],mediaType:"video",cost:o.amount??r.amount,transactionId:o.transactionId,userContext:t})):m.warn("generation:no-urls",{tool:"generate_video_tempo_card",resultKeys:Object.keys(o||{})}),o})}catch(o){if(o instanceof re)return m.warn("payment:declined",{tool:"generate_video_tempo_card",amount:r.amount,merchant:r.merchantName,code:o.code,retryable:o.retryable}),Ie(o,r);throw m.error("payment:failure",{tool:"generate_video_tempo_card",amount:r.amount,merchant:r.merchantName,error:o.message}),o}}async function df(e,t){if(!e.prompt||!e.prompt.trim())throw new Error("A prompt is required. Provide a description of what you want to generate.");let n=await He("generate_music_tempo_card",void 0,t),r=oe.randomUUID();m.info("payment:attempt",{tool:"generate_music_tempo_card",amount:n.amount,merchant:n.merchantName});try{return await _e(async()=>{let s;try{s=await Ct({toolId:"generate_music_tempo_card",toolParams:e,estimatedAmountCents:rt(n),userContext:t,timeoutMs:36e4,idempotencyKey:r})}catch(o){if(o instanceof le)return Be(o);throw o}return m.info("payment:success",{tool:"generate_music_tempo_card",amount:n.amount,merchant:n.merchantName,mode:"session"}),s.urls?.length&&s.status!=="processing"?(s.urls.forEach(o=>Te(o)),Gn({prompt:e.prompt,tool:"generate_music_tempo_card",mediaUrl:s.urls[0],mediaType:"audio",cost:s.amount??n.amount,transactionId:s.transactionId,userContext:t})):s.urls?.length&&s.status==="processing"?(s._preliminary_urls=s.urls,delete s.urls,m.info("generation:processing",{tool:"generate_music_tempo_card",note:"URLs withheld until status is completed"})):m.warn("generation:no-urls",{tool:"generate_music_tempo_card",resultKeys:Object.keys(s||{})}),s})}catch(s){if(s instanceof re)return m.warn("payment:declined",{tool:"generate_music_tempo_card",amount:n.amount,merchant:n.merchantName,code:s.code,retryable:s.retryable}),Ie(s,n);throw m.error("payment:failure",{tool:"generate_music_tempo_card",amount:n.amount,merchant:n.merchantName,error:s.message}),s}}async function mf(e,t){let n=await He("check_music_status_tempo_card",void 0,t),r=oe.randomUUID();m.info("payment:attempt",{tool:"check_music_status_tempo_card",amount:n.amount,merchant:n.merchantName});try{return await _e(async()=>{let s;try{s=await Ct({toolId:"check_music_status_tempo_card",toolParams:e,estimatedAmountCents:rt(n),userContext:t,timeoutMs:3e4,idempotencyKey:r})}catch(o){if(o instanceof le)return Be(o);throw o}return m.info("payment:success",{tool:"check_music_status_tempo_card",amount:n.amount,merchant:n.merchantName,mode:"session"}),s.urls?.length&&s.urls.forEach(o=>Te(o)),s})}catch(s){if(s instanceof re)return m.warn("payment:declined",{tool:"check_music_status_tempo_card",amount:n.amount,merchant:n.merchantName,code:s.code,retryable:s.retryable}),Ie(s,n);throw m.error("payment:failure",{tool:"check_music_status_tempo_card",amount:n.amount,merchant:n.merchantName,error:s.message}),s}}async function pf(e,t){if(!e.chain||!e.chain.trim())throw new Error('A chain is required (e.g., "ethereum", "solana").');if(!e.token_address||!e.token_address.trim())throw new Error("A token address is required. Provide the contract address for the token.");let n=await He("query_onchain_prices",void 0,t),r=oe.randomUUID();m.info("payment:attempt",{tool:"query_onchain_prices",amount:n.amount,merchant:n.merchantName});try{return await _e(async()=>{let s;try{s=await Ct({toolId:"query_onchain_prices",toolParams:e,estimatedAmountCents:rt(n),userContext:t,timeoutMs:3e4,idempotencyKey:r})}catch(o){if(o instanceof le)return Be(o);throw o}if(m.info("payment:success",{tool:"query_onchain_prices",amount:n.amount,merchant:n.merchantName,mode:"session"}),Array.isArray(s?.data))s.data=s.data.map(o=>{if("mint"in o&&!("address"in o)){let{mint:i,...a}=o;return{address:i,...a}}return o});else if(s&&"mint"in s&&!("address"in s)){let{mint:o,...i}=s;return{address:o,...i}}return s})}catch(s){if(s instanceof re)return m.warn("payment:declined",{tool:"query_onchain_prices",amount:n.amount,merchant:n.merchantName,code:s.code,retryable:s.retryable}),Ie(s,n);throw m.error("payment:failure",{tool:"query_onchain_prices",amount:n.amount,merchant:n.merchantName,error:s.message}),s}}var ff=["generate_music_tempo_card"],Mc=10,Oc=5,Nc=new Map;function Lc(e){let t=Nc.get(e);if(t!==void 0)return t;let r=Un(e)?.isAsync===!0||ff.includes(e);return Nc.set(e,r),r}var gf=36e4,hf=18e4,yf=15e3,_f=12e4,vf=2e3;function Dc(e,t){return{success:!1,error_code:e,code:e,error:t,message:t}}async function bf(e,t){let n;if(e.requests?.some(T=>T.tool||T.tool_id)&&e.requests)n=e.requests.map(T=>{let C=T.tool||T.tool_id||e.tool;if(!C)throw new Error("Each request must specify tool or tool_id, or set tool at the top level.");let V=no(C,T.tier||e.tier,T.prompt??t),{tool:G,tool_id:F,tier:it,params:te,...ue}=T,at=te&&typeof te=="object"?{...te,...ue}:ue;return{resolvedTool:V,params:at}});else if(e.tool){let T=no(e.tool,e.tier,e.params?.prompt??t);n=(e.requests||(e.count&&e.params?Array.from({length:e.count},()=>({...e.params})):[])).map(V=>({resolvedTool:T,params:V}))}else return Dc("BATCH_MISSING_TOOL","Batch requires a top-level tool or per-request tool/tool_id.");if(n.length===0)return Dc("BATCH_EMPTY","Batch requires at least one item.");if(n.length>Mc)return{success:!1,error_code:"BATCH_TOO_LARGE",error:`Batch limited to ${Mc} items. Please split into smaller batches.`};if([...new Set(n.map(T=>T.resolvedTool))].some(Lc)&&n.length>Oc)return{success:!1,error_code:"BATCH_TOO_LARGE",error:`Async batch limited to ${Oc} items. Please use multiple batches for more.`};let i=[...new Set(n.map(T=>T.resolvedTool))],a=i.length===1,l={};for(let T of i)l[T]=await He(T,void 0,t);let c=0;for(let T of n)c+=l[T.resolvedTool].amount;let u=[...new Set(Object.values(l).map(T=>T.merchantName))].join(", "),d=a?i[0]:"mixed";m.info("payment:attempt",{tool:"batch",batchTool:d,count:n.length,totalAmount:c,merchant:u,heterogeneous:!a});let g=n.some(T=>Lc(T.resolvedTool)),f=n.some(T=>T.resolvedTool.startsWith("or-")||T.resolvedTool==="run_llm"||T.resolvedTool==="execute_tool"),x=g?gf:f?hf+n.length*yf:_f+n.length*vf,y=oe.randomUUID(),A=[],N=0,L=0n;return es(async()=>{let T=!wt();if(T)try{let C=Math.max(1,Math.ceil(c*100));await To($,Pe,{toolName:"batch",userContext:t,sessionKind:"one_shot",minRequiredCents:C,capCentsOverride:C})}catch(C){return C instanceof le?Be(C):(m.warn("payment:batch-prewarm-failed",{batchTool:d,count:n.length,error:C?.message||String(C)}),{success:!1,error_code:"BATCH_AUTH_FAILED",error:C?.message||"Failed to authenticate batch session",tool:d,count:n.length,failedCount:n.length,results:[]})}try{for(let te=0;te<n.length;te+=1){let ue=n[te],at=l[ue.resolvedTool];try{let ne=await qc({toolId:ue.resolvedTool,toolParams:ue.params,estimatedAmountCents:rt(at),userContext:t,metaTool:"batch",timeoutMs:x,idempotencyKey:Ip(y,te,ue.resolvedTool,ue.params)});if(A.push({success:ne?.success!==!1,tool:ue.resolvedTool,...ne,...$c(y,te,ne)}),ne?.success!==!1){let Tn=nt(ne?.amountMicros??ne?.amount_micros),Zo=typeof ne?.amount=="number"?ne.amount:at.amount;Tn!==null&&Tn>0n?L+=Tn:L+=BigInt(Math.round(Zo*1e6)),N+=Zo}ne?.urls&&ne.urls.forEach(Tn=>Te(Tn))}catch(ne){if(ne instanceof le&&A.length===0)return Be(ne);m.warn("payment:batch-item-failed",{tool:ue.resolvedTool,index:te,error:ne?.message||String(ne)}),A.push({success:!1,tool:ue.resolvedTool,...$c(y,te),error:ne?.message||String(ne)})}}let C=A.filter(te=>te?.success===!1).length,V=A.length-C,G=A.flatMap(te=>Array.isArray(te?.urls)?te.urls:[]),F=L>0n?Number(L)/1e6:Math.round((N+Number.EPSILON)*100)/100,it=V===0?"failure":C===0?"success":"partial";return m.info("payment:success",{tool:"batch",batchTool:d,count:n.length,totalAmount:c,totalCharged:F,merchant:u,successCount:V,failedCount:C,outcome:it,mode:"session",batchId:y}),{success:V>0,outcome:it,batch_id:y,tool:a?i[0]:d,count:n.length,successCount:V,failedCount:C,totalCharged:F,...L>0n?{totalChargedMicros:L.toString(),amountMicros:L.toString(),amount_micros:L.toString()}:{},merchantName:u,results:A,...G.length?{urls:G}:{}}}catch(C){if(C instanceof re)return m.warn("payment:declined",{tool:"batch",batchTool:d,count:n.length,totalAmount:c,merchant:u,code:C.code,retryable:C.retryable}),Ie(C,{amount:c,merchantName:u});throw m.error("payment:failure",{tool:"batch",batchTool:d,count:n.length,totalAmount:c,merchant:u,error:C.message}),C}finally{if(T){let C=await zr($);m.info("batch-session:closed",{budgetId:C.budgetId,closedServerSide:C.closedServerSide})}}})}function Sf(){let e=!1,t;try{let r=Qr.join($o.homedir(),".claude","settings.json");if($e.existsSync(r)){let s=JSON.parse($e.readFileSync(r,"utf-8")),o=typeof s.statusLine=="object"?s.statusLine.command:"";e=Et(o)}}catch{}let n=Or();return n||(t="visa-cli config shell-hud install"),{statusLine:e,shellHud:n,...t?{shellHudSetup:t}:{}}}async function wf(e){let[t,n]=await Promise.all([$.getStatus(e),$.getBalance().catch(o=>(m.warn("get_status:balance_fetch_failed",{error:o?.message||String(o)}),null))]);typeof t?.dailyRemaining=="number"&&(t.dailyRemaining=Math.round(t.dailyRemaining*100)/100);let r=rf();r.file_count>0&&(t.alliumResultsOnDisk=r),t.hud=Sf(),t.version=Up,Array.isArray(t.cards)&&(t.cards=t.cards.map(o=>({...o,displayName:Mo(o)})),t.cardIdGuidance="cardId values are opaque tool parameters only; refer to cards by brand and last four digits."),n&&n.success&&(t.balanceCents=n.balanceCents,t.amountUsd=n.amountUsd);let s=wt();if(t.sessionMode=!!s,s){let o=Math.max(0,s.totalCents-s.estimatedCumulative);t.activeSession={budgetId:s.budgetId,capCents:s.totalCents,capUsd:s.totalCents/100,lastReceiptCumulativeCents:s.lastReceiptCumulative,estimatedCumulativeCents:s.estimatedCumulative,spentCents:s.estimatedCumulative,spentUsd:s.estimatedCumulative/100,estimatedRemainingCents:o,estimatedRemainingUsd:o/100,...s.lastToolSpend?{lastToolSpend:{toolName:s.lastToolSpend.toolName,resolvedToolId:s.lastToolSpend.resolvedToolId,estimatedAmountCents:s.lastToolSpend.estimatedAmountCents,estimatedAmountUsd:s.lastToolSpend.estimatedAmountCents/100,voucherCumulativeCents:s.lastToolSpend.voucherCumulativeCents,estimatedCumulativeCents:s.lastToolSpend.estimatedCumulativeCents,receiptDeltaCents:s.lastToolSpend.receiptDeltaCents,receiptCumulativeCents:s.lastToolSpend.receiptCumulativeCents,receiptRemainingCents:s.lastToolSpend.receiptRemainingCents,recordedAt:s.lastToolSpend.recordedAt}}:{},expiresAt:s.expiresAt}}return t}function Mo(e){let t=typeof e.brand=="string"&&e.brand.trim().length>0?e.brand.trim():"card",n=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),r=typeof e.last4=="string"&&e.last4.trim().length>0?e.last4.trim():"unknown",s=e.isDefault===!0?" (default)":"";return`${n} ending in ${r}${s}`}async function Jc(e,t){try{let r=((await $.getStatus(t)).cards||[]).find(s=>s?.id===e);if(r)return Mo(r)}catch(n){m.warn("cards:display_name_lookup_failed",{cardId:e,error:n?.message||String(n)})}return"selected card"}async function xf(e){let n=(await $.getStatus(e)).cards||[];return n.length===0?{cards:[],message:"No cards enrolled. Use the add_card tool to add a payment card."}:n.some(s=>!Number.isInteger(s?.id)||s.id<=0)?{success:!1,cards:[],message:"Card action handles are unavailable right now, so remove_card and set_default_card are temporarily disabled."}:{cards:n.map(s=>({...s,displayName:Mo(s)})),message:"Use cardId only as an opaque tool parameter. When speaking to the user, refer to cards by brand and last four digits, not by card id."}}async function Cf(e,t){return await $.getTransactions({limit:e.limit,offset:e.offset},t)}async function kf(e,t){return await $.feedback(e.message,e.transaction_id,t)}var Tf=100;async function Ef(e,t){if(typeof e.confirm!="boolean"||e.confirm!==!0)return Zt("MISSING_CONFIRMATION","Please confirm by setting confirm: true to charge your enrolled card for credits.");if(!e.amount||!Number.isFinite(e.amount)||e.amount<=0)return{success:!1,error:"amount must be a positive number in USD (e.g. 5.00)"};let n=Math.round(e.amount*100);if(n<Tf)return{success:!1,error:"Minimum top-up is $1.00"};let r=oe.randomUUID();m.info("buy_credits:attempt",{amountCents:n});try{return await _e(async()=>{let s=await Pe("balance-topup",e.amount,"Visa CLI Balance",`top up balance with $${e.amount.toFixed(2)}`,t,{forceRequired:!0}),o=await $.topupBalance({amount_cents:n,idempotency_key:r,attestation:s});if(o.success){m.info("buy_credits:success",{amountCents:n,balanceCents:o.balanceCents});let i=((o.balanceCents??0)/100).toFixed(2),a=(n/100).toFixed(2);return{...o,amount:n/100,amountMicros:String(n*1e4),merchantName:"Visa CLI Balance",message:`Added $${a} \u2014 balance is now $${i}`}}return m.warn("buy_credits:failed",{amountCents:n,error:o.error}),o})}catch(s){if(s instanceof xt)return Fp();throw m.error("buy_credits:failure",{amountCents:n,error:s.message}),s}}function Zt(e,t){return{success:!1,error:t,code:e,message:t}}async function Af(e,t){if(typeof e.confirm!="boolean"||e.confirm!==!0)return Zt("MISSING_CONFIRMATION","Please confirm by setting confirm: true to update spending controls.");if(e.maxTransactionAmount!==void 0&&(typeof e.maxTransactionAmount!="number"||!Number.isFinite(e.maxTransactionAmount)||e.maxTransactionAmount<.01||e.maxTransactionAmount>100))return Zt("INVALID_VALUE","maxTransactionAmount must be between $0.01 and $100");if(e.dailyLimit!==void 0&&(typeof e.dailyLimit!="number"||!Number.isFinite(e.dailyLimit)||e.dailyLimit<1||e.dailyLimit>100))return Zt("INVALID_VALUE","dailyLimit must be between $1 and $100");if(e.maxTransactionAmount!==void 0&&e.dailyLimit!==void 0&&e.maxTransactionAmount>e.dailyLimit)return Zt("INVALID_VALUE","maxTransactionAmount cannot exceed dailyLimit");m.info("spending_controls:update",{maxTransactionAmount:e.maxTransactionAmount,dailyLimit:e.dailyLimit});try{return await _e(async()=>{let n=await Pe("spending-controls",0,"","update spending controls"),r=await $.updateSpendingControls({maxTransactionAmount:e.maxTransactionAmount,dailyLimit:e.dailyLimit,confirm:!0,attestation:n},t);return m.info("spending_controls:success",{maxTransactionAmount:e.maxTransactionAmount,dailyLimit:e.dailyLimit}),r})}catch(n){if(m.error("spending_controls:failure",{error:n.message}),n instanceof xt)return ts(n,"update_spending_controls");if(String(n?.message||n).includes("Attestation required"))return Zt("ATTESTATION_REQUIRED","Changing spending controls requires local attestation, even when payment biometric prompts are disabled.");throw n}}async function Rf(e){let t=await qr({api:$,includeDev:!!e.includeDev});return{config:t.entries.map(n=>({key:n.key,value:n.value,source:n.source,hint:n.hint})),statusError:t.statusError}}async function $f(e){if(!e.key||typeof e.key!="string")return{success:!1,error:"key is required. Call config_list first to see available keys."};if(e.value===void 0)return{success:!1,error:"value is required. Use config_unset to remove a setting."};m.info("config:set",{key:e.key});try{let t=vr(e.key,e.value);return m.info("config:set:success",{key:t.key,requiresRestart:t.requiresRestart}),{success:!0,key:t.key,value:t.value,requiresRestart:t.requiresRestart,path:t.path,message:t.requiresRestart?`Saved ${t.key}. Restart Claude Code for the change to take effect.`:`Saved ${t.key}.`}}catch(t){let n=t instanceof ze?"UNKNOWN_KEY":t instanceof We?"SERVER_CONTROLLED":t instanceof mt?"RETIRED_KEY":"INVALID_VALUE";return m.warn("config:set:rejected",{key:e.key,code:n,error:t.message}),{success:!1,error:t.message,code:n,settableKeys:Object.keys(ft).sort()}}}async function If(e){if(!e.key||typeof e.key!="string")return{success:!1,error:"key is required. Call config_list first to see which keys are currently set via settings.json."};m.info("config:unset",{key:e.key});try{let t=br(e.key);return m.info("config:unset:success",{key:t.key,removed:t.removed}),{success:!0,key:t.key,removed:t.removed,requiresRestart:t.requiresRestart,path:t.path,message:t.removed?t.requiresRestart?`Removed ${t.key}. Restart Claude Code for the change to take effect.`:`Removed ${t.key}.`:`${t.key} was not set in settings.json \u2014 nothing to remove.`}}catch(t){let n=t instanceof ze?"UNKNOWN_KEY":t instanceof We?"SERVER_CONTROLLED":t instanceof mt?"RETIRED_KEY":"INVALID_VALUE";return m.warn("config:unset:rejected",{key:e.key,code:n,error:t.message}),{success:!1,error:t.message,code:n,settableKeys:Object.keys(ft).sort()}}}async function Pf(e){let t=await $.getStatus(e),n=t.attestationRequired!==!1,r=ns(t),s=Z(),o=n?r?s?`${Xr()} is REQUIRED for payments.`:`Biometric attestation is required and a key is registered, but ${Xr()} is not available in this process. ${Po()}`:"Biometric attestation is enabled on the account, but no attestation key is registered. Payments on this device proceed without a biometric signature; processor declines such as INVALID_OR_MISSING_CONFIG are card/account configuration issues, not something biometric setup fixes.":"Biometric attestation is NOT required for payments. Payments will proceed without biometric confirmation.";return{required:n,hasAttestationKey:!!t.hasAttestationKey,hasTelegramAttestationKey:!!t.hasTelegramAttestationKey,hasAnyAttestationKey:r,touchIdAvailable:s,platform:process.platform,effectiveRequiredOnThisDevice:n&&r&&s,canDisableFromThisDevice:!n||!r||s,message:o}}async function Mf(e){m.info("biometric:on");let t=await $.setBiometricPreference({required:!0},e);return t.success?(Wc(),{success:!0,required:!0,message:"Touch ID is now REQUIRED for payments."}):{success:!1,error:t.error||"unknown error"}}async function Of(e,t){if(typeof e.confirm!="boolean"||e.confirm!==!0)return Zt("MISSING_CONFIRMATION","Please confirm by setting confirm: true. Disabling Touch ID is a security downgrade \u2014 the user will be prompted for one final Touch ID confirmation before the change takes effect.");m.info("biometric:off");try{return await _e(async()=>{let n=await $.getStatus(t),r;if(ns(n)&&(r=await Pe("biometric-preference",0,"","disable Touch ID requirement"),!r))throw new Error(`${Xr()} confirmation required to disable \u2014 not available on this device.`);let s=await $.setBiometricPreference({required:!1,attestation:r},t);if(!s.success)throw new Error(s.error||"unknown error");return Wc(),{success:!0,required:!1,message:"Touch ID is no longer required for payments."}})}catch(n){if(m.error("biometric:off:failure",{error:n.message}),n instanceof xt)return ts(n,"biometric_off");throw n}}var Uc=3e4,Nf=3e5;async function Yc(e,t,n="login"){let r=oe.randomUUID(),s=`${e}${e.includes("?")?"&":"?"}state=${r}`;return Te(s),Zc(r,t,n)}async function Zc(e,t,n="login"){let r=Date.now()+Nf;for(;Date.now()<r;)try{let o=await fetch(`${Io()}/v1/auth-status`,{method:"POST",headers:{"Content-Type":"application/json","X-Source":"cli"},body:JSON.stringify({state:e,timeout:Uc,...t&&{user_context:t}}),signal:AbortSignal.timeout(Uc+5e3)});if(!o.ok){await dt(o,a=>{m.warn("auth_status:retry_after_http_error",{status:o.status,delayMs:a})});continue}let i=await o.json();if(i.status==="pending")continue;if(i.status==="expired")return{success:!1,message:"Session expired. Please try again."};if(i.status==="error")return{success:!1,message:i.error||"Authentication failed. Please try again."};if(i.status==="complete"){if(n==="attestation-recovery"||i.attestationCleared)return m.info("auth:attestation_recovery_complete",{user:i.user||""}),{success:!0,message:"Server-side biometric state cleared. Run visa-cli setup to register a fresh key before reenabling Touch ID."};let a=i.welcomeBonusCents??0,l=rc(a);if(i.sessionToken){await D.saveSessionToken(i.sessionToken);let u=i.user||"",d=i.last4||"****";return m.info("auth:login_complete",{user:u,last4:d,bonusCents:a}),{success:!0,message:`Signed in as ${u}. Card ending in ${d} enrolled and ready for payments.`,...l||{}}}let c=i.last4||"****";return m.info("auth:card_added",{last4:c,bonusCents:a}),{success:!0,message:`Card ending in ${c} enrolled and ready for payments.`,...l||{}}}}catch{await dt(void 0,o=>{m.warn("auth_status:retry_after_network_error",{delayMs:o})})}return{success:!1,message:n==="enrollment"?"Card enrollment timed out. Please try again.":n==="attestation-recovery"?"Biometric reset timed out. Please try reset again.":"Login timed out. Please try again."}}async function Xc(e){let t=oe.randomUUID(),n;try{n=await $.startAttestationRecovery(t,e)}catch(r){return{success:!1,message:`Could not start biometric reset: ${r?.message||"unknown error"}`}}return!n.success||!n.recoveryUrl?{success:!1,message:n.error||"Could not start biometric reset. Please try again."}:(Te(n.recoveryUrl),Zc(t,e,"attestation-recovery"))}async function Lf(e,t){if(typeof e.confirm!="boolean"||e.confirm!==!0)return{success:!1,message:"Please confirm by setting confirm: true to remove this card."};let n=e.cardId;if(!Number.isInteger(n)||n<=0)return{success:!1,message:"cardId must be a positive integer. Call get_cards to get the opaque cardId for the card you want to remove."};m.info("cards:remove_attempt",{cardId:n});let r=`remove-card:${n}`,s=`remove ${await Jc(n,t)}`;try{return await _e(async()=>{let o=await Pe(r,0,"",s,t,{forceRequired:!0}),i=await $.removeCard(n,{attestation:o},t);return m.info("cards:remove_success",{cardId:n,promotedId:i?.promotedId??null}),i})}catch(o){if(m.error("cards:remove_failure",{cardId:n,error:o.message}),o instanceof xt)return ts(o,"remove_card");throw o}}async function Df(e,t){let n=e.cardId;if(!Number.isInteger(n)||n<=0)return{success:!1,message:"cardId must be a positive integer. Call get_cards to get the opaque cardId for the card you want to make default."};m.info("cards:set_default_attempt",{cardId:n});let r=`set-default-card:${n}`,s=`set ${await Jc(n,t)} as default`;try{return await _e(async()=>{let o=await Pe(r,0,"",s,t,{forceRequired:!0}),i=await $.setDefaultCard(n,{attestation:o},t);return m.info("cards:set_default_success",{cardId:n}),i})}catch(o){if(m.error("cards:set_default_failure",{cardId:n,error:o.message}),o instanceof xt)return ts(o,"set_default_card");throw o}}async function Uf(e){return m.info("auth:login_attempt"),Yc(`${Io()}/login`,e)}function jf(e){if(e.capCents!==void 0){let t=Number(e.capCents);if(!Number.isFinite(t)||t<10||t>1e4)throw new Error("capCents must be between 10 ($0.10) and 10000 ($100)");return Math.floor(t)}if(e.capUsd!==void 0){let t=Number(e.capUsd);if(!Number.isFinite(t)||t<.1||t>100)throw new Error("capUsd must be between 0.10 and 100");return Math.floor(t*100)}}async function qf(e={},t){let n;try{n=jf(e)}catch(r){return{success:!1,error:r?.message||String(r)}}return es(async()=>{let r=await wc($,Pe,{toolName:"start_session",userContext:t,capCentsOverride:n});m.info("session:started",{budgetId:r.budgetId,totalCents:r.totalCents,requestedCapCents:r.requestedCapCents,appliedCapCents:r.appliedCapCents,clampedReason:r.clampedReason,closedPrevious:r.closedPrevious});let s=(r.appliedCapCents/100).toFixed(2),o=(r.requestedCapCents/100).toFixed(2),i=`Session started with a $${s} cap. Paid calls will use this approval window until you close it, it expires, or this MCP process restarts.`,a=r.clampedReason==="balance"?`${i} Note: requested cap of $${o} was clamped to your prepaid balance of $${s}. Run buy_credits to top up if you need a larger session.`:i;return{success:!0,budgetId:r.budgetId,totalCents:r.totalCents,amountUsd:r.totalCents/100,requestedCapCents:r.requestedCapCents,appliedCapCents:r.appliedCapCents,clampedReason:r.clampedReason,closedPrevious:r.closedPrevious,message:a}})}async function Vf(){let e=wt();if(!e)return{success:!0,active:!1,message:"No active explicit approval window. Paid calls use a one-shot session in pay-as-you-go mode; see transaction_history for records."};let t=Math.max(0,e.totalCents-e.estimatedCumulative);return{success:!0,active:!0,budgetId:e.budgetId,totalCents:e.totalCents,estimatedCumulativeCents:e.estimatedCumulative,estimatedRemainingCents:t,expiresAt:e.expiresAt,lastToolSpend:e.lastToolSpend,message:`Active explicit approval window: about $${(t/100).toFixed(2)} remaining of $${(e.totalCents/100).toFixed(2)}.`}}async function Ff(){return es(async()=>{let e=wt();if(!e)return{success:!0,message:"No active explicit approval window to close. Paid calls remain pay-as-you-go.",closed:!1};let t=await zr($);m.info("session:closed",{budgetId:t.budgetId,closedServerSide:t.closedServerSide});let n=Np(e),r=n.micros,s=Number(r/10000n);return m.info("session:closed:final-spend",{budgetId:t.budgetId,closedServerSide:t.closedServerSide,finalSpendMicros:r.toString(),finalSpendCents:s,finalSpendSource:n.source,totalCents:e.totalCents}),{success:!0,closed:!0,closedServerSide:t.closedServerSide,budgetId:t.budgetId,finalEstimatedCumulativeCents:s,finalEstimatedCumulativeMicros:r.toString(),totalCents:e.totalCents,message:t.closedServerSide?`Explicit approval window closed. Spent ${Op(r)} of $${(e.totalCents/100).toFixed(2)} cap. Future paid calls are pay-as-you-go until you start a new explicit approval window.`:"Explicit approval window cleared locally; server-side close call did not succeed (likely already closed). Future paid calls are pay-as-you-go until you start a new explicit approval window."}})}async function Bf(e){return m.info("auth:add_card_attempt"),await D.getSessionToken()?Yc(`${Io()}/enroll`,e,"enrollment"):{success:!1,message:"Not logged in. Sign up at https://visacli.sh or call the login tool first."}}async function Hf(e,t){if(typeof e.confirm!="boolean"||e.confirm!==!0)return{success:!1,message:"Please confirm by setting confirm: true to reset"};m.info("reset:attempt");let n=!1;try{let r=await $.getStatus(t);if(r&&ns(r)){let s=await Xc(t);if(!s.success)return s;n=!0}}catch(r){let s=r?.message||"unknown error";if(!/not logged in|session.*expired|no local credentials/i.test(s))return{success:!1,message:`Could not check server biometric state: ${s}`};m.warn("reset:server_attestation_status_unavailable",{error:s})}try{await $.logout(void 0,t)}catch{}if(await D.clearAll(),Z())try{await $r()}catch{}return m.info("reset:success"),{success:!0,message:n?"Device reset. Server-side biometric state and local credentials have been cleared. Use the login tool or visa-cli setup to re-enroll.":"Device reset. Local credentials and keys have been removed. Use the login tool or visa-cli setup to re-enroll."}}function Kf(e){let t=["url","resultUrl","imageUrl","audioUrl","trackUrl"];for(let n of t){let r=e[n];r&&typeof r=="string"&&r.startsWith("http")&&Te(r)}Array.isArray(e.urls)&&e.urls.forEach(n=>{n&&typeof n=="string"&&n.startsWith("http")&&Te(n)})}async function Gf(e){let t=e.query?.trim()||void 0,n=e.category?.trim()||void 0,r=!t&&!n;m.info("catalog:discover",{query:t,category:n,browseAll:r});try{let o=(await $.catalogSearch(t,n)).tools||[];if(o.length===0)return{content:[{type:"text",text:r?"The tool catalog is currently empty.":`No tools found for "${t||n}". Try a different search term.`}]};if(r){let a={};for(let c of o){let u=c.category||"other";(a[u]??=[]).push(c)}let l=Object.keys(a).sort().map(c=>{let u=a[c].map((g,f)=>`${f+1}. **${g.name}** (${g.id})
|
|
108
|
+
${g.description}
|
|
109
|
+
Provider: ${g.provider} | Price: ${jc(g)}
|
|
110
|
+
Params: ${Object.keys(g.inputSchema?.properties||g.inputSchema||{}).join(", ")||"none"}`).join(`
|
|
111
|
+
|
|
112
|
+
`);return`## ${c.length<=3?c.toUpperCase():c.charAt(0).toUpperCase()+c.slice(1)}
|
|
113
|
+
|
|
114
|
+
${u}`}).join(`
|
|
115
|
+
|
|
116
|
+
`);return m.info("catalog:discovered",{count:o.length}),{content:[{type:"text",text:`Available ${o.length} tool(s) by category:
|
|
117
|
+
|
|
118
|
+
${l}
|
|
119
|
+
|
|
120
|
+
Use execute_tool with the tool id and required params to run any of these.`}],_tools:o}}let i=o.map((a,l)=>`${l+1}. **${a.name}** (${a.id})
|
|
121
|
+
${a.description}
|
|
122
|
+
Provider: ${a.provider} | Category: ${a.category} | Price: ${jc(a)}
|
|
123
|
+
Params: ${Object.keys(a.inputSchema?.properties||a.inputSchema||{}).join(", ")||"none"}`).join(`
|
|
124
|
+
|
|
125
|
+
`);return m.info("catalog:discovered",{count:o.length}),{content:[{type:"text",text:`Found ${o.length} tool(s):
|
|
126
|
+
|
|
127
|
+
${i}
|
|
128
|
+
|
|
129
|
+
Use execute_tool with the tool id and required params to run any of these.`}],_tools:o}}catch(s){throw m.error("catalog:discover:error",{error:s.message}),new Error(`Failed to search tool catalog: ${s.message}`)}}function jc(e){return e.priceDisplay??`$${(e.priceCents/100).toFixed(2)}`}function zf(e,t){return t==="image"||t==="video"||t==="audio"?t:e?.match(/\.(mp4|webm|mov)/)?"video":"image"}function Yr(e,t){return Array.isArray(e.type)?e.type.includes(t):e.type===t}function Wf(e,t,n){let r=e.inputSchema;if(!r||r.type!=="object")return null;let s=r.properties??{},o=n??e.id;for(let a of Object.keys(t))if(!Object.prototype.hasOwnProperty.call(s,a)){let l=Object.keys(s),c=l.length>0?` Expected: ${l.join(", ")}.`:"";return`Unknown parameter "${a}" for ${o}.${c}`}let i=(r.required??[]).filter(a=>!Object.prototype.hasOwnProperty.call(t,a)||t[a]===void 0);if(i.length>1)return`${i.join(", ")} are required for ${o}.`;for(let a of r.required??[]){if(!Object.prototype.hasOwnProperty.call(t,a)||t[a]===void 0)return`${a} is required for ${o}.`;if(t[a]===null)return`${a} cannot be null.`;if(typeof t[a]=="string"&&t[a].trim()==="")return`${a} cannot be empty.`}for(let[a,l]of Object.entries(t)){let c=s[a];if(!(!c||l===void 0||l===null)){if(c.enum&&!c.enum.includes(l))return`${a} must be one of: ${c.enum.map(String).join(", ")}.`;if(Yr(c,"integer")){if(typeof l!="number"||!Number.isInteger(l))return`${a} must be an integer.`}else if(Yr(c,"number")){if(typeof l!="number"||!Number.isFinite(l))return`${a} must be a number.`}else if(Yr(c,"string")){if(typeof l!="string")return`${a} must be a string.`;if(l.trim()==="")return`${a} cannot be empty.`;if(c.minLength!==void 0&&l.length<c.minLength)return`${a} is too short.`;if(c.maxLength!==void 0&&l.length>c.maxLength)return`${a} is too long.`}else if(Yr(c,"boolean")&&typeof l!="boolean")return`${a} must be a boolean.`;if(typeof l=="number"){if(c.minimum!==void 0&&l<c.minimum)return`${a} must be at least ${c.minimum}.`;if(c.maximum!==void 0&&l>c.maximum)return`${a} must be at most ${c.maximum}.`}}}return null}async function Jf(e){let t=Un(e);if(t)return t;try{return await $.catalogTool(e)}catch(n){return m.warn("catalog:resolve:error",{tool:e,error:n?.message||String(n)}),null}}async function Yf(e,t,n="execute_tool"){let{tool_id:r,params:s,...o}=e,i=s||o;if(!r)return Jr("tool_id is required. Use discover_tools first to find available tools.","MISSING_TOOL_ID");m.info("catalog:execute",{tool:r,metaTool:n});let a=await Jf(r);if(!a)return Jr(`Unknown tool: '${r}'. Use discover_tools first to find available tools.`,"UNKNOWN_TOOL");if(a.deprecated){let f=a.replacementTool?` Use '${a.replacementTool}' instead.`:"";return Jr(`Tool '${r}' is deprecated and is no longer available for new paid calls.${f}`,"DEPRECATED_TOOL")}let c=Wf(a,i,n&&n!=="execute_tool"?n:void 0);if(c)return m.info("catalog:execute:validation_failed",{tool:r,metaTool:n,error:c}),Jr(c);let u=await rs(r,i,t,n);if(u)return u;if(a.executionMode==="free_authenticated"||a.accessMode==="free"){m.info("catalog:execute:free",{tool:r,metaTool:n});let f=await $.shortcut(r,i,6e4,t,n);return f&&typeof f=="object"&&!Array.isArray(f)&&f.merchantName==null&&(f.merchantName=a.name??r),f}let d=await He(r,void 0,t),g=oe.randomUUID();m.info("payment:attempt",{tool:r,amount:d.amount,merchant:d.merchantName});try{return await _e(async()=>{let f;try{f=await Ct({toolId:r,toolParams:i,estimatedAmountCents:rt(d),userContext:t,metaTool:n,timeoutMs:12e4,idempotencyKey:g})}catch(x){if(x instanceof le)return Be(x);throw x}if(m.info("payment:success",{tool:r,amount:d.amount,merchant:d.merchantName,mode:"session"}),f&&typeof f=="object"&&!Array.isArray(f)&&f.merchantName==null&&(f.merchantName=a?.name??r),f.urls?.length){f.urls.forEach(y=>Te(y));let x=zf(f.urls[0],f.mediaType);Gn({prompt:i.prompt||`${r} execution`,tool:r,mediaUrl:f.urls[0],mediaType:x,cost:f.amount??d.amount,transactionId:f.transactionId,userContext:t})}return f})}catch(f){return f instanceof re?(m.warn("payment:declined",{tool:r,amount:d.amount,merchant:d.merchantName,code:f.code,retryable:f.retryable}),Ie(f,d)):(m.error("payment:failure",{tool:r,amount:d.amount,merchant:d.merchantName,error:f.message}),Lp({toolId:r,surface:n,merchantName:d.merchantName,amount:d.amount,message:f?.message||"Tool execution failed."}))}}var Fe=class{static async getStatus(t){return wf(t)}static async pay(t,n){return of(t,n)}static async getVisaSmi(t,n){return af(t,n)}static async getCards(t){return xf(t)}static async transactionHistory(t,n){return Cf(t||{},n)}static async feedback(t,n){return kf(t,n)}static async updateSpendingControls(t,n){return Af(t,n)}static async configList(t){return Rf(t||{})}static async configSet(t){return $f(t||{})}static async configUnset(t){return If(t||{})}static async biometricStatus(t){return Pf(t)}static async biometricOn(t){return Mf(t)}static async biometricOff(t,n){return Of(t,n)}static async reset(t,n){return Hf(t,n)}static async login(t){return Uf(t)}static async closeSession(t){return Ff()}static async startSession(t,n){return qf(t||{},n)}static async getSessionStatus(t){return Vf()}static async addCard(t){return Bf(t)}static async removeCard(t,n){return Lf(t,n)}static async setDefaultCard(t,n){return Df(t,n)}static async buyCredits(t,n){return Ef(t,n)}static async batch(t,n){return bf(t,n)}static async discoverTools(t){return Gf(t)}static async executeTool(t,n,r="execute_tool"){return Yf(t,n,r)}static async shortcut(t,n,r){switch(t){case"generate_image_card":return cf(n,r);case"generate_image_fast_card":return lf(n,r);case"generate_video_tempo_card":return uf(n,r);case"generate_music_tempo_card":return df(n,r);case"check_music_status_tempo_card":return mf(n,r);case"query_onchain_prices_card":return pf(n,r);default:{let s=await He(t,void 0,r);m.info("payment:attempt",{tool:t});try{let o=await Ct({toolId:t,toolParams:n,estimatedAmountCents:rt(s),userContext:r,timeoutMs:6e4});return m.info("payment:success",{tool:t,mode:"session"}),o.urls?.length&&o.urls.forEach(i=>Te(i)),o}catch(o){if(o instanceof le)return Be(o);if(o instanceof re)return m.warn("payment:declined",{tool:t,code:o.code,retryable:o.retryable}),Ie(o,s);throw m.error("payment:failure",{tool:t,error:o.message}),o}}}}static async submitFeedback(t,n,r){m.info("feedback:submit",{length:t.length,transactionId:n,hasContext:!!r});try{let s=await $.submitFeedback(t,n,r);return m.info("feedback:submitted",{transactionId:n}),s}catch(s){let o=s instanceof Error?s.message:"Unknown error";throw m.error("feedback:error",{error:o,transactionId:n}),s}}static async getFeedback(t,n){m.info("feedback:list",{limit:t||20});try{let r=await $.getFeedback(t,n);return m.info("feedback:listed",{count:r?.feedback?.length||0}),r}catch(r){let s=r instanceof Error?r.message:"Unknown error";throw m.error("feedback:error",{error:s}),r}}};function Qc(e,t=process.stderr){if(De()||!e?.updateAvailable)return!1;let{latestVersion:n}=e.updateAvailable;if(!n)return!1;let r=`Update available: v${n}. Run: ${pn()}`;return t.write(`
|
|
130
|
+
\x1B[33m\u2191 ${r}\x1B[0m
|
|
131
|
+
`),!0}function el(e){let t=Array.isArray(e.inputSchema?.required)?e.inputSchema.required.filter(s=>typeof s=="string"):[],n=e.inputSchema?.properties&&typeof e.inputSchema.properties=="object"?e.inputSchema.properties:{};if(t.length===0)return{prompt:"a lobster"};let r={};for(let s of t)r[s]=Zf(s,n[s]?.description);return r}function Zf(e,t){let n=e.toLowerCase();return n==="prompt"?"a lobster":n==="text"?"Hello from Visa CLI.":n.endsWith("image_url")||n==="image_url"?"https://example.com/sample.jpg":n.endsWith("audio_url")||n==="audio_url"?"https://example.com/sample.wav":n.endsWith("video_url")||n==="video_url"?"https://example.com/sample.mp4":n==="taskid"||n==="task_id"?"task_abc123":n==="request_id"||n==="requestid"?"req_abc123":n==="model_path"||n==="model"?"fal-ai/flux/schnell":n==="language"?"en":t&&/\bUR?L\b|https?:\/\//i.test(t)?"https://example.com/sample":"example"}var Xf=20;function nl(e,t,n,r){let s=r.currentVersion==="0.0.0"&&e.version?e.version:r.currentVersion,i=og(e.spendingControls).dailyLimit,a=Math.max(0,zn(e.dailySpent)),l=i>0?Math.min(i,Math.max(0,zn(e.dailyRemaining??i-a))):0,c=i>0?Math.min(1,a/i):0,d=(Array.isArray(t)?t:[]).filter(tg),g=d.slice(0,3),f=ng(d,3),x=(e.cards??[]).slice(0,3),y=r.latestVersion?kt(r.latestVersion):"",A=r.updateCheckDisabled?"update checks disabled":y?`update ready: v${y}`:"up to date",N=Math.round(c*100),L=Tt(e.status,e.enrolled?"approved":"not enrolled"),C=["VISA CLI",`Status: ${e.enrolled?"Visa ready":"Visa setup needed"} | account: ${L} | touch id: ${n?"ready":"unavailable"}`,`Version: v${s} | ${A}`,`Spend meter: ${tl(c)} ${String(N).padStart(3," ")}% | remaining ${wn(l)}/day | daily cap ${wn(i)}`,"","Spend",` Remaining ${wn(l)} / ${wn(i)}`,` Usage ${tl(c)} ${N}%`,` Spent today ${wn(a)}`,` Attestation key ${e.hasAttestationKey?"registered":"missing"}`,"","Cards",...x.length>0?x.map(V=>` ${sg(V)}`):[" No cards enrolled"],"","Last 3 services",...f.length>0?f.map((V,G)=>` ${G+1}. ${V}`):[" No paid services yet"],"","Recent receipts",...g.length>0?g.map(V=>` ${rg(V)}`):[" No receipts yet"]];if(y&&!r.updateCheckDisabled){let V=kt(pn(y));C.push("",`Update: v${y} ready \u2014 run \`${V}\``),r.updateMessage&&C.push(` ${kt(r.updateMessage)}`)}else r.updateMessage&&C.push("",`Update: ${kt(r.updateMessage)}`);return`${C.join(`
|
|
132
|
+
`)}
|
|
133
|
+
`}function Qf(e){return e.tool_name!=null}function eg(e){return zn(e.amount)===0&&e.status==="failed"}function tg(e){return Qf(e)&&!eg(e)}function ng(e,t=1/0){let n=new Set,r=[];for(let s of e){if(r.length>=t)break;let o=Tt(s.merchant_name,"Unknown merchant"),i=Tt(s.tool_name,"unknown_tool"),a=`${o} :: ${i}`;n.has(a)||(n.add(a),r.push(`${o} [${i}]`))}return r}function rg(e){let t=Tt(e.merchant_name,"Unknown merchant"),n=Tt(e.tool_name,"unknown_tool"),r=wn(zn(e.amount)),s=Tt(e.status,"unknown"),o=ig(e.created_at);return`${r} ${s.padEnd(9)} ${t} [${n}] ${o}`}function sg(e){let t=Tt(e.brand?.toUpperCase(),"CARD"),n=e.isDefault?" default":"";return`${t} ****${e.last4}${n}`}function og(e){return{dailyLimit:zn(e?.daily_limit??e?.dailyLimit??0)}}function zn(e){let t=Number(typeof e=="string"?e:e??0);return Number.isFinite(t)?t:0}function wn(e){return`$${e.toFixed(2)}`}function tl(e,t=Xf){let n=Math.max(0,Math.min(1,e)),r=Math.round(n*t);return`[${"\u2588".repeat(r)}${"\u2591".repeat(t-r)}]`}function Tt(e,t){let n=kt(e??"").trim();return n.length>0?n:t}function ig(e){if(!e)return"unknown time";let t=new Date(e);return Number.isNaN(t.getTime())?Tt(e,"unknown time"):t.toISOString().slice(0,16).replace("T"," ")}function kt(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g,"").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\u001B[P_^][^\u001B]*(?:\u001B\\|\u0007)/g,"").replace(/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g,"").replace(/\s+/g," ")}var ag=/^[1-9]\d{0,9}$/;function Oo(e){if(!ag.test(e))throw new Error("card id must be a positive integer with up to 10 digits. Run `visa-cli cards list` first.");return Number(e)}function rl(e){let t=kt(e.brand||"Visa"),n=kt(e.last4||"unknown");return{id:Number.isInteger(e.id)?String(e.id):"-",brand:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),card:`****${n}`,default:e.isDefault?"yes":""}}var cs=R(Br());var cg=["get_status","add_card","pay","get_visa_smi","get_cards","remove_card","set_default_card","buy_credits","transaction_history","update_spending_controls","config_list","config_set","config_unset","biometric_status","biometric_on","biometric_off","reset","login","start_session","close_session","get_session_status","set_session_mode","generate_image_card","generate_image_fast_card","generate_video_tempo_card","generate_music_tempo_card","check_music_status_tempo_card","query_onchain_prices_card","feedback","suggest_meme_templates","batch","discover_tools","execute_tool"];function lg(){let e=new Set;for(let t of cg)e.add(t),e.add(t.replace(/-/g,"_")),e.add(t.replace(/_/g,"-"));for(let t of qn)e.add(t),e.add(t.replace(/-/g,"_")),e.add(t.replace(/_/g,"-"));return e}var _v=lg();var No=new Set(["generate_image_card","generate_image_fast_card","generate_video_tempo_card","generate_music_tempo_card","check_music_status_tempo_card","query_onchain_prices_card"]);var xv=new Set(qn),Cv=new Set(["batch","buy_credits","execute_tool","get_visa_smi",...No,...qn]);var U=R(require("fs")),P=R(require("path")),sl=R(require("os")),W=sl.homedir(),ug=["Claude_","Anthropic.ClaudeDesktop_"],xn=class extends Error{constructor(n,r,s){super(mg(n,r,s));this.client=n;this.configPath=r;this.name="McpConfigAccessError"}client;configPath};function ol(e){let t=e;return[t?.message,t?.stderr].filter(n=>typeof n=="string").join(`
|
|
134
|
+
`)}function dg(e){let t=e;if(t?.code==="EPERM"||t?.code==="EACCES")return!0;let n=ol(e).toLowerCase();return n.includes("operation not permitted")||n.includes("permission denied")}function mg(e,t,n){let r=t.replace(W,"~"),s=ol(n).split(`
|
|
135
|
+
`).find(Boolean),o=s?` (${s})`:"";return e.id==="codex"?`Could not update Codex MCP config at ${r}: filesystem access was denied${o}. In Codex, rerun with elevated filesystem access or run \`visa-cli install codex\` outside the sandbox.`:`Could not update ${e.displayName} MCP config at ${r}: filesystem access was denied${o}.`}function Wn(){return process.env.APPDATA||P.join(W,"AppData","Roaming")}function pg(){return process.env.LOCALAPPDATA||P.join(W,"AppData","Local")}function Lo(e){return process.platform==="win32"?e.win32:e.posix}function il(){if(process.platform!=="win32")return;let e=P.join(pg(),"Packages");if(U.existsSync(e))try{let t=U.readdirSync(e,"utf-8");for(let n of ug){let r=t.filter(s=>s.startsWith(n)).sort()[0];if(r)return P.join(e,r,"LocalCache","Roaming","Claude")}}catch{return}}function al(){if(process.platform==="win32"){let e=il();return e?P.join(e,"claude_desktop_config.json"):P.join(Wn(),"Claude","claude_desktop_config.json")}return P.join(W,"Library","Application Support","Claude","claude_desktop_config.json")}function cl(){if(process.platform!=="win32")return[P.join(W,"Library","Application Support","Claude")];let e=[P.join(Wn(),"Claude")],t=il();return t&&e.push(t),e}function ss(e){return e.id==="claude-desktop"?al():e.globalConfigPath}function fg(e){return e.id==="claude-desktop"?cl():e.detectPaths}var Me=[{id:"claude",displayName:"Claude Code",globalConfigPath:P.join(W,".claude.json"),configKey:"mcpServers",detectPaths:[P.join(W,".claude.json")],postInstallHint:"Restart Claude Code or run /mcp to connect."},{id:"claude-desktop",displayName:"Claude Desktop",globalConfigPath:al(),configKey:"mcpServers",detectPaths:cl(),postInstallHint:"Restart the Claude desktop app to connect."},{id:"cursor",displayName:"Cursor",globalConfigPath:P.join(W,".cursor","mcp.json"),configKey:"mcpServers",detectPaths:[P.join(W,".cursor")],postInstallHint:"Restart Cursor to connect."},{id:"windsurf",displayName:"Windsurf",globalConfigPath:P.join(W,".codeium","windsurf","mcp_config.json"),configKey:"mcpServers",detectPaths:[P.join(W,".codeium","windsurf")],postInstallHint:"Restart Windsurf to connect."},{id:"cline",displayName:"Cline",globalConfigPath:P.join(W,".vscode","mcp.json"),configKey:"mcpServers",detectPaths:[P.join(W,".vscode","extensions","saoudrizwan.claude-dev-*")],postInstallHint:"Restart VS Code to connect."},{id:"roo-code",displayName:"Roo Code",globalConfigPath:Lo({win32:P.join(Wn(),"Roo","mcp_settings.json"),posix:P.join(W,".config","Roo","mcp_settings.json")}),configKey:"mcpServers",detectPaths:[P.join(W,".vscode","extensions","RooVeterinaryInc.roo-cline-*")],postInstallHint:"Restart VS Code to connect."},{id:"copilot",displayName:"VS Code Copilot",globalConfigPath:P.join(W,".vscode","mcp.json"),configKey:"servers",detectPaths:[P.join(W,".vscode")],postInstallHint:"Restart VS Code to connect."},{id:"zed",displayName:"Zed",globalConfigPath:Lo({win32:P.join(Wn(),"Zed","settings.json"),posix:P.join(W,".config","zed","settings.json")}),configKey:"context_servers",detectPaths:Lo({win32:[P.join(Wn(),"Zed")],posix:[P.join(W,".config","zed")]}),postInstallHint:"Restart Zed to connect.",buildEntry:e=>({source:"custom",...e})},{id:"codex",displayName:"Codex",globalConfigPath:P.join(W,".codex","config.toml"),configKey:"mcp_servers",configFormat:"toml",detectPaths:[P.join(W,".codex")],postInstallHint:"Restart Codex to connect. For the terminal HUD, run: visa-cli config hud enable"}];function Do(e){return Me.find(t=>t.id===e)}function Jn(e){return fg(e).some(t=>{if(t.includes("*")){let n=P.dirname(t),r=P.basename(t).replaceAll("*","");if(!U.existsSync(n))return!1;try{return U.readdirSync(n).some(s=>s.startsWith(r))}catch{return!1}}return U.existsSync(t)})}function ll(){return{command:"node",args:[P.resolve(__dirname,"mcp-server/index.js")]}}function Uo(e,t){return t==="project"?"json":e.configFormat??"json"}function gg(e){if(e=e.trim(),e==="true")return!0;if(e==="false")return!1;if(e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);if(e.startsWith("[")&&e.endsWith("]")){let n=e.slice(1,-1).trim();return n.length===0?[]:n.split(",").map(r=>r.trim()).filter(Boolean).map(r=>r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r)}let t=Number(e);return isNaN(t)?e:t}function jo(e,t){let n=`[mcp_servers.${t}]`,r=e.findIndex(o=>o.trim()===n);if(r===-1)return;let s=r+1;for(;s<e.length&&!e[s].trim().startsWith("[");)s++;return{start:r,end:s}}function qo(e,t){let n=e.split(`
|
|
136
|
+
`),r=jo(n,t);if(!r)return;let s={};for(let o=r.start+1;o<r.end;o++){let i=n[o].trim().match(/^(\w+)\s*=\s*(.+)$/);i&&(s[i[1]]=gg(i[2]))}return Object.keys(s).length>0?s:void 0}function hg(e,t,n){let r=`[${n.args.map(l=>`"${l}"`).join(", ")}]`,s=[`[mcp_servers.${t}]`,`command = "${n.command}"`,`args = ${r}`],o=e.split(`
|
|
137
|
+
`),i=jo(o,t);if(i){o.splice(i.start,i.end-i.start,...s);let l=o.join(`
|
|
138
|
+
`);return l.endsWith(`
|
|
139
|
+
`)?l:l+`
|
|
140
|
+
`}let a=e.trimEnd();return a+(a.length>0?`
|
|
141
|
+
|
|
142
|
+
`:"")+s.join(`
|
|
119
143
|
`)+`
|
|
120
|
-
`}function
|
|
121
|
-
`),r=
|
|
144
|
+
`}function yg(e,t){let n=e.split(`
|
|
145
|
+
`),r=jo(n,t);return r?(n.splice(r.start,r.end-r.start),n.join(`
|
|
122
146
|
`).replace(/\n{3,}/g,`
|
|
123
147
|
|
|
124
|
-
`)):
|
|
125
|
-
`)}}catch(r){throw
|
|
126
|
-
`),{removed:!0,configPath:n})}function
|
|
127
|
-
`)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Error:`,o)}}var jh=null;function Y1(t){let e="error";ji(e,t),$i(e,MEe)}function MEe(){jh=j.onerror,j.onerror=function(t,e,n,r,o){return Yi("error",{column:r,error:o,line:n,msg:t,url:e}),jh?jh.apply(this,arguments):!1},j.onerror.__SENTRY_INSTRUMENTED__=!0}var $h=null;function q1(t){let e="unhandledrejection";ji(e,t),$i(e,yEe)}function yEe(){$h=j.onunhandledrejection,j.onunhandledrejection=function(t){return Yi("unhandledrejection",t),$h?$h.apply(this,arguments):!0},j.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var K1=Object.prototype.toString;function Co(t){switch(K1.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return dr(t,Error)}}function n_(t,e){return K1.call(t)===`[object ${e}]`}function Yh(t){return n_(t,"ErrorEvent")}function Po(t){return n_(t,"String")}function qi(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Ki(t){return t===null||qi(t)||typeof t!="object"&&typeof t!="function"}function kr(t){return n_(t,"Object")}function qh(t){return typeof Event<"u"&&dr(t,Event)}function Kh(t){return typeof Element<"u"&&dr(t,Element)}function Wh(t){return n_(t,"RegExp")}function kn(t){return!!(t?.then&&typeof t.then=="function")}function Xh(t){return kr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function dr(t,e){try{return t instanceof e}catch{return!1}}function iu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}var vEe=j,bEe=80;function W1(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,u,l=Array.isArray(e)?e:e.keyAttrs,p=!Array.isArray(e)&&e.maxStringLength||bEe;for(;n&&s++<r&&(u=LEe(n,l),!(u==="html"||s>1&&i+o.length*c+u.length>=p));)o.push(u),i+=u.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function LEe(t,e){let n=t,r=[];if(!n?.tagName)return"";if(vEe.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(i=>n.getAttribute(i)).map(i=>[i,n.getAttribute(i)]):null;if(o?.length)o.forEach(i=>{r.push(`[${i[0]}="${i[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let i=n.className;if(i&&Po(i)){let a=i.split(/\s+/);for(let c of a)r.push(`.${c}`)}}let s=["aria-label","type","name","title","alt"];for(let i of s){let a=n.getAttribute(i);a&&r.push(`[${i}="${a}"]`)}return r.join("")}function _r(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function zh(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 Jh(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{iu(o)?n.push("[VueViewModel]"):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function X1(t,e,n=!1){return Po(t)?Wh(e)?e.test(t):Po(e)?n?t===e:t.includes(e):!1:!1}function Mo(t,e=[],n=!1){return e.some(r=>X1(t,r,n))}function Qh(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&Q1(o,r);try{t[e]=o}catch{D&&m.log(`Failed to replace method "${e}" in object`,t)}}function qe(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{D&&m.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Q1(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,qe(t,"__sentry_original__",e)}catch{}}function Zh(t){return t.__sentry_original__}function r_(t){if(Co(t))return{message:t.message,name:t.name,stack:t.stack,...J1(t)};if(qh(t)){let e={type:t.type,target:z1(t.target),currentTarget:z1(t.currentTarget),...J1(t)};return typeof CustomEvent<"u"&&dr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function z1(t){try{return Kh(t)?W1(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function J1(t){if(typeof t=="object"&&t!==null){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function eg(t,e=40){let n=Object.keys(r_(t));n.sort();let r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return _r(r,e);for(let o=n.length;o>0;o--){let s=n.slice(0,o).join(", ");if(!(s.length>e))return o===n.length?s:_r(s,e)}return""}function DEe(){let t=j;return t.crypto||t.msCrypto}function Je(t=DEe()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(e()&15)>>n/4).toString(16))}function Z1(t){return t.exception?.values?.[0]}function yo(t){let{message:e,event_id:n}=t;if(e)return e;let r=Z1(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ng(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 Wi(t,e){let n=Z1(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 xEe=/^(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 tg(t){return parseInt(t||"",10)}function rg(t){let e=t.match(xEe)||[],n=tg(e[1]),r=tg(e[2]),o=tg(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 o_(t){if(UEe(t))return!0;try{qe(t,"__sentry_captured__",!0)}catch{}return!1}function UEe(t){try{return t.__sentry_captured__}catch{}}var tV=1e3;function Fr(){return Date.now()/tV}function wEe(){let{performance:t}=j;if(!t?.now||!t.timeOrigin)return Fr;let e=t.timeOrigin;return()=>(e+t.now())/tV}var eV;function vo(){return(eV??(eV=wEe()))()}function nV(t){let e=vo(),n={sid:Je(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>VEe(n)};return t&&jr(n,t),n}function jr(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||vo(),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:Je()),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 rV(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),jr(t,n)}function VEe(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 bo(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]=bo(r[o],e[o],n-1));return r}function Fn(){return Je()}function cn(){return Je().substring(16)}var og="_sentrySpan";function bs(t,e){e?qe(t,og,e):delete t[og]}function Ls(t){return t[og]}var BEe=100,zt=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Fn(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},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,bs(e,Ls(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&&jr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},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():kr(n)?e:void 0,{tags:o,extra:s,user:i,contexts:a,level:c,fingerprint:u=[],propagationContext:l}=r||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},i&&Object.keys(i).length&&(this._user=i),c&&(this._level=c),u.length&&(this._fingerprint=u),l&&(this._propagationContext=l),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,bs(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Fn(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:BEe;if(r<=0)return this;let o={timestamp:Fr(),...e,message:e.message?_r(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,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:Ls(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=bo(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||Je();if(!this._client)return D&&m.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||Je();if(!this._client)return D&&m.warn("No client configured on scope - will not capture message!"),o;let s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=n?.event_id||Je();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(D&&m.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 Xi(){return Hr("defaultCurrentScope",()=>new zt)}function Er(){return Hr("defaultIsolationScope",()=>new zt)}var sg=class{constructor(e,n){let r;e?r=e:r=new zt;let o;n?o=n:o=new zt,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 kn(r)?r.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(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 zi(){let t=Bt(),e=Io(t);return e.stack=e.stack||new sg(Xi(),Er())}function GEe(t){return zi().withScope(t)}function HEe(t,e){let n=zi();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function oV(t){return zi().withScope(()=>t(zi().getIsolationScope()))}function sV(){return{withIsolationScope:oV,withScope:GEe,withSetScope:HEe,withSetIsolationScope:(t,e)=>oV(e),getCurrentScope:()=>zi().getScope(),getIsolationScope:()=>zi().getIsolationScope()}}function ig(t){let e=Bt(),n=Io(e);n.acs=t}function jn(t){let e=Io(t);return e.acs?e.acs:sV()}function J(){let t=Bt();return jn(t).getCurrentScope()}function ce(){let t=Bt();return jn(t).getIsolationScope()}function s_(){return Hr("globalScope",()=>new zt)}function fr(...t){let e=Bt(),n=jn(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function au(...t){let e=Bt(),n=jn(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function G(){return J().getClient()}function Ji(t){let e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:o}=e,s={trace_id:n,span_id:o||cn()};return r&&(s.parent_span_id=r),s}var Qe="sentry.source",$n="sentry.sample_rate",ag="sentry.previous_trace_sample_rate",W="sentry.op",ue="sentry.origin";var cg="sentry.measurement_unit",ug="sentry.measurement_value",Sr="sentry.custom_span_name",Qi="sentry.profile_id",Zi="sentry.exclusive_time",lg="cache.hit",pg="cache.key",dg="cache.item_size";function i_(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:"unknown_error"}}var iV="_sentryScope",aV="_sentryIsolationScope";function cu(t,e,n){t&&(qe(t,aV,n),qe(t,iV,e))}function Yn(t){return{scope:t[iV],isolationScope:t[aV]}}var uu="sentry-",uV=/^sentry-/,lV=8192;function Lo(t){let e=xs(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.match(uV)){let i=o.slice(uu.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Ds(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${uu}${r}`]=o),n),{});return a_(e)}function xs(t){if(!(!t||!Po(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=cV(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):cV(t)}function cV(t){return t.split(",").map(e=>e.split("=").map(n=>{try{return decodeURIComponent(n.trim())}catch{return}})).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function a_(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>lV?(D&&m.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}function un(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 c_=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function pV(t){if(!t)return;let e=t.match(c_);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 lu(t,e){let n=pV(t),r=Lo(e);if(!n?.traceId)return{traceId:Fn(),sampleRand:Math.random()};let o=kEe(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 Do(t=Fn(),e=cn(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function kEe(t,e){let n=un(e?.sample_rand);if(n!==void 0)return n;let r=un(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?Math.random()*r:r+Math.random()*(1-r):Math.random()}var l_=0,p_=1,dV=!1;function EV(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=H(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function xo(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:H(t).parent_span_id,s=Yn(t).scope,i=r?s?.getPropagationContext().propagationSpanId||cn():e;return{parent_span_id:o,span_id:i,trace_id:n}}function d_(t){let{traceId:e,spanId:n}=t.spanContext(),r=Tr(t);return Do(e,n,r)}function Us(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===p_,attributes:s,...o}))}function Jt(t){return typeof t=="number"?_V(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?_V(t.getTime()):vo()}function _V(t){return t>9999999999?t/1e3:t}function H(t){if($Ee(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(jEe(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,u="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:u,start_timestamp:Jt(o),timestamp:Jt(i)||void 0,status:ws(a),op:r[W],origin:r[ue],links:Us(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function jEe(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function $Ee(t){return typeof t.getSpanJSON=="function"}function Tr(t){let{traceFlags:e}=t.spanContext();return e===p_}function ws(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var pu="_sentryChildSpans",_g="_sentryRootSpan";function ea(t,e){let n=t[_g]||t;qe(e,_g,n),t[pu]?t[pu].add(e):qe(t,pu,new Set([e]))}function __(t){let e=new Set;function n(r){if(!e.has(r)&&Tr(r)){e.add(r);let o=r[pu]?Array.from(r[pu]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function Le(t){return t[_g]||t}function mr(){let t=Bt(),e=jn(t);return e.getActiveSpan?e.getActiveSpan():Ls(J())}function du(){dV||(be(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),dV=!0)}var fV=!1;function SV(){if(fV)return;function t(){let e=mr(),n=e&&Le(e);if(n){let r="internal_error";D&&m.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",fV=!0,Y1(t),q1(t)}function ct(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||G()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var ta="production";var YEe=/^o(\d+)\./,qEe=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function KEe(t){return t==="http"||t==="https"}function Kn(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 WEe(t){let e=qEe.exec(t);if(!e){be(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",u=a,l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){let p=u.match(/^\d+/);p&&(u=p[0])}return TV({host:s,pass:o,path:c,projectId:u,port:i,protocol:n,publicKey:r})}function TV(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function XEe(t){if(!D)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(m.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?KEe(r)?e&&isNaN(parseInt(e,10))?(m.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(m.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(m.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function mV(t){return t.match(YEe)?.[1]}function hV(t){let e=typeof t=="string"?WEe(t):TV(t);if(!(!e||!XEe(e)))return e}var gV="_frozenDsc";function E_(t,e){qe(t,gV,e)}function Eg(t,e){let n=e.getOptions(),{publicKey:r,host:o}=e.getDsn()||{},s;n.orgId?s=String(n.orgId):o&&(s=mV(o));let i={environment:n.environment||ta,release:n.release,public_key:r,trace_id:t,org_id:s};return e.emit("createDsc",i),i}function $r(t,e){let n=e.getPropagationContext();return n.dsc||Eg(n.traceId,t)}function He(t){let e=G();if(!e)return{};let n=Le(t),r=H(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[$n]??o[ag];function a(E){return(typeof i=="number"||typeof i=="string")&&(E.sample_rate=`${i}`),E}let c=n[gV];if(c)return a(c);let u=s?.get("sentry.dsc"),l=u&&Lo(u);if(l)return a(l);let p=Eg(t.spanContext().traceId,e),d=o[Qe],_=r.description;return d!=="url"&&_&&(p.transaction=_),ct()&&(p.sampled=String(Tr(n)),p.sample_rand=s?.get("sentry.sample_rand")??Yn(n).scope?.getPropagationContext().sampleRand.toString()),a(p),e.emit("createDsc",p,n),p}var Vs=class{constructor(e={}){this._traceId=e.traceId||Fn(),this._spanId=e.spanId||cn()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:l_}}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 Wn(t,e=100,n=1/0){try{return fg("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Sg(t,e=3,n=100*1024){let r=Wn(t,e);return ZEe(r)>n?Sg(t,e-1,n):r}function fg(t,e,n=1/0,r=1/0,o=efe()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=zEe(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 u=e;if(u&&typeof u.toJSON=="function")try{let _=u.toJSON();return fg("",_,c-1,r,o)}catch{}let l=Array.isArray(e)?[]:{},p=0,d=r_(e);for(let _ in d){if(!Object.prototype.hasOwnProperty.call(d,_))continue;if(p>=r){l[_]="[MaxProperties ~]";break}let E=d[_];l[_]=fg(_,E,c-1,r,o),p++}return i(e),l}function zEe(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(iu(e))return"[VueViewModel]";if(Xh(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${su(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=JEe(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function JEe(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function QEe(t){return~-encodeURI(t).split(/%..|./).length}function ZEe(t){return QEe(JSON.stringify(t))}function efe(){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 ln(t,e=[]){return[t,e]}function mg(t,e){let[n,r]=t;return[n,[...r,e]]}function f_(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 Tg(t){let e=Io(j);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function _u(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[Tg(r),s]:r.push(typeof s=="string"?Tg(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
131
|
-
${
|
|
132
|
-
`)
|
|
133
|
-
${
|
|
134
|
-
`)}`)}function fu(t){if(!D)return;let{description:e="< unknown name >",op:n="< unknown op >"}=H(t),{spanId:r}=t.spanContext(),s=Le(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;m.log(i)}function Bs(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[cg],s=r[ug];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var NV=1e3,na=class{constructor(e={}){this._traceId=e.traceId||Fn(),this._spanId=e.spanId||cn(),this._startTime=e.startTimestamp||vo(),this._links=e.links,this._attributes={},this.setAttributes({[ue]:"manual",[W]: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?p_:l_}}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=Jt(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Qe,"custom"),this}end(e){this._endTime||(this._endTime=Jt(e),fu(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[W],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:ws(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[ue],profile_id:this._attributes[Qi],exclusive_time:this._attributes[Zi],measurements:Bs(this._events),is_segment:this._isStandaloneSpan&&Le(this)===this||void 0,segment_id:this._isStandaloneSpan?Le(this).spanContext().spanId:void 0,links:Us(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){D&&m.log("[Tracing] Adding an event to span:",e);let o=IV(n)?n:r||vo(),s=IV(n)?{}:n||{},i={name:e,time:Jt(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=G();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===Le(this)))return;if(this._isStandaloneSpan){this._sampled?sfe(OV([this],e)):(D&&m.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&&(Yn(this).scope||J()).captureEvent(r)}_convertSpanToTransaction(){if(!CV(H(this)))return;this._name||(D&&m.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=Yn(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=__(this).filter(l=>l!==this&&!ofe(l)).map(l=>H(l)).filter(CV),i=this._attributes[Qe];delete this._attributes[Sr],s.forEach(l=>{delete l.data[Sr]});let a={contexts:{trace:EV(this)},spans:s.length>NV?s.sort((l,p)=>l.start_timestamp-p.start_timestamp).slice(0,NV):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:He(this)},request:r,...i&&{transaction_info:{source:i}}},c=Bs(this._events);return c&&Object.keys(c).length&&(D&&m.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function IV(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function CV(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function ofe(t){return t instanceof na&&t.isStandaloneSpan()}function sfe(t){let e=G();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Yr(t,e,n=()=>{}){let r;try{r=t()}catch(o){throw e(o),n(),o}return ife(r,e,n)}function ife(t,e,n){return kn(t)?t.then(r=>(n(),r),r=>{throw e(r),n(),r}):(n(),t)}function Su(t,e,n){if(!ct(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=un(o);if(s===void 0)return D&&m.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 D&&m.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||D&&m.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var m_="__SENTRY_SUPPRESS_TRACING__";function Tu(t,e){let n=g_();if(n.startSpan)return n.startSpan(t,e);let r=yV(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return fr(a,()=>bV(s)(()=>{let u=J(),l=vV(u,s),d=t.onlyIfParent&&!l?new Vs:MV({parentSpan:l,spanArguments:r,forceTransaction:o,scope:u});return bs(u,d),Yr(()=>e(d),()=>{let{status:_}=H(d);d.isRecording()&&(!_||_==="ok")&&d.setStatus({code:2,message:"internal_error"})},()=>{d.end()})}))}function h_(t,e){let n=g_();if(n.startSpanManual)return n.startSpanManual(t,e);let r=yV(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return fr(a,()=>bV(s)(()=>{let u=J(),l=vV(u,s),d=t.onlyIfParent&&!l?new Vs:MV({parentSpan:l,spanArguments:r,forceTransaction:o,scope:u});return bs(u,d),Yr(()=>e(d,()=>d.end()),()=>{let{status:_}=H(d);d.isRecording()&&(!_||_==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function mu(t,e){let n=g_();return n.withActiveSpan?n.withActiveSpan(t,e):fr(r=>(bs(r,t||void 0),e(r)))}function ra(t){let e=g_();return e.suppressTracing?e.suppressTracing(t):fr(n=>{n.setSDKProcessingMetadata({[m_]:!0});let r=t();return n.setSDKProcessingMetadata({[m_]:void 0}),r})}function MV({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!ct()){let i=new Vs;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...He(i)};E_(i,a)}return i}let o=ce(),s;if(t&&!n)s=afe(t,r,e),ea(t,s);else if(t){let i=He(t),{traceId:a,spanId:c}=t.spanContext(),u=Tr(t);s=PV({traceId:a,parentSpanId:c,...e},r,u),E_(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:u}={...o.getPropagationContext(),...r.getPropagationContext()};s=PV({traceId:i,parentSpanId:c,...e},r,u),a&&E_(s,a)}return Eu(s),cu(s,r,o),s}function yV(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Jt(t.startTime),delete r.startTime,r}return n}function g_(){let t=Bt();return jn(t)}function PV(t,e,n){let r=G(),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,u=e.getPropagationContext(),[l,p,d]=e.getScopeData().sdkProcessingMetadata[m_]?[!1]:Su(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:un(u.dsc?.sample_rate)},u.sampleRand),_=new na({...t,attributes:{[Qe]:"custom",[$n]:p!==void 0&&d?p:void 0,...c},sampled:l});return!l&&r&&(D&&m.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",_),_}function afe(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[m_]?!1:Tr(t),i=s?new na({...n,parentSpanId:r,traceId:o,sampled:s}):new Vs({traceId:o});ea(t,i);let a=G();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function vV(t,e){if(e)return e;if(e===null)return;let n=Ls(t);if(!n)return;let r=G();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Le(n):n}function bV(t){return t!==void 0?e=>mu(t,e):e=>e()}var Rg=0,LV=1,DV=2;function Xn(t){return new hr(e=>{e(t)})}function A_(t){return new hr((e,n)=>{n(t)})}var hr=class t{constructor(e){this._state=Rg,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===Rg)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===LV&&n[1](this._value),this._state===DV&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===Rg){if(kn(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(LV,s)},o=s=>{n(DV,s)};try{e(r,o)}catch(s){o(s)}}};function R_(t,e,n,r=0){return new hr((o,s)=>{let i=t[r];if(e===null||typeof i!="function")o(e);else{let a=i({...e},n);D&&i.id&&a===null&&m.log(`Event processor "${i.id}" dropped event`),kn(a)?a.then(c=>R_(t,c,n,r+1).then(o)).then(null,s):R_(t,a,n,r+1).then(o).then(null,s)}})}function xV(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;cfe(t,e),r&&pfe(t,r),dfe(t,n),ufe(t,o),lfe(t,s)}function Og(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:p,propagationContext:d,transactionName:_,span:E}=e;O_(t,"extra",n),O_(t,"tags",r),O_(t,"user",o),O_(t,"contexts",s),t.sdkProcessingMetadata=bo(t.sdkProcessingMetadata,a,2),i&&(t.level=i),_&&(t.transactionName=_),E&&(t.span=E),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext={...t.propagationContext,...d}}function O_(t,e,n){t[e]=bo(t[e],n,1)}function cfe(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 ufe(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function lfe(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function pfe(t,e){t.contexts={trace:xo(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:He(e),...t.sdkProcessingMetadata};let n=Le(e),r=H(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function dfe(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}var N_,UV,I_;function wV(t){let e=j._sentryDebugIds;if(!e)return{};let n=Object.keys(e);return I_&&n.length===UV||(UV=n.length,I_=n.reduce((r,o)=>{N_||(N_={});let s=N_[o];if(s)r[s[0]]=s[1];else{let i=t(o);for(let a=i.length-1;a>=0;a--){let u=i[a]?.filename,l=e[o];if(u&&l){r[u]=l,N_[o]=[u,l];break}}}return r},{})),I_}function VV(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||Je(),timestamp:e.timestamp||Fr()},u=n.integrations||t.integrations.map(T=>T.name);_fe(c,t),Sfe(c,u),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Efe(c,t.stackParser);let l=mfe(r,n.captureContext);n.mechanism&&Wi(c,n.mechanism);let p=o?o.getEventProcessors():[],d=s_().getScopeData();if(s){let T=s.getScopeData();Og(d,T)}if(l){let T=l.getScopeData();Og(d,T)}let _=[...n.attachments||[],...d.attachments];_.length&&(n.attachments=_),xV(c,d);let E=[...p,...d.eventProcessors];return R_(E,c,n).then(T=>(T&&ffe(T),typeof i=="number"&&i>0?Tfe(T,i,a):T))}function _fe(t,e){let{environment:n,release:r,dist:o,maxValueLength:s=250}=e;t.environment=t.environment||n||ta,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&(i.url=_r(i.url,s))}function Efe(t,e){let n=wV(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function ffe(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 Sfe(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Tfe(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Wn(o.data,e,n)}}))},...t.user&&{user:Wn(t.user,e,n)},...t.contexts&&{contexts:Wn(t.contexts,e,n)},...t.extra&&{extra:Wn(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Wn(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Wn(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Wn(t.contexts.flags,3,n)),r}function mfe(t,e){if(!e)return t;let n=t?t.clone():new zt;return n.update(e),n}function BV(t){if(t)return hfe(t)?{captureContext:t}:Afe(t)?{captureContext:t}:t}function hfe(t){return t instanceof zt||typeof t=="function"}var gfe=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Afe(t){return Object.keys(t).some(e=>gfe.includes(e))}function Gt(t,e){return J().captureException(t,BV(e))}function C_(t,e){let n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return J().captureMessage(t,n,r)}function P_(t,e){return J().captureEvent(t,e)}function M_(){let t=G();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function y_(t){let e=ce(),n=J(),{userAgent:r}=j.navigator||{},o=nV({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&jr(s,{status:"exited"}),hu(),e.setSession(o),o}function hu(){let t=ce(),n=J().getSession()||t.getSession();n&&rV(n),Rfe(),t.setSession()}function Rfe(){let t=ce(),e=G(),n=t.getSession();n&&e&&e.captureSession(n)}var Ofe="7";function Nfe(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function Ife(t){return`${Nfe(t)}${t.projectId}/envelope/`}function Cfe(t,e){let n={sentry_version:Ofe};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function GV(t,e,n){return e||`${Ife(t)}?${Cfe(t,n)}`}var HV=[];function Pfe(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 Ng(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 Pfe(r)}function kV(t,e){let n={};return e.forEach(r=>{r&&Cg(t,r,n)}),n}function Ig(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Cg(t,e,n){if(n[e.name]){D&&m.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,HV.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),HV.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)}D&&m.log(`Integration installed: ${e.name}`)}function FV(t,e,n){let r=[{type:"client_report"},{timestamp:n||Fr(),discarded_events:t}];return ln(e?{dsn:e}:{},[r])}function v_(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 jV(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?.[Qi],exclusive_time:i?.[Zi],measurements:t.measurements,is_segment:!0}}function $V(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&&{[Qi]:t.profile_id},...t.exclusive_time&&{[Zi]:t.exclusive_time}}}},measurements:t.measurements}}var YV="Not capturing exception because it's already been captured.",qV="Discarded session because of missing or non-string release",XV=Symbol.for("SentryInternalError"),zV=Symbol.for("SentryDoNotSendEventError");function b_(t){return{message:t,[XV]:!0}}function Pg(t){return{message:t,[zV]:!0}}function KV(t){return!!t&&typeof t=="object"&&XV in t}function WV(t){return!!t&&typeof t=="object"&&zV in t}var L_=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=hV(e.dsn):D&&m.warn("No DSN provided, client will not send events."),this._dsn){let n=GV(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:n})}}captureException(e,n,r){let o=Je();if(o_(e))return D&&m.log(YV),o;let s={event_id:o,...n};return this._process(this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r))),s.event_id}captureMessage(e,n,r,o){let s={event_id:Je(),...r},i=qi(e)?e:String(e),a=Ki(e)?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(a.then(c=>this._captureEvent(c,s,o))),s.event_id}captureEvent(e,n,r){let o=Je();if(n?.originalException&&o_(n.originalException))return D&&m.log(YV),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope;return this._process(this._captureEvent(e,s,a||r,c)),s.event_id}captureSession(e){this.sendSession(e),jr(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(o=>r&&o))):Xn(!0)}close(e){return this.flush(e).then(n=>(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];Cg(this,e,this._integrations),n||Ig(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=RV(e,this._dsn,this._options._metadata,this._options.tunnel);for(let s of n.attachments||[])r=mg(r,gg(s));let o=this.sendEnvelope(r);o&&o.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){let{release:n,environment:r=ta}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){D&&m.warn(qV);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){D&&m.warn(qV);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=AV(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}`;D&&m.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]||[];return r.push(n),()=>{let o=r.indexOf(n);o>-1&&r.splice(o,1)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(D&&m.error("Error while sending envelope:",n),n)):(D&&m.error("Transport disabled"),Xn({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=kV(this,e),Ig(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(jr(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new hr(n=>{let r=0,o=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(r+=o,e&&r>=e&&(clearInterval(s),n(!1)))},o)})}_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),VV(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:Ji(r),...a.contexts};let c=$r(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=J(),o=ce()){return D&&Mg(e)&&m.log(`Captured error event \`${v_(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{D&&(WV(s)?m.log(s.message):KV(s)?m.warn(s.message):m.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=JV(e),c=Mg(e),u=e.type||"error",l=`before send for type \`${u}\``,p=typeof i>"u"?void 0:un(i);if(c&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error"),A_(Pg(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let d=u==="replay_event"?"replay":u;return this._prepareEvent(e,n,r,o).then(_=>{if(_===null)throw this.recordDroppedEvent("event_processor",d),Pg("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return _;let S=yfe(this,s,_,n);return Mfe(S,l)}).then(_=>{if(_===null){if(this.recordDroppedEvent("before_send",d),a){let h=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",h)}throw Pg(`${l} returned \`null\`, will not send event.`)}let E=r.getSession()||o.getSession();if(c&&E&&this._updateSessionFromEvent(E,_),a){let T=_.sdkProcessingMetadata?.spanCountBeforeProcessing||0,h=_.spans?_.spans.length:0,R=T-h;R>0&&this.recordDroppedEvent("before_send","span",R)}let S=_.transaction_info;if(a&&S&&_.transaction!==e.transaction){let T="custom";_.transaction_info={...S,source:T}}return this.sendEvent(_,n),_}).then(null,_=>{throw WV(_)||KV(_)?_:(this.captureException(_,{data:{__sentry__:!0},originalException:_}),b_(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
135
|
-
Reason: ${_}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_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(){D&&m.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){D&&m.log("No outcomes to send");return}if(!this._dsn){D&&m.log("No dsn provided, will not send outcomes");return}D&&m.log("Sending outcomes:",e);let n=FV(e,this._options.tunnel&&Kn(this._dsn));this.sendEnvelope(n)}};function Mfe(t,e){let n=`${e} must return \`null\` or a valid event.`;if(kn(t))return t.then(r=>{if(!kr(r)&&r!==null)throw b_(n);return r},r=>{throw b_(`${e} rejected with ${r}`)});if(!kr(t)&&t!==null)throw b_(n);return t}function yfe(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i}=e,a=n;if(Mg(a)&&o)return o(a,r);if(JV(a)){if(i){let c=i(jV(a));if(c?a=bo(n,$V(c)):du(),a.spans){let u=[];for(let l of a.spans){let p=i(l);p?u.push(p):(du(),u.push(l))}a.spans=u}}if(s){if(a.spans){let c=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return s(a,r)}}return a}function Mg(t){return t.type===void 0}function JV(t){return t.type==="transaction"}function QV(t,e){return e?fr(e,()=>{let n=mr(),r=n?xo(n):Ji(e);return[n?He(n):$r(t,e),r]}):[void 0,void 0]}function ZV(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=Kn(o)),e&&(s.trace=e);let i=vfe(t);return ln(s,[i])}function vfe(t){return[{type:"check_in"},t]}function bfe(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function eB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Kn(r)),ln(o,[bfe(t)])}function Gs(t,e){let n=e??Lfe(t)??[];if(n.length===0)return;let r=t.getOptions(),o=eB(n,r._metadata,r.tunnel,t.getDsn());tB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function Lfe(t){return tB().get(t)}function tB(){return Hr("clientToLogBufferMap",()=>new WeakMap)}function nB(t,e){return t(e.stack||"",1)}function yg(t,e){let n={type:e.name||e.constructor.name,value:e.message},r=nB(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Dfe(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function xfe(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=eg(t);if(Yh(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=Ufe(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Ufe(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function wfe(t,e,n,r){if(Co(n))return[n,void 0];if(e.synthetic=!0,kr(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:Sg(n,s)},a=Dfe(n);if(a)return[a,i];let c=xfe(n),u=r?.syntheticException||new Error(c);return u.message=c,[u,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function rB(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=wfe(t,s,n,r),c={exception:{values:[yg(e,i)]}};return a&&(c.extra=a),ng(c,void 0,void 0),Wi(c,s),{...c,event_id:r?.event_id}}function oB(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=nB(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},Wi(s,{synthetic:!0}))}if(qi(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 Vfe=5e3,gu=class extends L_{constructor(e){if(SV(),super(e),this._logWeight=0,this._isLogTimerActive=!1,this._options.enableLogs??this._options._experiments?.enableLogs){let r=this;r.on("flushLogs",()=>{r._logWeight=0,clearTimeout(r._logFlushIdleTimeout),r._isLogTimerActive=!1}),r.on("afterCaptureLog",o=>{r._logWeight+=Bfe(o),r._logWeight>=8e5?Gs(r):r._isLogTimerActive||(r._isLogTimerActive=!0,r._logFlushIdleTimeout=setTimeout(()=>{Gs(r)},Vfe))}),r.on("flush",()=>{Gs(r)})}}eventFromException(e,n){let r=rB(this,this._options.stackParser,e,n);return r.level="error",Xn(r)}eventFromMessage(e,n="info",r){return Xn(oB(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return sB(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&sB(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:Je();if(!this._isEnabled())return D&&m.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,u={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(u.duration=e.duration),n&&(u.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[l,p]=QV(this,r);p&&(u.contexts={trace:p});let d=ZV(u,l,this.getSdkMetadata(),c,this.getDsn());return D&&m.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(d),o}_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)}};function sB(t){let e=ce().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}function Bfe(t){let e=0;return t.message&&(e+=t.message.length*2),t.attributes&&Object.values(t.attributes).forEach(n=>{Array.isArray(n)?e+=n.length*iB(n[0]):Ki(n)?e+=iB(n):e+=100}),e}function iB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}var vg=Symbol.for("SentryBufferFullError");function aB(t){let e=[];function n(){return t===void 0||e.length<t}function r(i){return e.splice(e.indexOf(i),1)[0]||Promise.resolve(void 0)}function o(i){if(!n())return A_(vg);let a=i();return e.indexOf(a)===-1&&e.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function s(i){return new hr((a,c)=>{let u=e.length;if(!u)return a(!0);let l=setTimeout(()=>{i&&i>0&&a(!1)},i);e.forEach(p=>{Xn(p).then(()=>{--u||(clearTimeout(l),a(!0))},c)})})}return{$:e,add:o,drain:s}}function Gfe(t,e=Date.now()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}function Hfe(t,e){return t[e]||t.all||0}function cB(t,e,n=Date.now()){return Hfe(t,e)>n}function uB(t,{statusCode:e,headers:n},r=Date.now()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,u,,,l]=a.split(":",5),p=parseInt(c,10),d=(isNaN(p)?60:p)*1e3;if(!u)o.all=r+d;else for(let _ of u.split(";"))_==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(o[_]=r+d):o[_]=r+d}else i?o.all=r+Gfe(i,r):e===429&&(o.all=r+60*1e3);return o}var kfe=64;function Au(t,e,n=aB(t.bufferSize||kfe)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(f_(i,(p,d)=>{let _=S_(d);cB(r,_)?t.recordDroppedEvent("ratelimit_backoff",_):a.push(p)}),a.length===0)return Xn({});let c=ln(i[0],a),u=p=>{f_(c,(d,_)=>{t.recordDroppedEvent(p,S_(_))})},l=()=>e({body:_u(c)}).then(p=>(p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&D&&m.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),r=uB(r,p),p),p=>{throw u("network_error"),D&&m.error("Encountered error running transport request:",p),p});return n.add(l).then(p=>p,p=>{if(p===vg)return D&&m.error("Skipped sending event because buffer is full."),u("queue_overflow"),Xn({});throw p})}return{send:s,flush:o}}function Hs(t,e,n=[e],r="npm"){let o=t._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${e}`,packages:n.map(s=>({name:`${r}:@sentry/${s}`,version:Ee})),version:Ee}),t._metadata=o}function oa(t={}){let e=t.client||G();if(!M_()||!e)return{};let n=Bt(),r=jn(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||J(),s=t.span||mr(),i=s?d_(s):Ffe(o),a=s?He(s):$r(e,o),c=Ds(a);return c_.test(i)?{"sentry-trace":i,baggage:c}:(m.warn("Invalid sentry-trace data. Cannot generate trace data"),{})}function Ffe(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Do(e,r,n)}function bg(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return u(),r=t(),r}function u(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function l(){return o!==void 0||s!==void 0?c():r}function p(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return p.cancel=u,p.flush=l,p}function lB(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function D_(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=jfe({url:i,host:r,protocol:s}),c=t.body||void 0,u=t.cookies;return{url:a,method:t.method,query_string:pB(i),headers:lB(e),cookies:u,data:c}}function jfe({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}function pB(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var $fe=100;function pn(t,e){let n=G(),r=ce();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=$fe}=n.getOptions();if(s<=0)return;let a={timestamp:Fr(),...t},c=o?be(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var dB,Yfe="FunctionToString",_B=new WeakMap,qfe=(()=>({name:Yfe,setupOnce(){dB=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=Zh(this),n=_B.has(G())&&e!==void 0?e:this;return dB.apply(n,t)}}catch{}},setup(t){_B.set(t,!0)}})),x_=qfe;var Kfe=[/^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. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Wfe="EventFilters",Lg=(t={})=>{let e;return{name:Wfe,setup(n){let r=n.getOptions();e=EB(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=EB(t,s)}return Xfe(n,e)?null:n}}},w_=((t={})=>({...Lg(t),name:"InboundFilters"}));function EB(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Kfe],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Xfe(t,e){if(t.type){if(t.type==="transaction"&&Jfe(t,e.ignoreTransactions))return D&&m.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Url: ${U_(t)}`),!0}return!1}function zfe(t,e){return e?.length?v_(t).some(n=>Mo(n,e)):!1}function Jfe(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Mo(n,e):!1}function Qfe(t,e){if(!e?.length)return!1;let n=U_(t);return n?Mo(n,e):!1}function Zfe(t,e){if(!e?.length)return!0;let n=U_(t);return n?Mo(n,e):!0}function eSe(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 U_(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?eSe(n):null}catch{return D&&m.error(`Cannot extract url for event ${yo(t)}`),null}}function tSe(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function TB(t,e,n,r,o,s){if(!o.exception?.values||!s||!dr(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=Dg(t,e,r,s.originalException,n,o.exception.values,i,0))}function Dg(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(dr(r[o],Error)){fB(i,a);let u=t(e,r[o]),l=c.length;SB(u,o,l,a),c=Dg(t,e,n,r[o],o,[u,...c],u,l)}return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(dr(u,Error)){fB(i,a);let p=t(e,u),d=c.length;SB(p,`errors[${l}]`,d,a),c=Dg(t,e,n,u,o,[p,...c],p,d)}}),c}function fB(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function SB(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var nSe="cause",rSe=5,oSe="LinkedErrors",sSe=((t={})=>{let e=t.limit||rSe,n=t.key||nSe;return{name:oSe,preprocessEvent(r,o,s){let i=s.getOptions();TB(yg,i.stackParser,n,e,r,o)}}}),V_=sSe;function mB(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 xg=["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 hB(t){return xg.map(o=>{let s=t[o],i=Array.isArray(s)?s.join(";"):s;return o==="Forwarded"?iSe(i):i?.split(",").map(a=>a.trim())}).reduce((o,s)=>s?o.concat(s):o,[]).find(o=>o!==null&&aSe(o))||null}function iSe(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function aSe(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 cSe={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},uSe="RequestData",lSe=((t={})=>{let e={...cSe,...t.include};return{name:uSe,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&pSe(n,i,{ipAddress:a},c),n}}}),B_=lSe;function pSe(t,e,n,r){if(t.request={...t.request,...dSe(e,r)},r.ip){let o=e.headers&&hB(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function dSe(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||xg.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?mB(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 gB(t){let e="console";ji(e,t),$i(e,_Se)}function _Se(){"console"in j&&ou.forEach(function(t){t in j.console&&Qh(j.console,t,function(e){return Fi[t]=e,function(...n){Yi("console",{args:n,level:t}),Fi[t]?.apply(j.console,n)}})})}function AB(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var ESe=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function fSe(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=ESe.exec(e);return n?n.slice(1):[]}function Ug(t){let e=fSe(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var SSe="Console",G_=(t={})=>{let e=new Set(t.levels||ou);return{name:SSe,setup(n){gB(({args:r,level:o})=>{G()!==n||!e.has(o)||TSe(o,r)})}}};function TSe(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:AB(t),message:RB(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${RB(r)}`:"Assertion failed",n.data.arguments=r}else return;pn(n,{input:e,level:t})}function RB(t){return"util"in j&&typeof j.util.format=="function"?j.util.format(...t):Jh(t," ")}function Uo(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 sa(t){return t.split(/[?#]/,1)[0]}function wo(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}var wg="ai.prompt",OB="ai.response.object",NB="ai.response.text",IB="ai.response.toolCalls",CB="ai.prompt.messages",PB="ai.prompt.tools",gr="ai.model.id",MB="ai.model.provider",yB="ai.response.providerMetadata",vB="ai.telemetry.functionId",bB="ai.usage.completionTokens",LB="ai.usage.promptTokens",Vg="gen_ai.response.model",H_="gen_ai.usage.input_tokens",k_="gen_ai.usage.output_tokens",Bg="ai.toolCall.name",Gg="ai.toolCall.id",DB="ai.toolCall.args",xB="ai.toolCall.result";function UB(t,e){t.setAttribute(ue,e)}function mSe(t){let{data:e,description:n}=H(t);if(!n)return;if(e[Bg]&&e[Gg]&&n==="ai.toolCall"){ASe(t,e);return}let r=e[gr],o=e[MB];typeof r!="string"||typeof o!="string"||!r||!o||RSe(t,n,e)}function hSe(t){if(t.type==="transaction"&&t.spans)for(let e of t.spans)gSe(e);return t}function gSe(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){Cn(e,bB,k_),Cn(e,LB,H_),typeof e[k_]=="number"&&typeof e[H_]=="number"&&(e["gen_ai.usage.total_tokens"]=e[k_]+e[H_]),Cn(e,CB,"gen_ai.request.messages"),Cn(e,NB,"gen_ai.response.text"),Cn(e,IB,"gen_ai.response.tool_calls"),Cn(e,OB,"gen_ai.response.object"),Cn(e,PB,"gen_ai.request.available_tools"),Cn(e,DB,"gen_ai.tool.input"),Cn(e,xB,"gen_ai.tool.output"),OSe(e);for(let r of Object.keys(e))r.startsWith("ai.")&&Cn(e,r,`vercel.${r}`)}}function Cn(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function ASe(t,e){UB(t,"auto.vercelai.otel"),t.setAttribute(W,"gen_ai.execute_tool"),Cn(e,Bg,"gen_ai.tool.name"),Cn(e,Gg,"gen_ai.tool.call.id"),e["gen_ai.tool.type"]||t.setAttribute("gen_ai.tool.type","function");let n=e["gen_ai.tool.name"];n&&t.updateName(`execute_tool ${n}`)}function RSe(t,e,n){UB(t,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[vB];if(o&&typeof o=="string"&&e.split(".").length-1===1&&(t.updateName(`${r} ${o}`),t.setAttribute("gen_ai.function_id",o)),n[wg]&&t.setAttribute("gen_ai.prompt",n[wg]),n[gr]&&!n[Vg]&&t.setAttribute(Vg,n[gr]),t.setAttribute("ai.streaming",e.includes("stream")),e==="ai.generateText"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.generateText.doGenerate"){t.setAttribute(W,"gen_ai.generate_text"),t.updateName(`generate_text ${n[gr]}`);return}if(e==="ai.streamText"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.streamText.doStream"){t.setAttribute(W,"gen_ai.stream_text"),t.updateName(`stream_text ${n[gr]}`);return}if(e==="ai.generateObject"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.generateObject.doGenerate"){t.setAttribute(W,"gen_ai.generate_object"),t.updateName(`generate_object ${n[gr]}`);return}if(e==="ai.streamObject"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.streamObject.doStream"){t.setAttribute(W,"gen_ai.stream_object"),t.updateName(`stream_object ${n[gr]}`);return}if(e==="ai.embed"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.embed.doEmbed"){t.setAttribute(W,"gen_ai.embed"),t.updateName(`embed ${n[gr]}`);return}if(e==="ai.embedMany"){t.setAttribute(W,"gen_ai.invoke_agent");return}if(e==="ai.embedMany.doEmbed"){t.setAttribute(W,"gen_ai.embed_many"),t.updateName(`embed_many ${n[gr]}`);return}if(e.startsWith("ai.stream")){t.setAttribute(W,"ai.run");return}}function F_(t){t.on("spanStart",mSe),t.addEventProcessor(Object.assign(hSe,{id:"VercelAiEventProcessor"}))}function OSe(t){let e=t[yB];if(e)try{let n=JSON.parse(e);n.openai&&(zn(t,"gen_ai.usage.input_tokens.cached",n.openai.cachedPromptTokens),zn(t,"gen_ai.usage.output_tokens.reasoning",n.openai.reasoningTokens),zn(t,"gen_ai.usage.output_tokens.prediction_accepted",n.openai.acceptedPredictionTokens),zn(t,"gen_ai.usage.output_tokens.prediction_rejected",n.openai.rejectedPredictionTokens),zn(t,"gen_ai.conversation.id",n.openai.responseId)),n.anthropic&&(zn(t,"gen_ai.usage.input_tokens.cached",n.anthropic.cacheReadInputTokens),zn(t,"gen_ai.usage.input_tokens.cache_write",n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(zn(t,"gen_ai.usage.input_tokens.cached",n.bedrock.usage.cacheReadInputTokens),zn(t,"gen_ai.usage.input_tokens.cache_write",n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(zn(t,"gen_ai.usage.input_tokens.cached",n.deepseek.promptCacheHitTokens),zn(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function zn(t,e,n){n!=null&&(t[e]=n)}var wB="gen_ai.system",j_="gen_ai.request.model",VB="gen_ai.request.temperature",BB="gen_ai.request.frequency_penalty",GB="gen_ai.request.presence_penalty",HB="gen_ai.request.top_p",Hg="gen_ai.response.finish_reasons",kB="gen_ai.response.model",FB="gen_ai.response.id",jB="gen_ai.usage.input_tokens",$B="gen_ai.usage.output_tokens",YB="gen_ai.usage.total_tokens",qB="gen_ai.operation.name",kg="gen_ai.request.messages",Fg="gen_ai.response.text",KB="openai.response.id",WB="openai.response.model",XB="openai.response.timestamp",zB="openai.usage.completion_tokens",JB="openai.usage.prompt_tokens",jg={CHAT:"chat"};var Vo="OpenAI",QB=["responses.create","chat.completions.create"];function $_(t){return t.includes("chat.completions")?jg.CHAT:t.includes("responses")?jg.CHAT:t.split(".").pop()||"unknown"}function ZB(t){return`gen_ai.${$_(t)}`}function eG(t){return QB.includes(t)}function tG(t,e){return t?`${t}.${e}`:e}function nG(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function rG(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function NSe(t,e){let n={[wB]:"openai",[qB]:$_(e)};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0];n[j_]=r.model??"unknown","temperature"in r&&(n[VB]=r.temperature),"top_p"in r&&(n[HB]=r.top_p),"frequency_penalty"in r&&(n[BB]=r.frequency_penalty),"presence_penalty"in r&&(n[GB]=r.presence_penalty)}else n[j_]="unknown";return n}function oG(t,e,n,r){e!==void 0&&t.setAttributes({[JB]:e,[jB]:e}),n!==void 0&&t.setAttributes({[zB]:n,[$B]:n}),r!==void 0&&t.setAttributes({[YB]:r})}function sG(t,e,n,r){e&&t.setAttributes({[KB]:e,[FB]:e}),n&&t.setAttributes({[WB]:n,[kB]:n}),r&&t.setAttributes({[XB]:new Date(r*1e3).toISOString()})}function ISe(t,e){if(sG(t,e.id,e.model,e.created),e.usage&&oG(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let n=e.choices.map(r=>r.finish_reason).filter(r=>r!==null);n.length>0&&t.setAttributes({[Hg]:JSON.stringify(n)})}}function CSe(t,e){sG(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[Hg]:JSON.stringify([e.status])}),e.usage&&oG(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens)}function PSe(t,e,n){if(!e||typeof e!="object")return;let r=e;if(nG(r)){if(ISe(t,r),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[Fg]:JSON.stringify(o)})}}else rG(r)&&(CSe(t,r),n&&r.output_text&&t.setAttributes({[Fg]:r.output_text}))}function MSe(t,e){"messages"in e&&t.setAttributes({[kg]:JSON.stringify(e.messages)}),"input"in e&&t.setAttributes({[kg]:JSON.stringify(e.input)})}function ySe(){let e=J().getClient(),n=e?.getIntegrationByName(Vo),r=n?!!e?.getOptions().sendDefaultPii:!1;return{recordInputs:n?.options?.recordInputs??r,recordOutputs:n?.options?.recordOutputs??r}}function vSe(t,e,n,r){return async function(...s){let i=r||ySe(),a=NSe(s,e),c=a[j_]||"unknown",u=$_(e);return Tu({name:`${u} ${c}`,op:ZB(e),attributes:a},async l=>{try{i.recordInputs&&s[0]&&typeof s[0]=="object"&&MSe(l,s[0]);let p=await t.apply(n,s);return PSe(l,p,i.recordOutputs),p}catch(p){throw Gt(p),p}})}}function iG(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=tG(e,String(o));return typeof s=="function"&&eG(i)?vSe(s,i,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?iG(s,i,n):s}})}function $g(t,e){return iG(t,"",e)}function Ru(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function cG(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 uG(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return r=>{let o=r.match(n);if(o){let s,i,a,c,u;if(o[1]){a=o[1];let d=a.lastIndexOf(".");if(a[d-1]==="."&&d--,d>0){s=a.slice(0,d),i=a.slice(d+1);let _=s.indexOf(".Module");_>0&&(a=a.slice(_+1),s=s.slice(0,_))}c=void 0}i&&(c=s,u=i),i==="<anonymous>"&&(u=void 0,a=void 0),a===void 0&&(u=u||"?",a=c?`${c}.${u}`:u);let l=o[2]?.startsWith("file://")?o[2].slice(7):o[2],p=o[5]==="native";return l?.match(/\/[A-Z]:/)&&(l=l.slice(1)),!l&&o[5]&&!p&&(l=o[5]),{filename:l?decodeURI(l):void 0,module:t?t(l):void 0,function:a,lineno:aG(o[3]),colno:aG(o[4]),in_app:cG(l||"",p)}}if(r.match(e))return{filename:r}}}function Yg(t){return[90,uG(t)]}function aG(t){return parseInt(t||"",10)||void 0}var Qt=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){this._cache.size>=this._maxSize&&this._cache.delete(this._cache.keys().next().value),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 qg=C(te(),1),Ou={};function V(t,e,n){return n?tTe(t,e,n):eTe(t,e)}function eTe(t,e){return Object.assign(n=>{let r=Ou[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return Ou[t]=o,(0,qg.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function tTe(t,e,n){return Object.assign(r=>{let o=n(r),s=Ou[t];if(s)return s.setConfig(o),s;let i=new e(o);return Ou[t]=i,(0,qg.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Nu(t){let e=!1,n=[];if(!nTe(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 nTe(t){return typeof t._wrap=="function"}var Or=require("node:diagnostics_channel");y();var rW=C(oe(),1),wu=C(te(),1);de();y();y();var Mn=C(oe(),1),Go=C(sR(),1),ER="sentry.parentIsRemote",Na="sentry.graphql.operation";function fR(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function SR(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function fye(t){return typeof t.kind=="number"}function Sye(t){return!!t.status}function LK(t){return!!t.name}function Tye(t){if(!SR(t))return{};let e=t.attributes[aa]||t.attributes[ia],n={url:e,"http.method":t.attributes[ks]||t.attributes[Iu]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=Uo(e);n.url=wo(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function mye(t){return fye(t)?t.kind:dt.INTERNAL}var iR="sentry-trace",aR="baggage",TR="sentry.dsc",mR="sentry.sampled_not_recording",DK="sentry.url",hye="sentry.sample_rand",gye="sentry.sample_rate",xK=Bn("sentry_scopes"),cR=Bn("sentry_fork_isolation_scope"),uR=Bn("sentry_fork_set_scope"),lR=Bn("sentry_fork_set_isolation_scope"),UK="_scopeContext";function Ia(t){return t.getValue(xK)}function wK(t,e){return t.setValue(xK,e)}function Aye(t,e){qe(t,UK,e)}function Du(t){return t[UK]}function Oa(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(mR)==="1":!1;if(e===Tn.SAMPLED)return!0;if(r)return!1;let o=n?n.get(TR):void 0,s=o?Lo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function VK(t,e,n){let r=e[ks]||e[Iu];if(r)return Oye({attributes:e,name:t,kind:n},r);let o=e[Wg],s=typeof e[W]=="string"&&e[W].startsWith("cache.");if(o&&!s)return Rye({attributes:e,name:t});let i=e[Qe]==="custom"?"custom":"route";if(e[Zg])return{...Lu(t,e,"route"),op:"rpc"};if(e[Qg])return{...Lu(t,e,i),op:"message"};let u=e[zg];return u?{...Lu(t,e,i),op:u.toString()}:{op:void 0,description:t,source:"custom"}}function BK(t){let e=SR(t)?t.attributes:{},n=LK(t)?t.name:"<unknown>",r=mye(t);return VK(n,e,r)}function Rye({attributes:t,name:e}){let n=t[Sr];if(typeof n=="string")return{op:"db",description:n,source:t[Qe]||"custom"};if(t[Qe]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Xg];return{op:"db",description:r?r.toString():e,source:"task"}}function Oye({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case dt.CLIENT:o.push("client");break;case dt.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:u}=Iye(n,e);if(!s)return{...Lu(t,n),op:o.join(".")};let l=n[Na],p=`${r} ${s}`,d=l?`${p} (${Nye(l)})`:p,_=u||s==="/"?"route":"url",E={};i&&(E.url=i),a&&(E["http.query"]=a),c&&(E["http.fragment"]=c);let S=e===dt.CLIENT||e===dt.SERVER,h=!`${n[ue]||"manual"}`.startsWith("auto"),R=n[Qe]==="custom",O=n[Sr],N=!R&&O==null&&(S||!h),{description:A,source:M}=N?{description:d,source:_}:Lu(t,n);return{op:o.join("."),description:A,source:M,data:E}}function Nye(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 Iye(t,e){let n=t[Jg],r=t[ia]||t[aa],o=t[Ar],s=typeof r=="string"?Uo(r):void 0,i=s?wo(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===dt.SERVER&&typeof n=="string"?{urlPath:sa(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:sa(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function Lu(t,e,n="custom"){let r=e[Qe]||n,o=e[Sr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function GK(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=H(n).data[Qe],{description:i}=LK(n)?BK(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),ct()){let a=Oa(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function HK(){return K.getActiveSpan()}var Rr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function kK({dsc:t,sampled:e}){let n=t?Ds(t):void 0,r=new Mn.TraceState,o=n?r.set(TR,n):r;return e===!1?o.set(mR,"1"):o}var FK=new Set;function jK(){return Array.from(FK)}function kE(t){FK.add(t)}var BE=class extends Mn.W3CBaggagePropagator{constructor(){super(),kE("SentryPropagator"),this._urlMatchesTargetsMap=new Qt(100)}inject(e,n,r){if((0,Mn.isTracingSuppressed)(e)){Rr&&m.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=K.getSpan(e),s=o&&Mye(o),i=G()?.getOptions()?.tracePropagationTargets;if(!xu(s,i,this._urlMatchesTargetsMap)){Rr&&m.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let a=Pye(n),c=xt.getBaggage(e)||xt.createBaggage({}),{dynamicSamplingContext:u,traceId:l,spanId:p,sampled:d}=$K(e);if(a){let _=xs(a);_&&Object.entries(_).forEach(([E,S])=>{c=c.setEntry(E,{value:S})})}u&&(c=Object.entries(u).reduce((_,[E,S])=>S?_.setEntry(`${uu}${E}`,{value:S}):_,c)),l&&l!==As&&r.set(n,iR,Do(l,p,d)),super.inject(xt.setBaggage(e,c),n,r)}extract(e,n,r){let o=r.get(n,iR),s=r.get(n,aR),i=o?Array.isArray(o)?o[0]:o:void 0;return qK(YK(e,{sentryTrace:i,baggage:s}))}fields(){return[iR,aR]}},MK="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function xu(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return Rr&&!r&&m.log(MK,t),r;let o=Mo(t,e);return n?.set(t,o),Rr&&!o&&m.log(MK,t),o}function $K(t,e={}){let n=K.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:He(n),traceId:a.traceId,spanId:void 0,sampled:Oa(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:He(n),traceId:a.traceId,spanId:a.spanId,sampled:Oa(a)}}let r=e.scope||Ia(t)?.scope||J(),o=e.client||G(),s=r.getPropagationContext();return{dynamicSamplingContext:o?$r(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function YK(t,{sentryTrace:e,baggage:n}){let r=lu(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r;if(!s)return t;let c=yye({traceId:o,spanId:s,sampled:i,dsc:a});return K.setSpanContext(t,c)}function Cye(t,e,n){let r=qK(YK(t,e));return k.with(r,n)}function qK(t){let e=Ia(t),n={scope:e?e.scope:J().clone(),isolationScope:e?e.isolationScope:ce()};return wK(t,n)}function Pye(t){try{let e=t[aR];return Array.isArray(e)?e.join(","):e}catch{return}}function Mye(t){let e=H(t).data,n=e[ia]||e[aa];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(DK);if(r)return r}function yye({spanId:t,traceId:e,sampled:n,dsc:r}){let o=kK({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Tn.SAMPLED:Tn.NONE,traceState:o}}function vye(t,e){let n=hR(),{name:r,parentSpan:o}=t;return RR(o)(()=>{let i=AR(t.scope,t.forceTransaction),c=t.onlyIfParent&&!K.getSpan(i)?(0,Mn.suppressTracing)(i):i,u=gR(t);return n.startActiveSpan(r,u,c,l=>Yr(()=>e(l),()=>{H(l).status===void 0&&l.setStatus({code:Se.ERROR})},()=>l.end()))})}function bye(t,e){let n=hR(),{name:r,parentSpan:o}=t;return RR(o)(()=>{let i=AR(t.scope,t.forceTransaction),c=t.onlyIfParent&&!K.getSpan(i)?(0,Mn.suppressTracing)(i):i,u=gR(t);return n.startActiveSpan(r,u,c,l=>Yr(()=>e(l,()=>l.end()),()=>{H(l).status===void 0&&l.setStatus({code:Se.ERROR})}))})}function Lye(t){let e=hR(),{name:n,parentSpan:r}=t;return RR(r)(()=>{let s=AR(t.scope,t.forceTransaction),a=t.onlyIfParent&&!K.getSpan(s)?(0,Mn.suppressTracing)(s):s,c=gR(t);return e.startSpan(n,c,a)})}function KK(t,e){let n=t?K.setSpan(k.active(),t):K.deleteSpan(k.active());return k.with(n,()=>e(J()))}function hR(){return G()?.tracer||K.getTracer("@sentry/opentelemetry",Ee)}function gR(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?Dye(e):e;return{attributes:o?{[W]:o,...n}:n,kind:r,links:s,startTime:i}}function Dye(t){return t<9999999999?t*1e3:t}function AR(t,e){let n=xye(t),r=K.getSpan(n);if(!r||!e)return n;let o=K.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=Oa(r.spanContext()),c=Le(r),u=He(c),l=kK({dsc:u,sampled:a}),p={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Tn.SAMPLED:Tn.NONE,traceState:l};return K.setSpanContext(o,p)}function xye(t){if(t){let e=Du(t);if(e)return e}return k.active()}function Uye(t,e){return Cye(k.active(),t,e)}function WK(t,e){let n=Du(e),r=n&&K.getSpan(n),o=r?xo(r):Ji(e);return[r?He(r):$r(t,e),o]}function RR(t){return t!==void 0?e=>KK(t,e):e=>e()}function wye(t){let e=(0,Mn.suppressTracing)(k.active());return k.with(e,t)}function XK(t){t.on("preprocessEvent",e=>{let n=HK();if(!n||e.type==="transaction")return;e.contexts={trace:xo(n),...e.contexts};let r=Le(n);return e.sdkProcessingMetadata={dynamicSamplingContext:He(r),...e.sdkProcessingMetadata},e})}function Vye({span:t,scope:e,client:n}={}){let r=(e&&Du(e))??k.active();if(t){let{scope:c}=Yn(t);r=c&&Du(c)||K.setSpan(k.active(),t)}let{traceId:o,spanId:s,sampled:i,dynamicSamplingContext:a}=$K(r,{scope:e,client:n});return{"sentry-trace":Do(o,s,i),baggage:Ds(a)}}function zK(){function t(){let a=k.active(),c=Ia(a);return c||{scope:Xi(),isolationScope:Er()}}function e(a){let c=k.active();return k.with(c,()=>a(s()))}function n(a,c){let u=Du(a)||k.active();return k.with(u.setValue(uR,a),()=>c(a))}function r(a){let c=k.active();return k.with(c.setValue(cR,!0),()=>a(i()))}function o(a,c){let u=k.active();return k.with(u.setValue(lR,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}ig({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:vye,startSpanManual:bye,startInactiveSpan:Lye,getActiveSpan:HK,suppressTracing:wye,getTraceData:Vye,continueTrace:Uye,withActiveSpan:KK})}function JK(t){class e extends t{constructor(...r){super(...r),kE("SentryContextManager")}with(r,o,s,...i){let a=Ia(r),c=a?.scope||J(),u=a?.isolationScope||ce(),l=r.getValue(cR)===!0,p=r.getValue(uR),d=r.getValue(lR),_=p||c.clone(),E=d||(l?u.clone():u),h=wK(r,{scope:_,isolationScope:E}).deleteValue(cR).deleteValue(uR).deleteValue(lR);return Aye(_,h),super.with(h,o,s,...i)}}return e}function Bye(t){let e=new Map;for(let n of t)Gye(e,n);return Array.from(e,function([n,r]){return r})}function QK(t){return t.attributes[ER]===!0?void 0:fR(t)}function Gye(t,e){let n=e.spanContext().spanId,r=QK(e);if(!r){pR(t,{id:n,span:e,children:[]});return}let o=Hye(t,r),s=pR(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function Hye(t,e){let n=t.get(e);return n||pR(t,{id:e,children:[]})}function pR(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 ZK={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"},kye=t=>Object.values(ZK).includes(t);function eW(t){let e=SR(t)?t.attributes:{},n=Sye(t)?t.status:void 0;if(n){if(n.code===Se.OK)return{code:1};if(n.code===Se.ERROR){if(typeof n.message>"u"){let o=yK(e);if(o)return o}return n.message&&kye(n.message)?{code:2,message:n.message}:{code:2,message:"unknown_error"}}}let r=yK(e);return r||(n?.code===Se.UNSET?{code:1}:{code:2,message:"unknown_error"})}function yK(t){let e=t[Bo]||t[Y_],n=t[eA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return i_(r);if(typeof n=="string")return{code:2,message:ZK[n]||"unknown_error"}}var vK=1e3,bK=300,dR=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||bK,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Date.now()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=bg(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Date.now()/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&&Rr&&m.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=QK(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;Rr&&m.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Date.now()+bK*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=Bye(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=jye(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let l=a.contexts?.trace?.data;l&&(l["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let l of s.children)_R(l,c,r);a.spans=c.length>vK?c.sort((l,p)=>l.start_timestamp-p.start_timestamp).slice(0,vK):c;let u=Bs(i.events);u&&(a.measurements=u),P_(a)}return r}_flushSentSpanCache(){let e=Date.now();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 Fye(t){let e=t.attributes,n=e[ue],r=e[W],o=e[Qe];return{origin:n,op:r,source:o}}function jye(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=tW(t),i=Yn(t),a=t.attributes[$n],c={[Qe]:s,[$n]:a,[W]:e,[ue]:o,...r,...nW(t.attributes)},{links:u}=t,{traceId:l,spanId:p}=t.spanContext(),d=fR(t),_=eW(t),E={parent_span_id:d,span_id:p,trace_id:l,data:c,origin:o,op:e,status:ws(_),links:Us(u)},S=c[Bo],T=typeof S=="number"?{response:{status_code:S}}:void 0;return{contexts:{trace:E,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Jt(t.startTime),timestamp:Jt(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:He(t)},...s&&{transaction_info:{source:s}}}}function _R(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(O=>{_R(O,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=fR(r),{attributes:c,startTime:u,endTime:l,links:p}=r,{op:d,description:_,data:E,origin:S="manual"}=tW(r),T={[ue]:S,[W]:d,...nW(c),...E},h=eW(r),R={span_id:s,trace_id:i,data:T,description:_,parent_span_id:a,start_timestamp:Jt(u),timestamp:Jt(l)||void 0,status:ws(h),op:d,origin:S,measurements:Bs(r.events),links:Us(p)};e.push(R),t.children.forEach(O=>{_R(O,e,n)})}function tW(t){let{op:e,source:n,origin:r}=Fye(t),{op:o,description:s,source:i,data:a}=BK(t),c=e||o,u=n||i,l={...a,...$ye(t)};return{op:c,description:s,source:u,origin:r,data:l}}function nW(t){let e={...t};return delete e[$n],delete e[ER],delete e[Sr],e}function $ye(t){let e=t.attributes,n={};t.kind!==dt.INTERNAL&&(n["otel.kind"]=dt[t.kind]);let r=e[Y_];r&&(n[Bo]=r);let o=Tye(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 Yye(t,e){let n=K.getSpan(e),r=Ia(e);n&&!n.spanContext().isRemote&&ea(n,t),n?.spanContext().isRemote&&t.setAttribute(ER,!0),e===mi&&(r={scope:Xi(),isolationScope:Er()}),r&&cu(t,r.scope,r.isolationScope),Eu(t),G()?.emit("spanStart",t)}function qye(t){fu(t),G()?.emit("spanEnd",t)}var GE=class{constructor(e){kE("SentrySpanProcessor"),this._exporter=new dR(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){Yye(e,n)}onEnd(e){qye(e),this._exporter.export(e)}},HE=class{constructor(e){this._client=e,kE("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=Xye(e),u=c?.spanContext();if(!ct(a))return Ra({decision:void 0,context:e,spanAttributes:s});let l=s[Iu]||s[ks];if(o===dt.CLIENT&&l&&(!c||u?.isRemote))return Ra({decision:void 0,context:e,spanAttributes:s});let p=c?Kye(c,n,r):void 0;if(!(!c||u?.isRemote))return Ra({decision:p?Go.SamplingDecision.RECORD_AND_SAMPLED:Go.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:_,data:E,op:S}=VK(r,s,o),T={...E,...s};S&&(T[W]=S);let h={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:_,parentSampled:p,parentContext:u},h),!h.decision)return Ra({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=Ia(e)??{},O=u?.traceState?u.traceState.get(TR):void 0,N=O?Lo(O):void 0,A=un(N?.sample_rand)??Math.random(),[M,v,X]=Su(a,{name:_,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:p,parentSampleRate:un(N?.sample_rate)},A),q=`${l}`.toUpperCase();return q==="OPTIONS"||q==="HEAD"?(Rr&&m.log(`[Tracing] Not sampling span because HTTP method is '${q}' for ${r}`),Ra({decision:Go.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:A,downstreamTraceSampleRate:0})):(!M&&p===void 0&&(Rr&&m.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...Ra({decision:M?Go.SamplingDecision.RECORD_AND_SAMPLED:Go.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:A,downstreamTraceSampleRate:X?v:void 0}),attributes:{[$n]:X?v:void 0}})}toString(){return"SentrySampler"}};function Kye(t,e,n){let r=t.spanContext();if(Gr(r)&&r.traceId===e){if(r.isRemote){let s=Oa(t.spanContext());return Rr&&m.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=Oa(r);return Rr&&m.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function Ra({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=Wye(e,n);return o!==void 0&&(s=s.set(gye,`${o}`)),r!==void 0&&(s=s.set(hye,`${r}`)),t==null?{decision:Go.SamplingDecision.NOT_RECORD,traceState:s}:t===Go.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(mR,"1")}:{decision:t,traceState:s}}function Wye(t,e){let o=K.getSpan(t)?.spanContext()?.traceState||new Mn.TraceState,s=e[ia]||e[aa];return s&&typeof s=="string"&&(o=o.set(DK,s)),o}function Xye(t){let e=K.getSpan(t);return e&&Gr(e.spanContext())?e:void 0}var ee=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Uu(t,e){if(!t)return e;let n=xs(t),r=xs(e);if(!r)return t;let o={...n};return Object.entries(r).forEach(([s,i])=>{o[s]||(o[s]=i)}),a_(o)}function Ca(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 Zt="@sentry/instrumentation-http",zye=1024*1024,Ws=class extends wu.InstrumentationBase{constructor(e={}){super(Zt,Ee,e),this._propagationDecisionMap=new Qt(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=(c=>{let u=c;this._patchServerEmitOnce(u.server)}),r=(c=>{let u=c;this._onOutgoingRequestFinish(u.request,u.response)}),o=(c=>{let u=c;this._onOutgoingRequestFinish(u.request,void 0)}),s=(c=>{let u=c;this._onOutgoingRequestCreated(u.request)}),i=c=>(e||(e=!0,(0,Or.subscribe)("http.server.request.start",n),(0,Or.subscribe)("http.client.response.finish",r),(0,Or.subscribe)("http.client.request.error",o),this.getConfig().propagateTraceInOutgoingRequests&&(0,Or.subscribe)("http.client.request.created",s)),c),a=()=>{(0,Or.unsubscribe)("http.server.request.start",n),(0,Or.unsubscribe)("http.client.response.finish",r),(0,Or.unsubscribe)("http.client.request.error",o),(0,Or.unsubscribe)("http.client.request.created",s)};return[new wu.InstrumentationNodeModuleDefinition("http",["*"],i,a),new wu.InstrumentationNodeModuleDefinition("https",["*"],i,a)]}_onOutgoingRequestFinish(e,n){ee&&m.log(Zt,"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&&Jye(e,n)}_onOutgoingRequestCreated(e){let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=Ca(e),o=G()?.getOptions().tracePropagationTargets,s=xu(r,o,this._propagationDecisionMap)?oa():void 0;if(!s)return;let{"sentry-trace":i,baggage:a}=s;if(i&&!e.getHeader("sentry-trace"))try{e.setHeader("sentry-trace",i),ee&&m.log(Zt,"Added sentry-trace header to outgoing request")}catch(c){ee&&m.error(Zt,"Failed to add sentry-trace header to outgoing request:",Co(c)?c.message:"Unknown error")}if(a){let c=Uu(e.getHeader("baggage"),a);if(c)try{e.setHeader("baggage",c),ee&&m.log(Zt,"Added baggage header to outgoing request")}catch(u){ee&&m.error(Zt,"Failed to add baggage header to outgoing request:",Co(u)?u.message:"Unknown error")}}}_patchServerEmitOnce(e){let n=e.emit;if(n.__sentry_patched__)return;ee&&m.log(Zt,"Patching server.emit");let r=this,{ignoreIncomingRequestBody:o,maxIncomingRequestBodySize:s="medium"}=r.getConfig(),i=new Proxy(n,{apply(a,c,u){if(u[0]!=="request")return a.apply(c,u);ee&&m.log(Zt,"Handling incoming request");let l=ce().clone(),p=u[1],d=u[2],_=D_(p),E=p.ip||p.socket?.remoteAddress,S=p.url||"/";!o?.(S,p)&&s!=="none"&&Zye(p,l,s),l.setSDKProcessingMetadata({normalizedRequest:_,ipAddress:E});let T=(p.method||"GET").toUpperCase(),h=sa(S),R=`${T} ${h}`;return l.setTransactionName(R),r.getConfig().trackIncomingRequestsAsSessions!==!1&&tve({requestIsolationScope:l,response:d,sessionFlushingDelayMS:r.getConfig().sessionFlushingDelayMS??6e4}),au(l,()=>{if(J().getPropagationContext().propagationSpanId=cn(),!r.getConfig().extractIncomingTraceFromHeader)return a.apply(c,u);let O=xt.extract(k.active(),_.headers);return k.with(O,()=>a.apply(c,u))})}});qe(i,"__sentry_patched__",!0),e.emit=i}_shouldIgnoreOutgoingRequest(e){if((0,rW.isTracingSuppressed)(k.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=eve(e),o=Ca(e);return n(o,r)}};function Jye(t,e){let n=Qye(t),r=e?.statusCode,o=Ru(r);pn({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Qye(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=Uo(n.toString()),o={url:wo(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 Zye(t,e,n){let r=0,o=[];ee&&m.log(Zt,"Patching request.on");let s=new WeakMap,i=n==="small"?1e3:n==="medium"?1e4:zye;try{t.on=new Proxy(t.on,{apply:(a,c,u)=>{let[l,p,...d]=u;if(l==="data"){ee&&m.log(Zt,`Handling request.on("data") with maximum body size of ${i}b`);let _=new Proxy(p,{apply:(E,S,T)=>{try{let h=T[0],R=Buffer.from(h);r<i?(o.push(R),r+=R.byteLength):ee&&m.log(Zt,`Dropping request body chunk because maximum body length of ${i}b is exceeded.`)}catch{ee&&m.error(Zt,"Encountered error while storing body chunk.")}return Reflect.apply(E,S,T)}});return s.set(p,_),Reflect.apply(a,c,[l,_,...d])}return Reflect.apply(a,c,u)}}),t.off=new Proxy(t.off,{apply:(a,c,u)=>{let[,l]=u,p=s.get(l);if(p){s.delete(l);let d=u.slice();return d[1]=p,Reflect.apply(a,c,d)}return Reflect.apply(a,c,u)}}),t.on("end",()=>{try{let a=Buffer.concat(o).toString("utf-8");if(a){let u=Buffer.byteLength(a,"utf-8")>i?`${Buffer.from(a).subarray(0,i-3).toString("utf-8")}...`:a;e.setSDKProcessingMetadata({normalizedRequest:{data:u}})}}catch(a){ee&&m.error(Zt,"Error building captured request body",a)}})}catch(a){ee&&m.error(Zt,"Error patching request to capture body",a)}}function eve(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function tve({requestIsolationScope:t,response:e,sessionFlushingDelayMS:n}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),e.once("close",()=>{let r=G(),o=t.getScopeData().sdkProcessingMetadata.requestSession;if(r&&o){ee&&m.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=OR.get(r),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{ee&&m.log("Opened new request session aggregate.");let u={[i]:c};OR.set(r,u);let l=()=>{clearTimeout(d),p(),OR.delete(r);let _=Object.entries(u).map(([E,S])=>({started:E,exited:S.exited,errored:S.errored,crashed:S.crashed}));r.sendSession({aggregates:_})},p=r.on("flush",()=>{ee&&m.log("Sending request session aggregate due to client flush"),l()}),d=setTimeout(()=>{ee&&m.log("Sending request session aggregate due to flushing schedule"),l()},n).unref()}}})}var OR=new Map;var oW="Http",nve=V(`${oW}.sentry`,t=>new Ws(t)),sW=(t={})=>{let e=t.dropSpansForIncomingRequestStatusCodes??[[401,404],[300,399]];return{name:oW,setupOnce(){nve({...t,extractIncomingTraceFromHeader:!0,propagateTraceInOutgoingRequests:!0})},processEvent(n){if(n.type==="transaction"){let r=n.contexts?.trace?.data?.["http.response.status_code"];if(typeof r=="number"&&e.some(o=>{if(typeof o=="number")return o===r;let[s,i]=o;return r>=s&&r<=i}))return null}return n}}};y();var cW=C(oe(),1),uW=C(te(),1);var Pa=C(require("diagnostics_channel"),1);var Xs=rg(process.versions.node),Vu=Xs.major,iW=Xs.minor;var FE="sentry-trace",NR="baggage",aW=/baggage: (.*)\r\n/,zs=class extends uW.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",Ee,e),this._channelSubs=[],this._propagationDecisionMap=new Qt(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}){if(!(this.getConfig().enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,o),o)return;let s=IR(e.origin,e.path),i=G()?.getOptions().tracePropagationTargets,a=xu(s,i,this._propagationDecisionMap)?oa():void 0;if(!a)return;let{"sentry-trace":c,baggage:u}=a;if(Array.isArray(e.headers)){let l=e.headers;c&&!l.includes(FE)&&l.push(FE,c);let p=l.findIndex(d=>d===NR);if(u&&p===-1)l.push(NR,u);else if(u){let d=l[p+1],_=Uu(d,u);_&&(l[p+1]=_)}}else{let l=e.headers;c&&!l.includes(`${FE}:`)&&(e.headers+=`${FE}: ${c}\r
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
`))}}}_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&&rve(e,n)}_subscribeToChannel(e,n){let r=Vu>18||Vu===18&&iW>=19,o;if(r)Pa.subscribe?.(e,n),o=()=>Pa.unsubscribe?.(e,n);else{let s=Pa.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,cW.isTracingSuppressed)(k.active()))return!0;let n=IR(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};function rve(t,e){let n=ove(t),r=e.statusCode,o=Ru(r);pn({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function ove(t){try{let e=IR(t.origin,t.path),n=Uo(e),r={url:wo(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 IR(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.slice(1)}`:`${n}${e}`}}var sve="NodeFetch",ive=V(`${sve}.sentry`,zs,t=>t),ave=((t={})=>({name:"NodeFetch",setupOnce(){ive(t)}})),lW=ave;var dW=require("node:child_process"),jE=require("node:fs"),ut=C(require("node:os"),1),_W=require("node:path"),CR=require("node:util");var cve=(0,CR.promisify)(jE.readFile),uve=(0,CR.promisify)(jE.readdir),lve="Context",pve=((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=dve(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 _ve()),n.app&&(s.app=fve()),n.device&&(s.device=Sve(n.device)),n.culture){let i=Eve();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Rve()),s}return{name:lve,processEvent(s){return r(s)}}}),EW=pve;function dve(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=ut.freemem()),t}async function _ve(){let t=ut.platform();switch(t){case"darwin":return gve();case"linux":return Ave();default:return{name:Tve[t]||t,version:ut.release()}}}function Eve(){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 fve(){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 Sve(t){let e={},n;try{n=ut.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=ut.arch(),(t===!0||t.memory)&&(e.memory_size=ut.totalmem(),e.free_memory=ut.freemem()),t===!0||t.cpu){let r=ut.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var Tve={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows"},mve=[{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"]}],hve={alpine:t=>t,arch:t=>Nr(/distrib_release=(.*)/,t),centos:t=>Nr(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>Nr(/release (..)/,t),mint:t=>Nr(/distrib_release=(.*)/,t),red:t=>Nr(/release ([^ ]+)/,t),suse:t=>Nr(/VERSION = (.*)\n/,t),ubuntu:t=>Nr(/distrib_release=(.*)/,t)};function Nr(t,e){let n=t.exec(e);return n?n[1]:void 0}async function gve(){let t={kernel_version:ut.release(),name:"Mac OS X",version:`10.${Number(ut.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{(0,dW.execFile)("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=Nr(/^ProductName:\s+(.*)$/m,e),t.version=Nr(/^ProductVersion:\s+(.*)$/m,e),t.build=Nr(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function pW(t){return t.split(" ")[0].toLowerCase()}async function Ave(){let t={kernel_version:ut.release(),name:"Linux"};try{let e=await uve("/etc"),n=mve.find(a=>e.includes(a.name));if(!n)return t;let r=(0,_W.join)("/etc",n.name),o=(await cve(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(pW(a))>=0)||s[0];let i=pW(t.name);t.version=hve[i]?.(o)}catch{}return t}function Rve(){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}var TW=require("node:fs"),mW=require("node:readline");var PR=new Qt(10),hW=new Qt(20),Ove=7,Nve="ContextLines",Ive=1e3,Cve=1e4;function Pve(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function Mve(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function yve(t){return t.lineno!==void 0&&t.lineno>Cve||t.colno!==void 0&&t.colno>Ive}function vve(t,e){let n=PR.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 bve(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=SW(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=SW(i,e)),n++}return s}function Lve(t,e,n){return new Promise((r,o)=>{let s=(0,TW.createReadStream)(t),i=(0,mW.createInterface)({input:s});function a(){s.destroy(),r()}let c=0,u=0,l=e[u];if(l===void 0){a();return}let p=l[0],d=l[1];function _(E){hW.set(t,1),ee&&m.error(`Failed to read file: ${t}. Error: ${E}`),i.close(),i.removeAllListeners(),a()}s.on("error",_),i.on("error",_),i.on("close",a),i.on("line",E=>{if(c++,!(c<p)&&(n[c]=zh(E,0),c>=d)){if(u===e.length-1){i.close(),i.removeAllListeners();return}u++;let S=e[u];if(S===void 0){i.close(),i.removeAllListeners();return}p=S[0],d=S[1]}})})}async function Dve(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"||Mve(c)||yve(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(hW.get(s))continue;let i=n[s];if(!i)continue;i.sort((u,l)=>u-l);let a=bve(i,e);if(a.every(u=>vve(s,u)))continue;let c=Pve(PR,s,{});o.push(Lve(s,a,c))}if(await Promise.all(o).catch(()=>{ee&&m.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&&xve(s.stacktrace.frames,e,PR);return t}function xve(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;Uve(r.lineno,r,e,o)}}function fW(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Uve(t,e,n,r){if(e.lineno===void 0||r===void 0){ee&&m.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=gW(t,n);s<t;s++){let i=r[s];if(i===void 0){fW(e),ee&&m.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){fW(e),ee&&m.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=AW(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 gW(t,e){return Math.max(1,t-e)}function AW(t,e){return t+e}function SW(t,e){return[gW(t,e),AW(t,e)]}var wve=((t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Ove;return{name:Nve,processEvent(n){return Dve(n,e)}}}),RW=wve;var CW=require("node:worker_threads");var $E;async function YE(){if($E===void 0)try{$E=!!(await import("node:inspector")).url()}catch{$E=!1}return $E}var Bu="__SENTRY_ERROR_LOCAL_VARIABLES__";function NW(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 OW(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function qE(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||OW(t)&&OW(e)}var Vve="LyohIEBzZW50cnkvbm9kZS1jb3JlIDkuNDcuMSAoNDExZTEwMikgfCBodHRwczovL2dpdGh1Yi5jb20vZ2V0c2VudHJ5L3NlbnRyeS1qYXZhc2NyaXB0ICovCmltcG9ydHtTZXNzaW9uIGFzIGV9ZnJvbSJub2RlOmluc3BlY3Rvci9wcm9taXNlcyI7aW1wb3J0e3dvcmtlckRhdGEgYXMgdH1mcm9tIm5vZGU6d29ya2VyX3RocmVhZHMiO2NvbnN0IG49Z2xvYmFsVGhpcyxpPXt9O2NvbnN0IG89Il9fU0VOVFJZX0VSUk9SX0xPQ0FMX1ZBUklBQkxFU19fIjtjb25zdCBhPXQ7ZnVuY3Rpb24gcyguLi5lKXthLmRlYnVnJiZmdW5jdGlvbihlKXtpZighKCJjb25zb2xlImluIG4pKXJldHVybiBlKCk7Y29uc3QgdD1uLmNvbnNvbGUsbz17fSxhPU9iamVjdC5rZXlzKGkpO2EuZm9yRWFjaChlPT57Y29uc3Qgbj1pW2VdO29bZV09dFtlXSx0W2VdPW59KTt0cnl7cmV0dXJuIGUoKX1maW5hbGx5e2EuZm9yRWFjaChlPT57dFtlXT1vW2VdfSl9fSgoKT0+Y29uc29sZS5sb2coIltMb2NhbFZhcmlhYmxlcyBXb3JrZXJdIiwuLi5lKSl9YXN5bmMgZnVuY3Rpb24gYyhlLHQsbixpKXtjb25zdCBvPWF3YWl0IGUucG9zdCgiUnVudGltZS5nZXRQcm9wZXJ0aWVzIix7b2JqZWN0SWQ6dCxvd25Qcm9wZXJ0aWVzOiEwfSk7aVtuXT1vLnJlc3VsdC5maWx0ZXIoZT0+Imxlbmd0aCIhPT1lLm5hbWUmJiFpc05hTihwYXJzZUludChlLm5hbWUsMTApKSkuc29ydCgoZSx0KT0+cGFyc2VJbnQoZS5uYW1lLDEwKS1wYXJzZUludCh0Lm5hbWUsMTApKS5tYXAoZT0+ZS52YWx1ZT8udmFsdWUpfWFzeW5jIGZ1bmN0aW9uIHIoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQubWFwKGU9PltlLm5hbWUsZS52YWx1ZT8udmFsdWVdKS5yZWR1Y2UoKGUsW3Qsbl0pPT4oZVt0XT1uLGUpLHt9KX1mdW5jdGlvbiB1KGUsdCl7ZS52YWx1ZSYmKCJ2YWx1ZSJpbiBlLnZhbHVlP3ZvaWQgMD09PWUudmFsdWUudmFsdWV8fG51bGw9PT1lLnZhbHVlLnZhbHVlP3RbZS5uYW1lXT1gPCR7ZS52YWx1ZS52YWx1ZX0+YDp0W2UubmFtZV09ZS52YWx1ZS52YWx1ZToiZGVzY3JpcHRpb24iaW4gZS52YWx1ZSYmImZ1bmN0aW9uIiE9PWUudmFsdWUudHlwZT90W2UubmFtZV09YDwke2UudmFsdWUuZGVzY3JpcHRpb259PmA6InVuZGVmaW5lZCI9PT1lLnZhbHVlLnR5cGUmJih0W2UubmFtZV09Ijx1bmRlZmluZWQ+IikpfWFzeW5jIGZ1bmN0aW9uIGwoZSx0KXtjb25zdCBuPWF3YWl0IGUucG9zdCgiUnVudGltZS5nZXRQcm9wZXJ0aWVzIix7b2JqZWN0SWQ6dCxvd25Qcm9wZXJ0aWVzOiEwfSksaT17fTtmb3IoY29uc3QgdCBvZiBuLnJlc3VsdClpZih0LnZhbHVlPy5vYmplY3RJZCYmIkFycmF5Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgYyhlLG4sdC5uYW1lLGkpfWVsc2UgaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJPYmplY3QiPT09dC52YWx1ZS5jbGFzc05hbWUpe2NvbnN0IG49dC52YWx1ZS5vYmplY3RJZDthd2FpdCByKGUsbix0Lm5hbWUsaSl9ZWxzZSB0LnZhbHVlJiZ1KHQsaSk7cmV0dXJuIGl9bGV0IGY7KGFzeW5jIGZ1bmN0aW9uKCl7Y29uc3QgdD1uZXcgZTt0LmNvbm5lY3RUb01haW5UaHJlYWQoKSxzKCJDb25uZWN0ZWQgdG8gbWFpbiB0aHJlYWQiKTtsZXQgbj0hMTt0Lm9uKCJEZWJ1Z2dlci5yZXN1bWVkIiwoKT0+e249ITF9KSx0Lm9uKCJEZWJ1Z2dlci5wYXVzZWQiLGU9PntuPSEwLGFzeW5jIGZ1bmN0aW9uKGUse3JlYXNvbjp0LGRhdGE6e29iamVjdElkOm59LGNhbGxGcmFtZXM6aX0pe2lmKCJleGNlcHRpb24iIT09dCYmInByb21pc2VSZWplY3Rpb24iIT09dClyZXR1cm47aWYoZj8uKCksbnVsbD09bilyZXR1cm47Y29uc3QgYT1bXTtmb3IobGV0IHQ9MDt0PGkubGVuZ3RoO3QrKyl7Y29uc3R7c2NvcGVDaGFpbjpuLGZ1bmN0aW9uTmFtZTpvLHRoaXM6c309aVt0XSxjPW4uZmluZChlPT4ibG9jYWwiPT09ZS50eXBlKSxyPSJnbG9iYWwiIT09cy5jbGFzc05hbWUmJnMuY2xhc3NOYW1lP2Ake3MuY2xhc3NOYW1lfS4ke299YDpvO2lmKHZvaWQgMD09PWM/Lm9iamVjdC5vYmplY3RJZClhW3RdPXtmdW5jdGlvbjpyfTtlbHNle2NvbnN0IG49YXdhaXQgbChlLGMub2JqZWN0Lm9iamVjdElkKTthW3RdPXtmdW5jdGlvbjpyLHZhcnM6bn19fWF3YWl0IGUucG9zdCgiUnVudGltZS5jYWxsRnVuY3Rpb25PbiIse2Z1bmN0aW9uRGVjbGFyYXRpb246YGZ1bmN0aW9uKCkgeyB0aGlzLiR7b30gPSB0aGlzLiR7b30gfHwgJHtKU09OLnN0cmluZ2lmeShhKX07IH1gLHNpbGVudDohMCxvYmplY3RJZDpufSksYXdhaXQgZS5wb3N0KCJSdW50aW1lLnJlbGVhc2VPYmplY3QiLHtvYmplY3RJZDpufSl9KHQsZS5wYXJhbXMpLnRoZW4oYXN5bmMoKT0+e24mJmF3YWl0IHQucG9zdCgiRGVidWdnZXIucmVzdW1lIil9LGFzeW5jIGU9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSl9KSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLmVuYWJsZSIpO2NvbnN0IGk9ITEhPT1hLmNhcHR1cmVBbGxFeGNlcHRpb25zO2lmKGF3YWl0IHQucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZTppPyJhbGwiOiJ1bmNhdWdodCJ9KSxpKXtjb25zdCBlPWEubWF4RXhjZXB0aW9uc1BlclNlY29uZHx8NTA7Zj1mdW5jdGlvbihlLHQsbil7bGV0IGk9MCxvPTUsYT0wO3JldHVybiBzZXRJbnRlcnZhbCgoKT0+ezA9PT1hP2k+ZSYmKG8qPTIsbihvKSxvPjg2NDAwJiYobz04NjQwMCksYT1vKTooYS09MSwwPT09YSYmdCgpKSxpPTB9LDFlMykudW5yZWYoKSwoKT0+e2krPTF9fShlLGFzeW5jKCk9PntzKCJSYXRlLWxpbWl0IGxpZnRlZC4iKSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6ImFsbCJ9KX0sYXN5bmMgZT0+e3MoYFJhdGUtbGltaXQgZXhjZWVkZWQuIERpc2FibGluZyBjYXB0dXJpbmcgb2YgY2F1Z2h0IGV4Y2VwdGlvbnMgZm9yICR7ZX0gc2Vjb25kcy5gKSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6InVuY2F1Z2h0In0pfSl9fSkoKS5jYXRjaChlPT57cygiRmFpbGVkIHRvIHN0YXJ0IGRlYnVnZ2VyIixlKX0pLHNldEludGVydmFsKCgpPT57fSwxZTQpOw==";function IW(...t){m.log("[LocalVariables]",...t)}var PW=((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 u=a.length-c-1,l=i[c],p=a[u];if(!p||!l)break;l.vars===void 0||p.in_app===!1||!qE(p.function,l.function)||(p.vars=l.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&Bu in i.originalException&&Array.isArray(i.originalException[Bu])){for(let a of s.exception?.values||[])e(a,i.originalException[Bu]);i.originalException[Bu]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new CW.Worker(new URL(`data:application/javascript;base64,${Vve}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{IW("Worker error",a)}),i.once("exit",a=>{IW("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await YE()){m.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:m.isEnabled()};r().then(()=>{try{o(a)}catch(c){m.error("Failed to start worker",c)}},c=>{m.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}});function MW(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function Bve(t,e){if(e!==void 0)return MW(t(e,1))}function yW(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 MR=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}=yW(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)}},Gve="LocalVariables",Hve=((t={},e)=>{let n=new Qt(20),r,o=!1;function s(a){let c=MW(a.stacktrace?.frames);if(c===void 0)return;let u=n.remove(c);if(u===void 0)return;let l=(a.stacktrace?.frames||[]).filter(p=>p.function!=="new Promise");for(let p=0;p<l.length;p++){let d=l.length-p-1,_=u[p],E=l[d];if(!E||!_)break;_.vars===void 0||E.in_app===!1||!qE(E.function,_.function)||(E.vars=_.vars)}}function i(a){for(let c of a.exception?.values||[])s(c);return a}return{name:Gve,async setupOnce(){let c=G()?.getOptions();if(!c?.includeLocalVariables)return;if(Vu<18){m.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await YE()){m.warn("Local variables capture has been disabled because the debugger was already enabled");return}MR.create(e).then(l=>{function p(_,{params:{reason:E,data:S,callFrames:T}},h){if(E!=="exception"&&E!=="promiseRejection"){h();return}r?.();let R=Bve(_,S.description);if(R==null){h();return}let{add:O,next:N}=yW(A=>{n.set(R,A),h()});for(let A=0;A<Math.min(T.length,5);A++){let{scopeChain:M,functionName:v,this:X}=T[A],q=M.find(w=>w.type==="local"),Ue=X.className==="global"||!X.className?v:`${X.className}.${v}`;if(q?.object.objectId===void 0)O(w=>{w[A]={function:Ue},N(w)});else{let w=q.object.objectId;O(Q=>l.getLocalVariables(w,Re=>{Q[A]={function:Ue,vars:Re},N(Q)}))}}N([])}let d=t.captureAllExceptions!==!1;if(l.configureAndConnect((_,E)=>p(c.stackParser,_,E),d),d){let _=t.maxExceptionsPerSecond||50;r=NW(_,()=>{m.log("Local variables rate-limit lifted."),l.setPauseOnExceptions(!0)},E=>{m.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${E} seconds.`),l.setPauseOnExceptions(!1)})}o=!0},l=>{m.log("The `LocalVariables` integration failed to start.",l)})},processEvent(a){return o?i(a):a},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),vW=Hve;var bW=(t={})=>Xs.major<19?vW(t):PW(t);var Gu=require("node:fs"),Hu=require("node:path");function Ma(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var yR,kve="Modules",Fve=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,jve=(()=>({name:kve,processEvent(t){return t.modules={...t.modules,...LW()},t},getModules:LW})),DW=jve;function $ve(){try{return require.cache?Object.keys(require.cache):[]}catch{return[]}}function Yve(){return{...Fve,...Wve(),...Ma()?qve():{}}}function qve(){let t=require.main?.paths||[],e=$ve(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=(0,Hu.dirname)(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=(0,Hu.join)(a,"package.json");if(r.add(a),!(0,Gu.existsSync)(c))return i();try{let u=JSON.parse((0,Gu.readFileSync)(c,"utf8"));n[u.name]=u.version}catch{}};i()}),n}function LW(){return yR||(yR=Yve()),yR}function Kve(){try{let t=(0,Hu.join)(process.cwd(),"package.json");return JSON.parse((0,Gu.readFileSync)(t,"utf8"))}catch{return{}}}function Wve(){let t=Kve();return{...t.dependencies,...t.devDependencies}}var Xve=2e3;function ku(t){be(()=>{console.error(t)});let e=G();if(e===void 0){ee&&m.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:Xve;e.close(r).then(o=>{o||ee&&m.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{ee&&m.error(o)})}var zve="OnUncaughtException",xW=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:zve,setup(n){global.process.on("uncaughtException",Jve(n,e))}}};function Jve(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let u=ku;e.onFatalError?u=e.onFatalError:a.onFatalError&&(u=a.onFatalError);let p=global.process.listeners("uncaughtException").filter(_=>_.name!=="domainUncaughtExceptionClear"&&_.tag!=="sentry_tracingErrorCallback"&&_._errorHandler!==!0).length===0,d=e.exitEvenIfOtherHandlersAreRegistered||p;r?d&&(s?(ee&&m.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),ku(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,u(i,c))},2e3))):(i=c,r=!0,G()===t&&Gt(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"onuncaughtexception"}}),!s&&d&&(s=!0,u(c)))},{_errorHandler:!0})}var Qve="OnUnhandledRejection",Zve=((t={})=>{let e={mode:"warn",...t};return{name:Qve,setup(n){global.process.on("unhandledRejection",ebe(n,e))}}}),UW=Zve;function ebe(t,e){return function(r,o){if(G()!==t)return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>mu(i,c):c=>c())(()=>{Gt(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"onunhandledrejection"}})}),tbe(r,e.mode)}}function tbe(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"?be(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(be(()=>{console.warn(n)}),ku(t))}var wW=C(require("node:http"),1);var vR="Spotlight",nbe=((t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:vR,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&m.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}rbe(n,e)}}}),VW=nbe;function rbe(t,e){let n=obe(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){m.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=_u(o);ra(()=>{let i=wW.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++,m.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function obe(t){try{return new URL(`${t}`)}catch{m.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}var BW=C(require("node:util"),1);var sbe="NodeSystemError";function ibe(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:BW.getSystemErrorMap().has(t.errno)}var GW=(t={})=>({name:sbe,processEvent:(e,n,r)=>{if(!ibe(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}});var bR=C(require("node:diagnostics_channel"),1);var abe="ChildProcess",HW=(t={})=>({name:abe,setup(){bR.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&cbe(e.process,t)}),bR.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&ube(e.worker,t)})}});function cbe(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&&pn({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,pn({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function ube(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?Gt(r,{mechanism:{type:"instrument",handled:!1,data:{threadId:String(n)}}}):pn({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}var $W=C(jW(),1);var wR=JK($W.AsyncLocalStorageContextManager);y();function VR(){an.disable(),an.setLogger({error:m.error,warn:m.warn,info:m.log,debug:m.log,verbose:m.log},ze.DEBUG)}var gbe="ProcessSession",YW=()=>({name:gbe,setupOnce(){y_(),process.on("beforeExit",()=>{ce().getSession()?.status!=="ok"&&hu()})}});var Rbe=C(require("node:http"),1),Obe=C(require("node:https"),1),WW=require("node:stream"),XW=require("node:zlib");var zr=C(require("node:net"),1),GR=C(require("node:tls"),1);var BR=C(require("node:http"),1);var Ir=Symbol("AgentBaseInternalState"),zE=class extends BR.Agent{constructor(e){super(e),this[Ir]={}}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(`
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
`);if(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
`);let{connect:u,buffered:l}=await c;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200){if(e.once("socket",Abe),n.secureEndpoint){Fu("Upgrading socket connection to TLS");let d=n.servername||n.host;return GR.connect({...KW(n,"host","path","port"),socket:o,servername:zr.isIP(d)?void 0:d})}return o}o.destroy();let p=new zr.Socket({writable:!1});return p.readable=!0,e.once("socket",d=>{Fu("Replaying proxy buffer for failed request"),d.push(l),d.push(null)}),p}};ju.__initStatic();function Abe(t){t.resume()}function KW(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Nbe=1024*32;function Ibe(t){return new WW.Readable({read(){this.push(t),this.push(null)}})}function zW(t){let e;try{e=new URL(t.url)}catch{return be(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),Au(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Cbe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Obe:Rbe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new ju(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=Pbe(t,t.httpModule??o,i);return Au(t,a)}function Cbe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function Pbe(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(u){return new Promise((l,p)=>{ra(()=>{let d=Ibe(u.body),_={...t.headers};u.body.length>Nbe&&(_["content-encoding"]="gzip",d=d.pipe((0,XW.createGzip)()));let E=e.request({method:"POST",agent:n,headers:_,hostname:r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},S=>{S.on("data",()=>{}),S.on("end",()=>{}),S.setEncoding("utf8");let T=S.headers["retry-after"]??null,h=S.headers["x-sentry-rate-limits"]??null;l({statusCode:S.statusCode,headers:{"retry-after":T,"x-sentry-rate-limits":Array.isArray(h)?h[0]||null:h}})});E.on("error",p),d.pipe(E)})})}}var Mbe=new Set(["false","f","n","no","off","0"]),ybe=new Set(["true","t","y","yes","on","1"]);function QE(t,e){let n=String(t).toLowerCase();return Mbe.has(n)?!1:ybe.has(n)?!0:e?.strict?null:!!t}var ZE=require("node:path");function JW(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function QW(t=process.argv[1]?Ug(process.argv[1]):process.cwd(),e=ZE.sep==="\\"){let n=e?JW(t):t;return r=>{if(!r)return;let o=e?JW(r):r,{dir:s,base:i,ext:a}=ZE.posix.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let u=s.lastIndexOf("/node_modules");if(u>-1)return`${s.slice(u+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let l=s.slice(n.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function ZW(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_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 e2=e_(Yg(QW()));var t2=C(require("node:os"),1);y();var n2=C(te(),1);var tf=require("worker_threads");var vbe=6e4,ef=class extends gu{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||t2.hostname(),r={...e,platform:"node",runtime:{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,n2.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Hs(r,"node"),m.log(`Initializing Sentry: process: ${process.pid}, thread: ${tf.isMainThread?"main":`worker-${tf.threadId}`}.`),super(r);let{enableLogs:o,_experiments:s}=this.getOptions();(o??s?.enableLogs)&&(this._logOnExitFlushListener=()=>{Gs(this)},n&&this.on("beforeCaptureLog",a=>{a.attributes={...a.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=Ee,r=K.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}close(e){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener),super.close(e)}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{ee&&m.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??vbe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_getTraceInfoFromScope(e){return e?WK(this,e):[void 0,void 0]}};var r2=C($d(),1),o2=C(require("module"),1),bbe={};function s2(){let[t=0,e=0]=process.versions.node.split(".").map(Number);if(t>=21||t===20&&e>=6||t===18&&e>=19){if(!j._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:n}=(0,r2.createAddHookMessageChannel)();o2.default.register("import-in-the-middle/hook.mjs",bbe.url,{data:{addHookMessagePort:n,include:[]},transferList:[n]})}catch(n){m.warn("Failed to register ESM hook",n)}}else be(()=>{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.`)})}function nf(){return[w_(),x_(),V_(),B_(),GW(),G_(),sW(),lW(),xW(),UW(),RW(),bW(),EW(),HW(),YW(),DW()]}function HR(t={}){return Lbe(t,nf)}function Lbe(t={},e){let n=Dbe(t,e);n.debug===!0&&(ee?m.enable():be(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),!Ma()&&n.registerEsmLoaderHooks!==!1&&s2(),zK(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===vR)&&n.integrations.push(VW({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Hs(n,"node-core");let o=new ef(n);return J().setClient(o),o.init(),m.log(`Running in ${Ma()?"CommonJS":"ESM"} mode.`),o.startClientReportTracking(),wbe(),GK(o),XK(o),o}function kR(){if(!ee)return;let t=jK(),e=["SentryContextManager","SentryPropagator"];ct()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||m.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||m.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 Dbe(t,e){let n=xbe(t.release),r=t.spotlight??QE(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,o=Ube(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??zW,stackParser:Fh(t.stackParser||e2),release:n,tracesSampleRate:o,spotlight:r,debug:QE(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:Ng({defaultIntegrations:a,integrations:i})}}function xbe(t){if(t!==void 0)return t;let e=ZW();if(e!==void 0)return e}function Ube(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 wbe(){if(QE(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=lu(t,e);J().setPropagationContext(n)}}function me(t,e){t.setAttribute(ue,e)}var FR="Http",i2="@opentelemetry_sentry-patched/instrumentation-http",Vbe=V(`${FR}.sentry`,t=>new Ws(t)),Bbe=V(FR,t=>{let e=new a2.HttpInstrumentation(t);try{e._diag=an.createComponentLogger({namespace:i2}),e.instrumentationName=i2}catch{}return e});function Gbe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!ct(e)&&Xs.major>=22)}var c2=(t={})=>{let e=t.dropSpansForIncomingRequestStatusCodes??[[401,404],[300,399]];return{name:FR,setupOnce(){let n=Gbe(t,G()?.getOptions());if(Vbe({...t,extractIncomingTraceFromHeader:!n,propagateTraceInOutgoingRequests:!n}),n){let r=Fbe(t);Bbe(r)}},processEvent(n){if(n.type==="transaction"){let r=n.contexts?.trace?.data?.["http.response.status_code"];if(typeof r=="number"&&e.some(o=>{if(typeof o=="number")return o===r;let[s,i]=o;return r>=s&&r<=i}))return null}return n}}};function Hbe(t){return"outputData"in t&&"outputSize"in t&&!("client"in t)&&!("statusCode"in t)}function kbe(t){return t.headers["next-router-prefetch"]==="1"}function Fbe(t={}){return{...t.instrumentation?._experimentalConfig,disableIncomingRequestInstrumentation:t.disableIncomingRequestSpans,ignoreOutgoingRequestHook:n=>{let r=Ca(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},ignoreIncomingRequestHook:n=>{let r=n.url,o=n.method?.toUpperCase();if(o==="OPTIONS"||o==="HEAD")return!0;let s=t.ignoreIncomingRequests;return!!(r&&s?.(r,n))},requireParentforOutgoingSpans:!1,requireParentforIncomingSpans:!1,requestHook:(n,r)=>{me(n,"auto.http.otel.http"),!Hbe(r)&&kbe(r)&&n.setAttribute("sentry.http.prefetch",!0),t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var T2=C(S2(),1);var m2="NodeFetch",Ybe=V(m2,T2.UndiciInstrumentation,t=>zbe(t)),qbe=V(`${m2}.sentry`,zs,t=>t),Kbe=((t={})=>({name:"NodeFetch",setupOnce(){Xbe(t,G()?.getOptions())&&Ybe(t),qbe(t)}})),h2=Kbe;function Wbe(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e.slice(1)}`:`${n}${e}`}function Xbe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&ct(e)}function zbe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=Wbe(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:()=>({[ue]:"auto.http.otel.node_fetch"})}}var w2=C(v2(),1);var Pr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;y();var _f=C(oe(),1),Mr=C(te(),1);de();var yn;(function(t){let e="express.type";t.EXPRESS_TYPE=e;let n="express.name";t.EXPRESS_NAME=n})(yn||(yn={}));var Jr;(function(t){let e="router";t.ROUTER=e;let n="middleware";t.MIDDLEWARE=n;let r="request_handler";t.REQUEST_HANDLER=r})(Jr||(Jr={}));var WR=Symbol("express-layer-patched"),Fo="__ot_middlewares";var L2=(t,e)=>{Array.isArray(t[Fo])===!1&&Object.defineProperty(t,Fo,{enumerable:!1,value:[]}),e!==void 0&&t[Fo].push(e)},D2=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?D2(t,n):t},x2=(t,e,n)=>{if(e.name==="router"){let r=D2("",e),o=r||n||t||"/";return{attributes:{[yn.EXPRESS_NAME]:o,[yn.EXPRESS_TYPE]:Jr.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[yn.EXPRESS_NAME]:(t||n)??"request handler",[yn.EXPRESS_TYPE]:Jr.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[yn.EXPRESS_NAME]:e.name,[yn.EXPRESS_TYPE]:Jr.MIDDLEWARE},name:`middleware - ${e.name}`}},cLe=(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")},U2=(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(cLe(t,r))return!0}catch{}return!1},XR=t=>t instanceof Error?[t,t.message]:[String(t),String(t)],pf=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>b2(n)||"").join(","):b2(e)},b2=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};var uLe="0.1.0",lLe="@sentry/instrumentation-express-v5",df=class extends Mr.InstrumentationBase{constructor(e={}){super(lLe,uLe,e)}init(){return[new Mr.InstrumentationNodeModuleDefinition("express",[">=5.0.0"],e=>this._setup(e),e=>this._tearDown(e))]}_setup(e){let n=e.Router.prototype;return(0,Mr.isWrapped)(n.route)&&this._unwrap(n,"route"),this._wrap(n,"route",this._getRoutePatch()),(0,Mr.isWrapped)(n.use)&&this._unwrap(n,"use"),this._wrap(n,"use",this._getRouterUsePatch()),(0,Mr.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch()),e}_tearDown(e){if(e===void 0)return;let n=e.Router.prototype;this._unwrap(n,"route"),this._unwrap(n,"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,pf(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,pf(o)),s}}}_getAppUsePatch(){let e=this;return function(n){return function(...o){let s=this.router,i=n.apply(this,o);if(s){let a=s.stack[s.stack.length-1];e._applyPatch(a,pf(o))}return i}}}_applyPatch(e,n){let r=this;e[WR]!==!0&&(e[WR]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){L2(i,n);let c=i[Fo].filter(A=>A!=="/"&&A!=="/*").join("").replace(/\/{2,}/g,"/"),u=c.length>0?c:void 0,l={[Cu]:u},p=x2(c,e,n),d=p.attributes[yn.EXPRESS_TYPE],_=(0,_f.getRPCMetadata)(k.active());if(_?.type===_f.RPCType.HTTP&&(_.route=u),U2(p.name,d,r.getConfig()))return d===Jr.MIDDLEWARE&&i[Fo].pop(),o.apply(this,arguments);if(K.getSpan(k.active())===void 0)return o.apply(this,arguments);let E=r._getSpanName({request:i,layerType:d,route:c},p.name),S=r.tracer.startSpan(E,{attributes:Object.assign(l,p.attributes)}),{requestHook:T}=r.getConfig();T&&(0,Mr.safeExecuteInTheMiddle)(()=>T(S,{request:i,layerType:d,route:c}),A=>{A&&an.error("express instrumentation: request hook failed",A)},!0);let h=!1;p.attributes[yn.EXPRESS_TYPE]!==Jr.MIDDLEWARE&&(S.end(),h=!0);let R=()=>{h===!1&&(h=!0,S.end())},O=Array.from(arguments),N=O.findIndex(A=>typeof A=="function");N>=0&&(arguments[N]=function(){let A=arguments[0],M=![void 0,null,"route","router"].includes(A);if(!h&&M){let[X,q]=XR(A);S.recordException(X),S.setStatus({code:Se.ERROR,message:q})}return h===!1&&(h=!0,i.res?.removeListener("finish",R),S.end()),i.route&&M||i[Fo].pop(),O[N].apply(this,arguments)});try{return o.apply(this,arguments)}catch(A){let[M,v]=XR(A);throw S.recordException(M),S.setStatus({code:Se.ERROR,message:v}),A}finally{h||a.once("finish",R)}};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 an.error("express instrumentation: error calling span name rewrite hook",o),n}}};var V2="Express",pLe="Express-V5";function B2(t){me(t,"auto.http.otel.express");let e=H(t).data,n=e["express.type"];n&&t.setAttribute(W,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function G2(t,e){if(ce()===Er())return Pr&&m.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";ce().setTransactionName(`${r} ${t.route}`)}return e}var H2=V(V2,()=>new w2.ExpressInstrumentation({requestHook:t=>B2(t),spanNameHook:(t,e)=>G2(t,e)})),k2=V(pLe,()=>new df({requestHook:t=>B2(t),spanNameHook:(t,e)=>G2(t,e)})),dLe=(()=>({name:V2,setupOnce(){H2(),k2()}})),JR=dLe;var sO=C(require("node:diagnostics_channel"),1);var rO=C(require("node:diagnostics_channel"),1);y();var Tf=C(oe(),1),m4=C(te(),1);de();var u4=C(e4(),1);var zu=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var gLe={"[: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]},Ju=t=>t.replace(/[[\]\\-]/g,"\\$&"),ALe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),t4=t=>t.join(""),n4=(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,u=!1,l=n,p="";e:for(;s<t.length;){let S=t.charAt(s);if((S==="!"||S==="^")&&s===n+1){u=!0,s++;continue}if(S==="]"&&i&&!c){l=s+1;break}if(i=!0,S==="\\"&&!c){c=!0,s++;continue}if(S==="["&&!c){for(let[T,[h,R,O]]of Object.entries(gLe))if(t.startsWith(T,s)){if(p)return["$.",!1,t.length-n,!0];s+=T.length,O?o.push(h):r.push(h),a=a||R;continue e}}if(c=!1,p){S>p?r.push(Ju(p)+"-"+Ju(S)):S===p&&r.push(Ju(S)),p="",s++;continue}if(t.startsWith("-]",s+1)){r.push(Ju(S+"-")),s+=2;continue}if(t.startsWith("-",s+1)){p=S,s+=2;continue}r.push(Ju(S)),s++}if(l<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])&&!u){let S=r[0].length===2?r[0].slice(-1):r[0];return[ALe(S),!1,l-n,!1]}let d="["+(u?"^":"")+t4(r)+"]",_="["+(u?"":"^")+t4(o)+"]";return[r.length&&o.length?"("+d+"|"+_+")":r.length?d:_,a,l-n,!0]};var jo=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var en,RLe=new Set(["!","?","+","*","@"]),eO=t=>RLe.has(t),r4=t=>eO(t.type),OLe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),NLe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),ILe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),o4=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),CLe="(?!(?:^|/)\\.\\.?(?:$|/))",Ef="(?!\\.)",PLe=new Set(["[","."]),MLe=new Set(["..","."]),yLe=new Set("().*{}+?[]^$\\!"),vLe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tO="[^/]",s4=tO+"*?",i4=tO+"+?",Qs=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;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 en&&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 en&&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 en(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,u=-1,l=!1;if(n.type===null){let S=r,T="";for(;S<e.length;){let h=e.charAt(S++);if(a||h==="\\"){a=!a,T+=h;continue}if(c){S===u+1?(h==="^"||h==="!")&&(l=!0):h==="]"&&!(S===u+2&&l)&&(c=!1),T+=h;continue}else if(h==="["){c=!0,u=S,l=!1,T+=h;continue}if(!o.noext&&eO(h)&&e.charAt(S)==="("&&s<=i){n.push(T),T="";let O=new en(h,n);S=en.#p(e,O,S,o,s+1),n.push(O);continue}T+=h}return n.push(T),S}let p=r+1,d=new en(null,n),_=[],E="";for(;p<e.length;){let S=e.charAt(p++);if(a||S==="\\"){a=!a,E+=S;continue}if(c){p===u+1?(S==="^"||S==="!")&&(l=!0):S==="]"&&!(p===u+2&&l)&&(c=!1),E+=S;continue}else if(S==="["){c=!0,u=p,l=!1,E+=S;continue}if(eO(S)&&e.charAt(p)==="("&&(s<=i||n&&n.#d(S))){let h=n&&n.#d(S)?0:1;d.push(E),E="";let R=new en(S,d);d.push(R),p=en.#p(e,R,p,o,s+h);continue}if(S==="|"){d.push(E),E="",_.push(d),d=new en(null,n);continue}if(S===")")return E===""&&n.#e.length===0&&(n.#l=!0),d.push(E),E="",n.push(..._,d),p;E+=S}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],p}#m(e){return this.#E(e,NLe)}#E(e,n=OLe){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=ILe){return!!n.get(this.type)?.includes(e)}#h(e,n){let r=e.#e[0],o=new en(null,r,this.options);o.#e.push(""),r.push(o),this.#f(e,n)}#f(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!!o4.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=o4.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}#_(){if(r4(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.#E(o)?(n=!1,this.#f(o,r)):this.#m(o)?(n=!1,this.#h(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}static fromGlob(e,n={}){let r=new en(null,void 0,n);return en.#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()),!r4(this)){let c=this.isStart()&&this.isEnd(),u=this.#e.map(_=>{let[E,S,T,h]=typeof _=="string"?en.#O(_,this.#r,c):_.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||h,E}).join(""),l="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&MLe.has(this.#e[0]))){let E=PLe,S=n&&E.has(u.charAt(0))||u.startsWith("\\.")&&E.has(u.charAt(2))||u.startsWith("\\.\\.")&&E.has(u.charAt(4)),T=!n&&!e&&E.has(u.charAt(0));l=S?CLe:T?Ef:""}let p="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(p="(?:$|\\/)"),[l+u+p,jo(u),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#S(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#e=[c],u.type=null,u.#r=void 0,[c,jo(this.toString()),!1,!1]}let i=!r||e||n||!Ef?"":this.#S(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?Ef:"")+i4;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?Ef:"")+s4+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,jo(s),this.#r=!!this.#r,this.#o]}#S(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#O(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let u=e.charAt(c);if(o){o=!1,s+=(yLe.has(u)?"\\":"")+u,a=!1;continue}if(u==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(u==="["){let[l,p,d,_]=n4(e,c);if(d){s+=l,i=i||p,c+=d-1,n=n||_,a=!1;continue}}if(u==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?i4:s4,n=!0;continue}else a=!1;if(u==="?"){s+=tO,n=!0;continue}s+=vLe(u)}return[s,jo(e),!!n,i]}};en=Qs;var nO=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var Et=(t,e,n={})=>(zu(e),!n.nocomment&&e.charAt(0)==="#"?!1:new Ua(e,n).match(t)),bLe=/^\*+([^+@!?\*\[\(]*)$/,LLe=t=>e=>!e.startsWith(".")&&e.endsWith(t),DLe=t=>e=>e.endsWith(t),xLe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),ULe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),wLe=/^\*+\.\*+$/,VLe=t=>!t.startsWith(".")&&t.includes("."),BLe=t=>t!=="."&&t!==".."&&t.includes("."),GLe=/^\.\*+$/,HLe=t=>t!=="."&&t!==".."&&t.startsWith("."),kLe=/^\*+$/,FLe=t=>t.length!==0&&!t.startsWith("."),jLe=t=>t.length!==0&&t!=="."&&t!=="..",$Le=/^\?+([^+@!?\*\[\(]*)?$/,YLe=([t,e=""])=>{let n=l4([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},qLe=([t,e=""])=>{let n=p4([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},KLe=([t,e=""])=>{let n=p4([t]);return e?r=>n(r)&&r.endsWith(e):n},WLe=([t,e=""])=>{let n=l4([t]);return e?r=>n(r)&&r.endsWith(e):n},l4=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},p4=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},d4=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",a4={win32:{sep:"\\"},posix:{sep:"/"}},XLe=d4==="win32"?a4.win32.sep:a4.posix.sep;Et.sep=XLe;var yt=Symbol("globstar **");Et.GLOBSTAR=yt;var zLe="[^/]",JLe=zLe+"*?",QLe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ZLe="(?:(?!(?:\\/|^)\\.).)*?",eDe=(t,e={})=>n=>Et(n,t,e);Et.filter=eDe;var vn=(t,e={})=>Object.assign({},t,e),tDe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Et;let e=Et;return Object.assign((r,o,s={})=>e(r,o,vn(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,vn(t,s))}static defaults(o){return e.defaults(vn(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,vn(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,vn(t,s))}},unescape:(r,o={})=>e.unescape(r,vn(t,o)),escape:(r,o={})=>e.escape(r,vn(t,o)),filter:(r,o={})=>e.filter(r,vn(t,o)),defaults:r=>e.defaults(vn(t,r)),makeRe:(r,o={})=>e.makeRe(r,vn(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,vn(t,o)),match:(r,o,s={})=>e.match(r,o,vn(t,s)),sep:e.sep,GLOBSTAR:yt})};Et.defaults=tDe;var _4=(t,e={})=>(zu(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,u4.default)(t));Et.braceExpand=_4;var nDe=(t,e={})=>new Ua(t,e).makeRe();Et.makeRe=nDe;var rDe=(t,e,n={})=>{let r=new Ua(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};Et.match=rDe;var c4=/[?*]|[+@!]\(.*?\)|\[|\]/,oDe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ua=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){zu(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||d4,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!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]==="?"||!c4.test(s[2]))&&!c4.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(l=>this.parse(l))];if(u)return[s[0],...s.slice(1).map(l=>this.parse(l))]}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],u=r[o+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,r.splice(o,1);let l=r.slice(0);l[o]="**",e.push(l),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]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),l=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),p=c?3:a?0:void 0,d=l?3:u?0:void 0;if(typeof p=="number"&&typeof d=="number"){let[_,E]=[e[p],n[d]];_.toLowerCase()===E.toLowerCase()&&(n[d]=_,s=d,o=p)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(yt)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(yt,s),a=n.lastIndexOf(yt),[c,u,l]=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}let p=0;if(l.length){if(l.length+o>e.length)return!1;let R=e.length-l.length;if(this.#o(e,l,r,R,0))p=l.length;else{if(e[e.length-1]!==""||o+l.length===e.length||(R--,!this.#o(e,l,r,R,0)))return!1;p=l.length+1}}if(!u.length){let R=!!p;for(let O=o;O<e.length-p;O++){let N=String(e[O]);if(R=!0,N==="."||N===".."||!this.options.dot&&N.startsWith("."))return!1}return r||R}let d=[[[],0]],_=d[0],E=0,S=[0];for(let R of u)R===yt?(S.push(E),_=[[],0],d.push(_)):(_[0].push(R),E++);let T=d.length-1,h=e.length-p;for(let R of d)R[1]=h-(S[T--]+R[0].length);return!!this.#r(e,d,o,0,r,0,!!p)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let p=r;p<e.length;p++){a=!0;let d=e[p];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[u,l]=c;for(;r<=l;){if(this.#o(e.slice(0,r+u.length),u,s,r,0)&&i<this.maxGlobstarRecursion){let _=this.#r(e,n,r+u.length,o+1,s,i+1,a);if(_!==!1)return _}let d=e[r];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,u;for(i=o,a=s,u=e.length,c=n.length;i<u&&a<c;i++,a++){this.debug("matchOne loop");let l=n[a],p=e[i];if(this.debug(n,l,p),l===!1||l===yt)return!1;let d;if(typeof l=="string"?(d=p===l,this.debug("string match",l,p,d)):(d=l.test(p),this.debug("pattern match",l,p,d)),!d)return!1}if(i===u&&a===c)return!0;if(i===u)return r;if(a===c)return i===u-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return _4(this.pattern,this.options)}parse(e){zu(e);let n=this.options;if(e==="**")return yt;if(e==="")return"";let r,o=null;(r=e.match(kLe))?o=n.dot?jLe:FLe:(r=e.match(bLe))?o=(n.nocase?n.dot?ULe:xLe:n.dot?DLe:LLe)(r[1]):(r=e.match($Le))?o=(n.nocase?n.dot?qLe:YLe:n.dot?KLe:WLe)(r):(r=e.match(wLe))?o=n.dot?BLe:VLe:(r=e.match(GLe))&&(o=HLe);let s=Qs.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?JLe:n.dot?QLe:ZLe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let u=c.map(l=>{if(l instanceof RegExp)for(let p of l.flags.split(""))o.add(p);return typeof l=="string"?oDe(l):l===yt?yt:l._src});return u.forEach((l,p)=>{let d=u[p+1],_=u[p-1];l!==yt||_===yt||(_===void 0?d!==void 0&&d!==yt?u[p+1]="(?:\\/|"+r+"\\/)?"+d:u[p]=r:d===void 0?u[p-1]=_+"(?:\\/|"+r+")?":d!==yt&&(u[p-1]=_+"(?:\\/|\\/"+r+"\\/)"+d,u[p+1]=yt))}),u.filter(l=>l!==yt).join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+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],u=o;if(r.matchBase&&c.length===1&&(u=[i]),this.matchOne(u,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Et.defaults(e).Minimatch}};Et.AST=Qs;Et.Minimatch=Ua;Et.escape=nO;Et.unescape=jo;var E4="@fastify/otel",iDe="0.8.0",aDe=">=4.0.0 <6",f4=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],he={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},$o={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},Qr="anonymous",Ht=Symbol("fastify otel instance"),Yo=Symbol("fastify otel request spans"),Qu=Symbol("fastify otel request context"),S4=Symbol("fastify otel addhook original"),T4=Symbol("fastify otel setnotfound original"),ff=Symbol("fastify otel ignore path"),Sf=class extends m4.InstrumentationBase{constructor(e){if(super(E4,iDe,e),this.servername=e?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[ff]=null,this._logger=an.createComponentLogger({namespace:E4}),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=Et;this[ff]=o=>typeof n=="function"?n(o):r(o.url,n)}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let e=this.plugin();this._handleInitialization=n=>{n.fastify.register(e)},rO.default.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){return this._handleInitialization&&(rO.default.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:aDe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(Ht,e),r.decorate(S4,r.addHook),r.decorate(T4,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let d=this[Qu];return{span:this[Yo],tracer:e.tracer,context:d,inject:(E,S)=>xt.inject(d,E,S),extract:(E,S)=>xt.extract(d,E,S)}}),r.decorateRequest(Yo,null),r.decorateRequest(Qu,null),r.addHook("onRoute",function(p){if(e[ff]?.(p)===!0){e._logger.debug(`Ignoring route instrumentation ${p.method} ${p.url} because it matches the ignore path`);return}for(let d of f4)if(p[d]!=null){let _=p[d];if(typeof _=="function")p[d]=l(_,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - route -> ${d}`,[he.FASTIFY_TYPE]:$o.ROUTE,[Ar]:p.url,[he.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:Qr});else if(Array.isArray(_)){let E=[];for(let S of _)E.push(l(S,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - route -> ${d}`,[he.FASTIFY_TYPE]:$o.ROUTE,[Ar]:p.url,[he.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:Qr}));p[d]=E}}p.onSend!=null?p.onSend=Array.isArray(p.onSend)?[...p.onSend,i]:[p.onSend,i]:p.onSend=i,p.onError!=null?p.onError=Array.isArray(p.onError)?[...p.onError,a]:[p.onError,a]:p.onError=a,p.handler=l(p.handler,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - route-handler`,[he.FASTIFY_TYPE]:$o.HANDLER,[Ar]:p.url,[he.HOOK_CALLBACK_NAME]:p.handler.name.length>0?p.handler.name:Qr})}),r.addHook("onRequest",function(p,d,_){if(this[Ht].isEnabled()===!1)return _();if(this[Ht][ff]?.({url:p.url,method:p.method})===!0)return this[Ht]._logger.debug(`Ignoring request ${p.method} ${p.url} because it matches the ignore path`),_();let E=k.active();K.getSpan(E)==null&&(E=xt.extract(E,p.headers));let S=(0,Tf.getRPCMetadata)(E);p.routeOptions.url!=null&&S?.type===Tf.RPCType.HTTP&&(S.route=p.routeOptions.url);let T=this[Ht].tracer.startSpan("request",{attributes:{[dn]:r[Ht].servername,[he.ROOT]:"@fastify/otel",[Ar]:p.url,[ks]:p.method}},E);p[Qu]=K.setSpan(E,T),p[Yo]=T,k.with(p[Qu],()=>{_()})}),r.addHook("onResponse",function(p,d,_){let E=p[Yo];E!=null&&(E.setStatus({code:Se.OK,message:"OK"}),E.setAttributes({[Bo]:404}),E.end()),p[Yo]=null,_()}),r.addHook=c,r.setNotFoundHandler=u,s();function i(p,d,_,E){let S=p[Yo];S!=null&&(d.statusCode<500&&S.setStatus({code:Se.OK,message:"OK"}),S.setAttributes({[Bo]:d.statusCode}),S.end()),p[Yo]=null,E(null,_)}function a(p,d,_,E){let S=p[Yo];S!=null&&(S.setStatus({code:Se.ERROR,message:_.message}),S.recordException(_)),E()}function c(p,d){let _=this[S4];return f4.includes(p)?_.call(this,p,l(d,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - ${p}`,[he.FASTIFY_TYPE]:$o.INSTANCE,[he.HOOK_CALLBACK_NAME]:d.name?.length>0?d.name:Qr})):_.call(this,p,d)}function u(p,d){let _=this[T4];typeof p=="function"?(d=l(p,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[he.FASTIFY_TYPE]:$o.INSTANCE,[he.HOOK_CALLBACK_NAME]:p.name?.length>0?p.name:Qr}),_.call(this,d)):(p.preValidation!=null&&(p.preValidation=l(p.preValidation,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[he.FASTIFY_TYPE]:$o.INSTANCE,[he.HOOK_CALLBACK_NAME]:p.preValidation.name?.length>0?p.preValidation.name:Qr})),p.preHandler!=null&&(p.preHandler=l(p.preHandler,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[he.FASTIFY_TYPE]:$o.INSTANCE,[he.HOOK_CALLBACK_NAME]:p.preHandler.name?.length>0?p.preHandler.name:Qr})),d=l(d,{[dn]:r[Ht].servername,[he.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[he.FASTIFY_TYPE]:$o.INSTANCE,[he.HOOK_CALLBACK_NAME]:d.name?.length>0?d.name:Qr}),_.call(this,p,d))}function l(p,d={}){return function(...E){let S=this[Ht],[T]=E;if(S.isEnabled()===!1)return p.call(this,...E);let h=T[Qu]??k.active(),R=S.tracer.startSpan(`handler - ${p.name?.length>0?p.name:this.pluginName??Qr}`,{attributes:d},h);return k.with(K.setSpan(h,R),function(){try{let O=p.call(this,...E);return typeof O?.then=="function"?O.then(N=>(R.end(),N),N=>(R.setStatus({code:Se.ERROR,message:N.message}),R.recordException(N),R.end(),Promise.reject(N))):(R.end(),O)}catch(O){throw R.setStatus({code:Se.ERROR,message:O.message}),R.recordException(O),R.end(),O}},this)}}}}};y();var gf=C(oe(),1),Zs=C(te(),1);de();var Zr;(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})(Zr||(Zr={}));var Zu;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Zu||(Zu={}));var el;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(el||(el={}));y();var tl=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function oO(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[tl]||[];return s.push(o),Object.defineProperty(t,tl,{enumerable:!1,configurable:!0,value:s}),o}function mf(t,e){let n=t[tl]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Se.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[tl])}function g4(t,e,n){let r,o;try{o=t(),h4(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!h4(o)&&(e(r,o),r))throw r;return o}}function h4(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var cDe="0.1.0",uDe="@sentry/instrumentation-fastify-v3",A4="anonymous",lDe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),hf=class extends Zs.InstrumentationBase{constructor(e={}){super(uDe,cDe,e)}init(){return[new Zs.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,gf.getRPCMetadata)(k.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===gf.RPCType.HTTP&&(a.route=c);let u=r.method||"GET";ce().setTransactionName(`${u} ${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||A4,c=`${el.MIDDLEWARE} - ${a}`,u=i[1],l=oO(u,s.tracer,c,{[Zr.FASTIFY_TYPE]:Zu.MIDDLEWARE,[Zr.PLUGIN_NAME]:e,[Zr.HOOK_NAME]:n}),p=o&&i[i.length-1];return p&&(i[i.length-1]=function(...d){mf(u),p.apply(this,d)}),k.with(K.setSpan(k.active(),l),()=>g4(()=>r.apply(this,i),d=>{d instanceof Error&&(l.setStatus({code:Se.ERROR,message:d.message}),l.recordException(d)),o||mf(u)}))}}_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(!lDe.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()),pDe(),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,Zs.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),mf(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,u=`${el.REQUEST_HANDLER} - ${c||this.pluginName||A4}`,l={[Zr.PLUGIN_NAME]:this.pluginName,[Zr.FASTIFY_TYPE]:Zu.REQUEST_HANDLER,[Cu]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(l[Zr.FASTIFY_NAME]=c);let p=oO(o,e.tracer,u,l);R4(p);let{requestHook:d}=e.getConfig();return d&&(0,Zs.safeExecuteInTheMiddle)(()=>d(p,{request:r}),_=>{_&&e._diag.error("request hook failed",_)},!0),k.with(K.setSpan(k.active(),p),()=>{s()})}}};function pDe(){let t=G();t&&t.on("spanStart",e=>{R4(e)})}function R4(t){let e=H(t).data,n=e["fastify.type"];if(e[W]||!n)return;t.setAttributes({[ue]:"auto.http.otel.fastify",[W]:`${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 N4="Fastify",dDe="Fastify-V5",_De="Fastify-V3",I4=V(_De,()=>new hf);function EDe(){let t=G();if(t)return t.getIntegrationByName(N4)}function O4(t,e,n,r){let o=EDe()?.getShouldHandleError()||M4;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){Pr&&m.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)&&Gt(t,{mechanism:{handled:!1,type:"fastify"}})}var C4=V(dDe,()=>{let t=new Sf,e=t.plugin();return sO.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?Pr&&m.error("Failed to setup Fastify instrumentation",o):(SDe(),r&&TDe(r))})}),sO.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;O4.call(O4,r,o,s,"diagnostics-channel")}),t}),fDe=(({shouldHandleError:t})=>{let e;return{name:N4,setupOnce(){e=t||M4,I4(),C4()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}}),P4=(t={})=>fDe(t);function M4(t,e,n){let r=n.statusCode;return r>=500||r<=299}function y4(t){let e=H(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[W]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request-handler":"<unknown>";t.setAttributes({[ue]:"auto.http.otel.fastify",[W]:`${c}.fastify`});let u=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof u=="string"){let l=u.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(l)}}function SDe(){let t=G();t&&t.on("spanStart",e=>{y4(e)})}function TDe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&y4(s)}let r=e.routeOptions?.url,o=e.method||"GET";ce().setTransactionName(`${o} ${r}`)})}y();var J4=C(z4(),1);var Q4="Graphql",Z4=V(Q4,J4.GraphQLInstrumentation,t=>{let e=t5(t);return{...e,responseHook(n,r){me(n,"auto.graphql.otel.graphql"),r.errors?.length&&!H(n).status&&n.setStatus({code:Se.ERROR});let s=H(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=Le(n),l=H(c).data[Na]||[],p=a?`${i} ${a}`:`${i}`;Array.isArray(l)?(l.push(p),c.setAttribute(Na,l)):typeof l=="string"?c.setAttribute(Na,[l,p]):c.setAttribute(Na,p),H(c).data["original-description"]||c.setAttribute("original-description",H(c).description),c.updateName(`${H(c).data["original-description"]} (${wDe(l)})`)}}}}),UDe=((t={})=>({name:Q4,setupOnce(){Z4(t5(t))}})),e5=UDe;function t5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function wDe(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 p5=C(l5(),1);var d5="Kafka",_5=V(d5,()=>new p5.KafkaJsInstrumentation({consumerHook(t){me(t,"auto.kafkajs.otel.consumer")},producerHook(t){me(t,"auto.kafkajs.otel.producer")}})),BDe=(()=>({name:d5,setupOnce(){_5()}})),E5=BDe;var A5=C(g5(),1);var R5="LruMemoizer",O5=V(R5,()=>new A5.LruMemoizerInstrumentation),kDe=(()=>({name:R5,setupOnce(){O5()}})),N5=kDe;var D5=C(L5(),1);var x5="Mongo",U5=V(x5,()=>new D5.MongoDBInstrumentation({dbStatementSerializer:YDe,responseHook(t){me(t,"auto.db.otel.mongo")}}));function YDe(t){let e=EO(t);return JSON.stringify(e)}function EO(t){if(Array.isArray(t))return t.map(e=>EO(e));if(qDe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,EO(r)]).reduce((n,r)=>(WDe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function qDe(t){return typeof t=="object"&&t!==null&&!KDe(t)}function KDe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function WDe(t){return Array.isArray(t)}var XDe=(()=>({name:x5,setupOnce(){U5()}})),w5=XDe;var z5=C(X5(),1);var J5="Mongoose",Q5=V(J5,()=>new z5.MongooseInstrumentation({responseHook(t){me(t,"auto.db.otel.mongoose")}})),sxe=(()=>({name:J5,setupOnce(){Q5()}})),Z5=sxe;var lX=C(uX(),1);var pX="Mysql",dX=V(pX,()=>new lX.MySQLInstrumentation({})),fxe=(()=>({name:pX,setupOnce(){dX()}})),_X=fxe;var IX=C(NX(),1);var CX="Mysql2",PX=V(CX,()=>new IX.MySQL2Instrumentation({responseHook(t){me(t,"auto.db.otel.mysql2")}})),Pxe=(()=>({name:CX,setupOnce(){PX()}})),MX=Pxe;var e3=C(BX(),1),t3=C(XX(),1);var Gxe=["get","set","setex"],CO=["get","mget"],Hxe=["set","setex"];function dl(t,e){return t.includes(e.toLowerCase())}function PO(t){return dl(CO,t)?"cache.get":dl(Hxe,t)?"cache.put":void 0}function kxe(t,e){return e.some(n=>t.startsWith(n))}function JX(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)?zX(o.map(s=>n(s))):["<unknown>"],r=e[0];return dl(Gxe,t)&&r!=null?n(r):zX(e.map(o=>n(o)))}catch{return}}function QX(t,e,n){if(!PO(t))return!1;for(let r of e)if(kxe(r,n))return!0;return!1}function ZX(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 zX(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var n3="Redis",MO={},r3=(t,e,n,r)=>{t.setAttribute(ue,"auto.db.otel.redis");let o=JX(e,n),s=PO(e);if(!o||!s||!MO.cachePrefixes||!QX(e,o,MO.cachePrefixes))return;let i=H(t).data["net.peer.name"],a=H(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=ZX(r);c&&t.setAttribute(dg,c),dl(CO,e)&&c!==void 0&&t.setAttribute(lg,c>0),t.setAttributes({[W]:s,[pg]:o});let u=o.join(", ");t.updateName(_r(u,1024))},Fxe=V("IORedis",()=>new e3.IORedisInstrumentation({responseHook:r3})),jxe=V("Redis-4",()=>new t3.RedisInstrumentation({responseHook:r3})),o3=Object.assign(()=>{Fxe(),jxe()},{id:n3}),$xe=((t={})=>({name:n3,setupOnce(){MO=t,o3()}})),s3=$xe;var N3=C(O3(),1);var I3="Postgres",C3=V(I3,()=>new N3.PgInstrumentation({requireParentSpan:!0,requestHook(t){me(t,"auto.db.otel.postgres")}})),sUe=(()=>({name:I3,setupOnce(){C3()}})),P3=sUe;y();var io=C(te(),1);de();var wO="PostgresJs",M3=[">=3.0.0 <4"],y3=V(wO,t=>new UO({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),UO=class extends io.InstrumentationBase{constructor(e){super("sentry-postgres-js",Ee,e)}init(){let e=new io.InstrumentationNodeModuleDefinition("postgres",M3);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new io.InstrumentationNodeModuleFile(`postgres/${n}/connection.js`,["*"],this._patchConnection.bind(this),this._unwrap.bind(this))),e.files.push(new io.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,M3,this._patchQuery.bind(this),this._unwrap.bind(this)))}),[e]}_shouldCreateSpans(){let e=this.getConfig();return K.getSpan(k.active())!==void 0||!e.requireParentSpan}_patchReject(e,n){return new Proxy(e,{apply:(r,o,s)=>{n.setStatus({code:2,message:s?.[0]?.message||"unknown_error"});let i=Reflect.apply(r,o,s);return n.setAttribute(sA,s?.[0]?.code||"Unknown error"),n.setAttribute(aA,s?.[0]?.name||"Unknown error"),n.end(),i}})}_patchResolve(e,n){return new Proxy(e,{apply:(r,o,s)=>{let i=Reflect.apply(r,o,s),a=s?.[0]?.command;return a&&n.setAttribute(rA,a),n.end(),i}})}_patchQuery(e){return e.Query.prototype.handle=new Proxy(e.Query.prototype.handle,{apply:async(n,r,o)=>{if(!this._shouldCreateSpans())return Reflect.apply(n,r,o);let s=this._sanitizeSqlQuery(r.strings?.[0]);return h_({name:s||"postgresjs.query",op:"db"},i=>{let c=J().getScopeData().contexts.postgresjsConnection;me(i,"auto.db.otel.postgres");let{requestHook:u}=this.getConfig();u&&(0,io.safeExecuteInTheMiddle)(()=>u(i,s,c),_=>{_&&m.error(`Error in requestHook for ${wO} integration:`,_)});let l=c?.ATTR_DB_NAMESPACE||"<unknown database>",p=c?.ATTR_SERVER_ADDRESS||"<unknown host>",d=c?.ATTR_SERVER_PORT||"<unknown port>";i.setAttribute(iA,"postgres"),i.setAttribute(nA,l),i.setAttribute(cA,p),i.setAttribute(uA,d),i.setAttribute(oA,s),r.resolve=this._patchResolve(r.resolve,i),r.reject=this._patchReject(r.reject,i);try{return Reflect.apply(n,r,o)}catch(_){throw i.setStatus({code:2}),i.end(),_}})}}),e}_patchConnection(e){return new Proxy(e,{apply:(n,r,o)=>{let s=o[0]?.database||"<unknown database>",i=o[0]?.host?.[0]||"<unknown host>",a=o[0]?.port?.[0]||"<unknown port>";return J().setContext("postgresjsConnection",{ATTR_DB_NAMESPACE:s,ATTR_SERVER_ADDRESS:i,ATTR_SERVER_PORT:a}),Reflect.apply(n,r,o)}})}_sanitizeSqlQuery(e){return e?e.replace(/\s+/g," ").trim().substring(0,1024).replace(/--.*?(\r?\n|$)/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\b\d+\b/g,"?").replace(/\s+/g," ").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/g,"IN (?)"):"Unknown SQL Query"}},iUe=(()=>({name:wO,setupOnce(){y3()}})),v3=iUe;y();var Wf=C(te(),1);y();var aUe=process.env.PRISMA_SHOW_ALL_TRACES==="true",cUe="00-10-10-00";function uUe(t){return t==="client"?dt.CLIENT:dt.INTERNAL}var lUe=class{traceMiddleware;tracerProvider;ignoreSpanTypes;constructor({traceMiddleware:t,tracerProvider:e,ignoreSpanTypes:n}){this.traceMiddleware=t,this.tracerProvider=e,this.ignoreSpanTypes=n}isEnabled(){return!0}getTraceParent(t){let e=K.getSpanContext(t??k.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:cUe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)D3(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return k.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!aUe||t.middleware&&!this.traceMiddleware)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(x3(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return b3(s,e(s,r))}return n.startActiveSpan(o,t,s=>b3(s,e(s,r)))}};function D3(t,e,n,r,o){if(x3(e.name,o))return;let s={attributes:e.attributes,kind:uUe(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 u=r.get(c);return u?{context:{spanId:u,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)D3(t,c,n,r,o);i.end(e.endTime)})}function b3(t,e){return pUe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function pUe(t){return t!=null&&typeof t.then=="function"}function x3(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var U3={name:"@prisma/instrumentation",version:"6.11.1",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:{"@prisma/internals":"workspace:*","@swc/core":"1.11.5","@types/jest":"29.5.14","@types/node":"18.19.76","@opentelemetry/api":"1.9.0",jest:"29.7.0","jest-junit":"16.0.0",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.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:"jest"},sideEffects:!1},BO=U3.version,dUe=BO.split(".")[0],L3="PRISMA_INSTRUMENTATION",VO=`V${dUe}_PRISMA_INSTRUMENTATION`,_Ue=U3.name,EUe="@prisma/client",w3=class extends Wf.InstrumentationBase{tracerProvider;constructor(t={}){super(_Ue,BO,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new Wf.InstrumentationNodeModuleDefinition(EUe,[BO])]}enable(){let t=this._config,e={helper:new lUe({traceMiddleware:t.middleware??!1,tracerProvider:this.tracerProvider??K.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]})};global[L3]=e,global[VO]=e}disable(){delete global[L3],delete global[VO]}isEnabled(){return!!global[VO]}};var V3="Prisma";function fUe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function B3(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var GO=class extends w3{constructor(){super()}enable(){super.enable();let e=B3(),n=!1;fUe(e)&&(e.createEngineSpan=()=>{be(()=>{n||(n=!0,console.warn("[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/"))})})}},SUe=V(V3,t=>t?.prismaInstrumentation?t.prismaInstrumentation:new GO),G3=({prismaInstrumentation:t}={})=>({name:V3,setupOnce(){SUe({prismaInstrumentation:t})},setup(e){B3()&&e.on("spanStart",n=>{let r=H(n);r.description?.startsWith("prisma:")&&n.setAttribute(ue,"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 K3=C(q3(),1);var W3="Hapi",X3=V(W3,()=>new K3.HapiInstrumentation),PUe=(()=>({name:W3,setupOnce(){X3()}})),z3=PUe;var cz=C(az(),1);de();var uz="Koa",lz=V(uz,cz.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){me(e,"auto.http.otel.koa");let r=H(e).data,o=r["koa.type"];o&&e.setAttribute(W,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ce()===Er()){Pr&&m.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Ar],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ce().setTransactionName(`${a} ${i}`)}})),xUe=((t={})=>({name:uz,setupOnce(){lz(t)}})),pz=xUe;var gz=C(hz(),1);var Az="Connect",Rz=V(Az,()=>new gz.ConnectInstrumentation),YUe=(()=>({name:Az,setupOnce(){Rz()}})),Oz=YUe;var Uz=C(xz(),1);var zUe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),wz="Tedious",Vz=V(wz,()=>new Uz.TediousInstrumentation({})),JUe=(()=>{let t;return{name:wz,setupOnce(){let e=Vz();t=Nu(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=H(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";zUe.has(s)&&n.setAttribute(ue,"auto.db.otel.tedious")}))}}}),Bz=JUe;var jz=C(Fz(),1);var $z="GenericPool",Yz=V($z,()=>new jz.GenericPoolInstrumentation({})),e0e=(()=>{let t;return{name:$z,setupOnce(){let e=Yz();t=Nu(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=H(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(ue,"auto.db.otel.generic_pool")}))}}}),qz=e0e;var n8=C(t8(),1);var r8="Amqplib",l0e={consumeEndHook:t=>{me(t,"auto.amqplib.otel.consumer")},publishHook:t=>{me(t,"auto.amqplib.otel.publisher")}},o8=V(r8,()=>new n8.AmqplibInstrumentation(l0e)),p0e=(()=>({name:r8,setupOnce(){o8()}})),s8=p0e;var Rl="VercelAI";var _S=C(te(),1);var i8=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function d0e(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 dS=class t extends _S.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",Ee,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new _S.InstrumentationNodeModuleDefinition("ai",[">=3.0.0 <5"],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=[];function n(r){return(...o)=>{let s=o[0].experimental_telemetry||{},i=s.isEnabled,a=J().getClient(),c=a?.getIntegrationByName(Rl),u=c?.options,l=c?!!a?.getOptions().sendDefaultPii:!1,{recordInputs:p,recordOutputs:d}=d0e(u,s,i,l);return o[0].experimental_telemetry={...s,isEnabled:i!==void 0?i:!0,recordInputs:p,recordOutputs:d},Yr(()=>r.apply(this,o),_=>{_&&typeof _=="object"&&qe(_,"_sentry_active_span",mr())})}}if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i8)e[r]=n(e[r]);return e}else{let r=i8.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}};var a8=V(Rl,()=>new dS({}));function _0e(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var E0e=((t={})=>{let e;return{name:Rl,options:t,setupOnce(){e=a8()},afterAllSetup(n){t.force??_0e(n)?F_(n):e?.callWhenPatched(()=>F_(n))}}}),c8=E0e;var fS=C(te(),1);var f0e=[">=4.0.0 <6"];function S0e(t,e){let n=t?.recordInputs??e,r=t?.recordOutputs??e;return{recordInputs:n,recordOutputs:r}}var ES=class extends fS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",Ee,e)}init(){return new fS.InstrumentationNodeModuleDefinition("openai",f0e,this._patch.bind(this))}_patch(e){let n=e.OpenAI,r=function(...o){let s=Reflect.construct(n,o),i=J().getClient(),c=i?.getIntegrationByName(Vo)?.options,u=!!i?.getOptions().sendDefaultPii,{recordInputs:l,recordOutputs:p}=S0e(c,u);return $g(s,{recordInputs:l,recordOutputs:p})};Object.setPrototypeOf(r,n),Object.setPrototypeOf(r.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(r,o,s)}try{e.OpenAI=r}catch{Object.defineProperty(e,"OpenAI",{value:r,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=r}catch{Object.defineProperty(e,"default",{value:r,writable:!0,configurable:!0,enumerable:!0})}return e}};var u8=V(Vo,()=>new ES({})),T0e=((t={})=>({name:Vo,options:t,setupOnce(){u8()}})),l8=T0e;function p8(){return[JR(),P4(),e5(),w5(),Z5(),_X(),MX(),s3(),P3(),G3(),z3(),pz(),Oz(),Bz(),qz(),E5(),s8(),N5(),c8(),l8(),v3()]}y();var d8=C(JA(),1),_8=C(sR(),1);de();var m0e=C($d(),1);var tN=1e6;function E8(t,e={}){t.getOptions().debug&&VR();let n=h0e(t,e);t.traceProvider=n}function h0e(t,e={}){let n=new _8.BasicTracerProvider({sampler:new HE(t),resource:new d8.Resource({[dn]:"node",[tA]:"sentry",[lA]:Ee}),forceFlushTimeoutMillis:500,spanProcessors:[new GE({timeout:g0e(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});return K.setGlobalTracerProvider(n),xt.setGlobalPropagator(new BE),k.setGlobalContextManager(new wR),n}function g0e(t){if(t!=null){if(t>tN)return Pr&&m.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${tN}`),tN;if(t<=0||Number.isNaN(t)){Pr&&m.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function f8(){return nf().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(c2(),h2())}function S8(t){return[...f8(),...ct(t)?p8():[]]}function nN(t={}){return A0e(t,S8)}function A0e(t={},e){Hs(t,"node");let n=HR({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(E8(n,{spanProcessors:t.openTelemetrySpanProcessors}),kR()),n}function O0e(){let t=process.env.SENTRY_RELEASE?.trim();if(t)return t;let n=(process.env.RAILWAY_GIT_COMMIT_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.GITHUB_SHA||process.env.GIT_COMMIT||"").slice(0,7),r=typeof process.env.npm_package_version=="string"?process.env.npm_package_version:"";if(r&&n)return`${r}+${n}`;if(n)return n;if(r)return r}function m8(){let t=process.env.SENTRY_ENVIRONMENT?.trim();return t||(process.env.NODE_ENV==="production"?"production":"development")}function N0e(){let t=process.env.SENTRY_TRACES_SAMPLE_RATE?.trim();if(t===""||t===void 0)return m8()==="production"?.15:1;let e=Number(t);return!Number.isFinite(e)||e<0?0:Math.min(e,1)}var I0e=new Set(["authorization","cookie","x-admin-key","x-api-key","x-platform-web-secret","proxy-authorization"]);function C0e(t){if(!t||typeof t!="object")return t;let e={};for(let[n,r]of Object.entries(t)){let o=n.toLowerCase();e[n]=I0e.has(o)?"[Filtered]":r}return e}function P0e(t){let e=t.request;if(!e)return;e.headers&&typeof e.headers=="object"&&(e.headers=C0e(e.headers));let n=e.url;typeof n=="string"&&n.includes("token=")&&(e.url=n.replace(/([?&]token=)[^&]+/gi,"$1[Filtered]"))}function M0e(t){try{P0e(t);let n=t.exception?.values?.[0];return n?.value&&typeof n.value=="string"&&(/Bearer\s+\S+/i.test(n.value)&&(n.value=n.value.replace(/Bearer\s+\S+/gi,"Bearer [Filtered]")),/password[=:]\s*\S+/i.test(n.value)&&(n.value="[Filtered]")),t}catch{return t}}function y0e(t){return t.replace(/:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,":?").replace(/:[a-f0-9]{16,}/gi,":?")}var T8=!1;function v0e(t){let e=O0e();return{environment:m8(),...e?{release:e}:{},tracesSampleRate:N0e(),beforeSend(n){if(n.type==="transaction")return n;let r=M0e(n);return r===null?null:r},beforeSendTransaction(n){try{for(let r of n.spans??[])r.description&&(r.description=y0e(r.description))}catch{}return n},initialScope:n=>(n.setTag("service",t),n)}}function h8(t){if(T8)return;let e=process.env.SENTRY_DSN?.trim();if(!e){t.dsnProvided=!1;return}t.dsnProvided=!0;try{nN({dsn:e,...v0e(t.serviceName)}),T8=!0,console.log(`[visa/observability] Sentry initialized service=${t.serviceName} env=${process.env.SENTRY_ENVIRONMENT??process.env.NODE_ENV??"unknown"}`),C_(`Sentry initialized: ${t.serviceName}`,"info")}catch(n){console.error("[visa/observability] Sentry.init failed:",n),t.dsnProvided=!1}}process.env.SENTRY_DSN;h8({serviceName:"visa-cli"});var g8=(0,I8.promisify)(N8.execFile);function b0e(t){let e=Lt.homedir(),n=o=>o.replace(e,"~"),r=t.staleReason==="missing"?"path missing on disk":"path mismatch";return` \u2022 ${t.client.displayName} (${n(t.configPath)})
|
|
153
|
-
|
|
154
|
-
Step 2: Checking authentication...`);let u=await Oe.getSessionToken();if(u)try{await new Vr(()=>Promise.resolve(u)).getStatus(),console.log(" Already authenticated.")}catch(E){let S=E instanceof Error?E.message:"";S.includes("session has expired")||S.includes("Not logged in")?(console.log(" Existing session expired \u2014 re-authenticating..."),await Oe.clearAll(),u=null):console.log(` Couldn't verify session (${S||"unknown error"}) \u2014 continuing with existing token.`)}if(!u){let E=null;try{let{stdout:S}=await g8("gh",["auth","token"],{timeout:5e3});E=S.trim()}catch{}if(E||(E=process.env.GITHUB_TOKEN||null),E)try{console.log(" Found GitHub token \u2014 attempting headless login...");let S=await globalThis.fetch("https://auth.visacli.sh/v1/auth/token-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({github_token:E}),signal:AbortSignal.timeout(1e4)});if(S.ok){let T=await S.json();if(T.success&&T.sessionToken){let h=T.sessionToken;u=h,await Oe.saveSessionToken(h),console.log(` Signed in as ${T.user} (headless).`)}}else(await S.json().catch(()=>({}))).hint==="card_required"&&console.log(" GitHub token valid but no card on file \u2014 opening browser for card enrollment...")}catch{}}if(u||(console.log(" No session found. Opening browser for GitHub login..."),u=await new Promise(async(E,S)=>{let T=Nl.randomBytes(16).toString("hex"),h=`https://auth.visacli.sh/login?state=${T}`;await fN(h);let R=3e4,O=300*1e3,N=Date.now()+O;for(;Date.now()<N;)try{let A=await globalThis.fetch("https://auth.visacli.sh/v1/auth-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:T,timeout:R}),signal:AbortSignal.timeout(R+5e3)});if(!A.ok)continue;let M=await A.json();if(M.status==="pending")continue;if(M.status==="expired"){S(new Error("Session expired. Please run setup again."));return}if(M.status==="complete"&&M.sessionToken){console.log(` Signed in as ${M.user}.`),E(M.sessionToken);return}}catch{}S(new Error("Login timed out after 5 minutes. Please run setup again."))}),await Oe.saveSessionToken(u),console.log(" Session token saved.")),console.log(`
|
|
155
|
-
Step 3: Setting up authentication...`),!mt())console.log(" Not macOS \u2014 skipping biometric setup.");else{try{await g8("clang",["--version"])}catch{console.error(" Xcode Command Line Tools are required for payment authentication."),console.error(" Install them by running: xcode-select --install"),console.error(" Then re-run: visa-cli setup"),process.exit(1)}try{let E=await Wl();console.log(" Attestation key generated."),await on().registerAttestationKey(E),console.log(" Attestation key registered with server.")}catch(E){console.log(` Skipped: ${E.message}`)}}let l=ai.join(Lt.homedir(),".claude","settings.json"),p=O8.existsSync(ai.join(Lt.homedir(),".claude.json"));if(t.hud===!0)if(!p)console.log(`
|
|
156
|
-
Step 4: HUD requested, but Claude Code config was not detected.`),console.log(" Skipped. Enable later with: visa-cli hud enable");else{console.log(`
|
|
157
|
-
Step 4: Enabling the Visa spend HUD...`);let E=Vl(l),S=E.installed==="new"||E.installed==="already-visa"||E.installed==="other-hud-present"?" \u2713 ":" Skipped: ";console.log(`${S}${E.message}`);try{let T=on(),h=await T.getStatus(),R={currentVersion:T.getClientVersion(),latestVersion:T.lastSignals?.updateAvailable?.latestVersion,updateCheckDisabled:rr()},O=WS(h,R);zS(O),console.log(` Preview: ${O.split(`
|
|
158
|
-
`)[0]}`)}catch{}}let d="\x1B[1m",_="\x1B[0m";console.log(`
|
|
148
|
+
`)):e}function Yn(e,t="global"){let n=t==="project"?P.join(process.cwd(),".mcp.json"):ss(e);try{let r=P.dirname(n);U.existsSync(r)||U.mkdirSync(r,{recursive:!0});let s=Uo(e,t),o=ll();if(s==="toml"){let i=U.existsSync(n)?U.readFileSync(n,"utf-8"):"",a=hg(i,"visa-cli",o);U.writeFileSync(n,a)}else{let i={};if(U.existsSync(n))try{i=JSON.parse(U.readFileSync(n,"utf-8"))}catch{i={}}i[e.configKey]=i[e.configKey]||{},i[e.configKey]["visa-cli"]=e.buildEntry?e.buildEntry(o):o,U.writeFileSync(n,JSON.stringify(i,null,2)+`
|
|
149
|
+
`)}}catch(r){throw dg(r)?new xn(e,n,r):r}return{installed:!0,configPath:n,message:e.postInstallHint}}function Vo(e,t="global"){let n=t==="project"?P.join(process.cwd(),".mcp.json"):ss(e);if(!U.existsSync(n))return{removed:!1,configPath:n};if(Uo(e,t)==="toml"){let i=U.readFileSync(n,"utf-8");return qo(i,"visa-cli")?(U.writeFileSync(n,yg(i,"visa-cli")),{removed:!0,configPath:n}):{removed:!1,configPath:n}}let s;try{s=JSON.parse(U.readFileSync(n,"utf-8"))}catch{return{removed:!1,configPath:n}}let o=s[e.configKey];return!o||!o["visa-cli"]?{removed:!1,configPath:n}:(delete o["visa-cli"],U.writeFileSync(n,JSON.stringify(s,null,2)+`
|
|
150
|
+
`),{removed:!0,configPath:n})}function ul(e,t="global"){let n=t==="project"?P.join(process.cwd(),".mcp.json"):ss(e);if(!U.existsSync(n))return!1;if(Uo(e,t)==="toml")try{let s=U.readFileSync(n,"utf-8");return!!qo(s,"visa-cli")}catch{return!1}try{return!!JSON.parse(U.readFileSync(n,"utf-8"))?.[e.configKey]?.["visa-cli"]}catch{return!1}}function _g(e){if(!e||typeof e!="object")return;let t=e;if(t.command!=="node"||!Array.isArray(t.args)||t.args.length===0)return;let n=t.args[t.args.length-1];if(!(typeof n!="string"||n.length===0))return n}function vg(e,t){if(e===t)return!0;let n=P.resolve(e),r=P.resolve(t);if(n===r)return!0;try{let s=U.realpathSync(n),o=U.realpathSync(r);return s===o}catch{return!1}}function Zn(){let e=ll(),t=e.args[e.args.length-1],n=[];for(let r of Me){let s=ss(r);if(!U.existsSync(s))continue;let o=r.configFormat??"json",i;if(o==="toml")try{let c=U.readFileSync(s,"utf-8");i=qo(c,"visa-cli")}catch{continue}else{let c;try{c=JSON.parse(U.readFileSync(s,"utf-8"))}catch{continue}i=c?.[r.configKey]?.["visa-cli"]}if(!i)continue;let a=_g(i);if(!a||vg(a,t))continue;let l=U.existsSync(a)?"mismatch":"missing";n.push({client:r,configPath:s,currentPath:a,expectedPath:t,staleReason:l})}return n}function Fo(e){return{configPath:Yn(e.client,"global").configPath}}var Ho=(0,gl.promisify)(pl.execFile);function xg(e){let t=X.homedir(),n=s=>s.replace(t,"~"),r=e.staleReason==="missing"?"path missing on disk":"path mismatch";return` \u2022 ${e.client.displayName} (${n(e.configPath)})
|
|
151
|
+
${r}: ${n(e.currentPath)}`}function hl(e,t){if(e.length===0){console.log(`${t} \u2713 All MCP client configs are up to date.`);return}console.log(`${t} Found ${e.length} stale MCP config ${e.length===1?"entry":"entries"}:`);for(let n of e)console.log(xg(n))}function dl(e){console.log(` ! ${e.client.displayName} skipped: ${e.message}`)}var K=new ml.Command,Cg=new Set(["pay",...No]),as=null,Xn=!1;function ie(){return as=new pe(()=>D.getSessionToken()),as}function kg(e){return e?typeof e.hasAnyAttestationKey=="boolean"?e.hasAnyAttestationKey:typeof e.hasAttestationKey=="boolean"?e.hasAttestationKey:!0:!1}function Tg(e){if(e instanceof $t)return!0;let t=e instanceof Error?e.message:"";return/attestation required|invalid signature|rotate biometric key|biometric key/i.test(t)}async function Eg(e){let r=Date.now()+3e5;for(;Date.now()<r;)try{let s=await globalThis.fetch(`${we()}/v1/auth-status`,{method:"POST",headers:{"Content-Type":"application/json","X-Source":"cli"},body:JSON.stringify({state:e,timeout:3e4}),signal:AbortSignal.timeout(35e3)});if(!s.ok){await dt(s,i=>{m.warn("auth_status:retry_after_http_error",{status:s.status,delayMs:i})});continue}let o=await s.json();if(o.status==="pending")continue;if(o.status==="complete"&&o.attestationCleared)return;if(o.status==="expired")throw new Error("Biometric reset session expired. Please run visa-cli config reset again.");if(o.status==="error")throw new Error(o.error||"Biometric reset failed. Please try again.")}catch(s){if(s?.message&&!/fetch failed|network|abort/i.test(s.message))throw s;await dt(void 0,o=>{m.warn("auth_status:retry_after_network_error",{delayMs:o})})}throw new Error("Biometric reset timed out after 5 minutes. Please run visa-cli config reset again.")}async function Ag(e){let t;try{t=await e.getStatus()}catch(s){let o=s?.message||"";if(/not logged in|session.*expired|no local credentials/i.test(o))return!1;throw new Error(`Could not check server biometric state: ${o||"unknown error"}`)}if(!kg(t))return!1;let n=er.randomUUID(),r=await e.startAttestationRecovery(n);if(!r.success||!r.recoveryUrl)throw new Error(r.error||"Could not start biometric reset.");return console.log(" Server biometric key found. Opening GitHub to confirm reset..."),await xs(r.recoveryUrl),await Eg(n),console.log(" Server biometric state cleared."),!0}function Qn(e){return`$${(e/100).toFixed(2)}`}function Ko(e,t,n=!1){if(!e){let i=Qn(t);return n&&t>=0?`+${i}`:i}let r=(0,cs.fromWire)(e),s=r%10000n===0n?2:6,o=(0,cs.toDisplay)(r,{decimals:s});return n&&r>=0n?`+${o}`:o}function Rg(e){return Ko(e,0)}function $g(e){let t=`visa-cli-${X.hostname()||"local"}`,n=(e?.trim()||t).trim();if(!n)throw new Error("API key label is required.");if(n.length>128)throw new Error("API key label must be 128 characters or fewer.");return n}function Ig(e){if(!e)return;let t=e.split(",").map(o=>o.trim()).filter(Boolean),n=Array.from(new Set(t)),r=n.find(o=>o.length>64);if(r)throw new Error(`Tool id is too long: ${r}`);let s=n.find(o=>Cg.has(o));if(s)throw new Error(`Tool id "${s}" is retired for direct API-key access. Use category meta-tools or discover/execute instead.`);return n}function Pg(e){if(!e)return;let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new Error("--daily-cap must be a positive USD amount.");let n=Math.round(t*100);if(n<100||n>1e4)throw new Error("--daily-cap must be between 1 and 100 USD.");return n}function yl(e){return e&&e.length>0?e.join(", "):"all tools"}function Go(e,t){return t||(typeof e!="number"||!Number.isFinite(e)?"price unknown":`$${(e/100).toFixed(2)}`)}function Mg(e,t){if(!e)return{};try{let n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${t} must be a JSON object.`);return n}catch(n){throw new Error(`${t} must be valid JSON: ${n.message}`)}}function _l(e){let t=e.inputSchema?.properties;return t&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t).join(", ")||"none":Object.keys(e.inputSchema||{}).join(", ")||"none"}function Bo(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}function Og(e){let t=new Map;for(let n of e){let r=n.category||"other",s=t.get(r)??[];s.push(n),t.set(r,s)}return new Map([...t.entries()].sort(([n],[r])=>n.localeCompare(r)))}function Ng(e){let t=Math.max(4,Math.min(28,e.reduce((s,o)=>Math.max(s,o.id.length),0))),n=7,r=Math.max(8,Math.min(12,e.reduce((s,o)=>Math.max(s,(o.category||"").length),0)));console.log(`
|
|
152
|
+
Merchant tools
|
|
153
|
+
`),console.log(` ${"Tool".padEnd(t)} ${"Price".padEnd(n)} ${"Category".padEnd(r)} Params`),console.log(` ${"\u2500".repeat(t)} ${"\u2500".repeat(n)} ${"\u2500".repeat(r)} ${"\u2500".repeat(28)}`);for(let s of e)console.log(` ${Bo(s.id,t).padEnd(t)} ${Go(s.priceCents,s.priceDisplay).padEnd(n)} ${Bo(s.category||"other",r).padEnd(r)} ${Bo(_l(s),42)}`);console.log("\nUse `visa-cli merchants describe <tool>` for full details."),console.log('Shortcut: `visa-cli generate image "a lobster"`\n')}function Lg(e){console.log(`
|
|
154
|
+
Merchant tools
|
|
155
|
+
`);for(let[t,n]of Og(e)){console.log(t[0]?.toUpperCase()+t.slice(1));for(let r of n)console.log(` ${r.id.padEnd(28)} ${Go(r.priceCents,r.priceDisplay).padEnd(8)} ${r.description}`),console.log(` Params: ${_l(r)}`);console.log()}console.log(`Run one with: visa-cli merchants run <tool> --json '{"prompt":"a lobster"}'`),console.log(`Shortcut: visa-cli generate image "a lobster"
|
|
156
|
+
`)}function vl(e){if(e?.content?.[0]?.text&&typeof e.content[0].text=="string"){console.log(e.content[0].text);return}let t=Array.isArray(e?.urls)?e.urls:Array.isArray(e?.receipt?.urls)?e.receipt.urls:[];if(e?.success===!1){let r=JSON.stringify(e,null,2);console.log("Result:"),console.log(r);return}if(console.log("Done"),typeof e?.merchantName=="string"&&console.log(`Merchant: ${e.merchantName}`),typeof e?.amount=="number"&&console.log(`Cost: $${e.amount.toFixed(2)}`),typeof e?.transactionId=="string"&&console.log(`Transaction: ${e.transactionId}`),t.length>0){console.log(`
|
|
157
|
+
Result URLs:`);for(let r of t)console.log(` ${r}`);return}let n=JSON.stringify(e,null,2);n&&n!=="{}"&&(console.log(`
|
|
158
|
+
Result:`),console.log(n))}var Dg=new Set(["INVALID_TOOL_PARAMS","MISSING_TOOL_ID","UNKNOWN_TOOL"]),bl=0,Ug=1,jg=2;function qg(e){if(e?.success!==!1)return bl;let n=(typeof e?.error_code=="string"?e.error_code:typeof e?.code=="string"?e.code:"").toUpperCase();return Dg.has(n)?jg:Ug}function Sl(e){let t=qg(e);t!==bl&&(process.exitCode=t)}async function Vg(e,t={}){let n=await e.catalogSearch(t.query,t.category,"discover_tools");return Array.isArray(n.tools)?n.tools:[]}function Fg(e){let t=`
|
|
159
|
+
Options:
|
|
160
|
+
`,n=`
|
|
161
|
+
Commands:
|
|
162
|
+
`,r=e.indexOf(t),s=e.indexOf(n);if(r===-1||s===-1||r>s)return e;let o=g=>{let x=e.slice(g+1).search(/\n[A-Z][A-Za-z ]+:\n/);return x===-1?e.length:g+1+x},i=o(r),a=o(s),l=e.slice(0,r),c=e.slice(r,i),u=e.slice(s,a),d=e.slice(a);return`${l}${u}${c}${d}`}function Bg(e){if(!e.startsWith("Usage: "))return e;let t=e.indexOf(`
|
|
163
|
+
|
|
164
|
+
`);if(t===-1)return e;let n=e.slice(0,t),r=e.slice(t+2),s=r.indexOf(`
|
|
165
|
+
|
|
166
|
+
`);if(s===-1)return e;let o=r.slice(0,s),i=r.slice(s+2);return o.trim()?`${o}
|
|
167
|
+
|
|
168
|
+
${n}
|
|
169
|
+
|
|
170
|
+
${i}`:e}function Hg(e){return e.replace(/(^|\n)(Commands:\n)([\s\S]*?)(?=\n[A-Z][A-Za-z ]+:\n|$)/g,(t,n,r,s)=>{let o=s.split(`
|
|
171
|
+
`).map(Kg).join(`
|
|
172
|
+
`);return`${n}${r}${o}`})}function Kg(e){if(!e.startsWith(" "))return e;let n=2,r=n;for(;r<e.length&&e[r]!==" "&&e[r]!==" ";)r+=1;if(r===n)return e;let s=-1;for(let l=r;l<e.length-1;l+=1){if(e[l]!==" "||e[l+1]!==" ")continue;let c=l+2;for(;c<e.length&&e[c]===" ";)c+=1;if(c<e.length){s=c;break}}if(s===-1)return e;let o=e.slice(n,r),i=e.slice(s),a=Math.max(2,s-2-o.length);return` ${o}${" ".repeat(a)}${i}`}function Gg(e){return e.replace(/^(Usage: .+?) \[options\](?= |$)/gm,"$1")}function zg(e){return e.replace(/^Options:$/gm,"Flags:")}function wl(e){let t=e.helpInformation.bind(e);e.helpInformation=()=>zg(Gg(Hg(Fg(Bg(t())))));for(let n of e.commands)wl(n)}function Wg(e){let t=new Map(e.map((r,s)=>[r,s]));K.commands.sort((r,s)=>{let o=t.get(r.name())??Number.MAX_SAFE_INTEGER,i=t.get(s.name())??Number.MAX_SAFE_INTEGER;return o-i})}K.name("visa-cli").description("Visa CLI - set up MCP payments, manage credentials, and monitor AI spend").version(ar().version).addHelpCommand(!1);K.hook("preAction",async()=>{await pi()});K.command("setup").description("Register MCP server, authenticate, and generate attestation key").option("--check","Scan MCP client configs for stale visa-cli entries and exit without making changes").option("--yes","Accept setup prompts without asking \u2014 for CI/agent use").option("--hud","Also enable the shell HUD during setup").option("--no-hud","Do not install the HUD during setup (default)").action(async e=>{try{if(e.check){let y=Zn();hl(y,"MCP config check:"),y.length>0&&(console.log("\nRun `visa-cli setup` (or `visa-cli install --repair`) to rewrite these entries."),process.exit(1));return}console.log("Step 1: Registering MCP server...");let t=Zn(),n=new Map(t.map(y=>[y.client.id,y])),r=new Set,s=new Set,o=new Set;for(let y of Me)if(Jn(y)){let A;try{A=Yn(y)}catch(T){if(T instanceof xn){dl(T),s.add(y.displayName),o.add(y.id);continue}throw T}let N=n.get(y.id),L=N?` \u2014 repaired stale ${N.staleReason} entry`:"";console.log(` \u2713 ${y.displayName} (${A.configPath.replace(X.homedir(),"~")})${L}`),N&&r.add(y.id)}let i=t.filter(y=>!r.has(y.client.id)&&!o.has(y.client.id)),a=0;for(let y of i){try{Fo(y)}catch(A){if(A instanceof xn){dl(A),s.add(y.client.displayName),o.add(y.client.id);continue}throw A}console.log(` \u2713 ${y.client.displayName} (${y.configPath.replace(X.homedir(),"~")}) \u2014 repaired stale ${y.staleReason} entry`),a++}let l=r.size+a;l===0&&s.size===0?console.log(" \u2713 MCP config verified \u2014 nothing to repair."):l>0&&console.log(` \u2713 Repaired ${l} stale MCP config ${l===1?"entry":"entries"}.`),s.size>0&&console.log(` ! Skipped MCP registration for: ${Array.from(s).join(", ")}. Rerun with access to those config files to complete registration.`),console.log(`
|
|
173
|
+
Step 2: Checking authentication...`);let c=await D.getSessionToken();if(c)try{await new pe(()=>Promise.resolve(c)).getStatus(),console.log(" Already authenticated.")}catch(y){let A=y instanceof Error?y.message:"";A.includes("session has expired")||A.includes("Not logged in")?(console.log(" Existing session expired \u2014 re-authenticating..."),await D.clearAll(),c=null):console.log(` Couldn't verify session (${A||"unknown error"}) \u2014 continuing with existing token.`)}if(!c){let y=null;try{let{stdout:A}=await Ho("gh",["auth","token"],{timeout:5e3});y=A.trim()}catch{}if(y||(y=process.env.GITHUB_TOKEN||null),y)try{console.log(" Found GitHub token \u2014 attempting headless login...");let A=await globalThis.fetch(`${we()}/v1/auth/token-exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({github_token:y}),signal:AbortSignal.timeout(1e4)});if(A.ok){let N=await A.json();if(N.success&&N.sessionToken){let L=N.sessionToken;c=L,await D.saveSessionToken(L),console.log(` Signed in as ${N.user} (headless).`)}}else(await A.json().catch(()=>({}))).hint==="card_required"&&console.log(" GitHub token valid but no card on file \u2014 opening browser for card enrollment...")}catch{}}if(c||(console.log(" No session found. Opening browser for GitHub login..."),c=await new Promise(async(y,A)=>{let N=er.randomUUID(),L=`${we()}/login?state=${N}`;await xs(L);let T=3e4,C=300*1e3,V=Date.now()+C;for(;Date.now()<V;)try{let G=await globalThis.fetch(`${we()}/v1/auth-status`,{method:"POST",headers:{"Content-Type":"application/json","X-Source":"cli"},body:JSON.stringify({state:N,timeout:T}),signal:AbortSignal.timeout(T+5e3)});if(!G.ok){await dt(G,it=>{m.warn("auth_status:retry_after_http_error",{status:G.status,delayMs:it})});continue}let F=await G.json();if(F.status==="pending")continue;if(F.status==="expired"){A(new Error("Session expired. Please run setup again."));return}if(F.status==="complete"&&F.sessionToken){console.log(` Signed in as ${F.user}.`),y(F.sessionToken);return}}catch{await dt(void 0,G=>{m.warn("auth_status:retry_after_network_error",{delayMs:G})})}A(new Error("Login timed out after 5 minutes. Please run setup again."))}),await D.saveSessionToken(c),console.log(" Session token saved.")),console.log(`
|
|
174
|
+
Step 3: Setting up authentication...`),!Z())console.log(" Not macOS \u2014 skipping biometric setup.");else{try{await Ho("clang",["--version"])}catch{console.error(" Xcode Command Line Tools are required for payment authentication."),console.error(" Install them by running: xcode-select --install"),console.error(" Then re-run: visa-cli setup"),process.exit(1)}try{let y=await jn();console.log(" Attestation key generated."),await ie().registerAttestationKey(y),console.log(" Attestation key registered with server.")}catch(y){let A=y?.message||"unknown error";if(Tg(y)){console.error(" Server already has a biometric key for this account, but this device cannot prove access to it.");let N=y instanceof $t&&y.hint?y.hint:"Run `visa-cli config reset` to clear server-side biometric state through GitHub, then run `visa-cli setup` again.";console.error(` ${N}`),process.exit(1)}console.log(` Skipped: ${A}`)}}let u=st.join(X.homedir(),".claude","settings.json"),d=Oe.existsSync(st.join(X.homedir(),".claude.json"));if(e.hud===!0)if(!d)console.log(`
|
|
175
|
+
Step 4: HUD requested, but Claude Code config was not detected.`),console.log(" Skipped. Enable later with: visa-cli config hud enable");else{console.log(`
|
|
176
|
+
Step 4: Enabling the Visa spend HUD...`);let y=mr(u),A=y.installed==="new"||y.installed==="already-visa"||y.installed==="other-hud-present"?" \u2713 ":" Skipped: ";console.log(`${A}${y.message}`);try{let N=ie(),L=await N.getStatus(),T={currentVersion:N.getClientVersion(),latestVersion:N.lastSignals?.updateAvailable?.latestVersion,updateCheckDisabled:De()},C=lo(L,T);uo(C,L),console.log(` Preview: ${C.split(`
|
|
177
|
+
`)[0]}`)}catch{}}let g="\x1B[1m",f="\x1B[2m",x="\x1B[0m";console.log(`
|
|
159
178
|
\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557
|
|
160
179
|
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
161
180
|
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
|
|
@@ -163,40 +182,78 @@ Step 4: Enabling the Visa spend HUD...`);let E=Vl(l),S=E.installed==="new"||E.in
|
|
|
163
182
|
\u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
164
183
|
\u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u2588 CLI
|
|
165
184
|
|
|
166
|
-
${
|
|
185
|
+
${g}Setup complete.${x} Restart Claude Code or run /mcp to connect.
|
|
167
186
|
|
|
168
|
-
${
|
|
187
|
+
${g}Try it out:${x}
|
|
169
188
|
\u2022 Ask Claude: "Generate an image of a neon cityscape"
|
|
170
189
|
\u2022 Ask Claude: "What's the price of ETH on Base?"
|
|
171
|
-
\u2022
|
|
190
|
+
\u2022 Check balance: visa-cli balance show
|
|
172
191
|
|
|
173
|
-
|
|
174
|
-
${
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
192
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
193
|
+
\u2502 ${g}Recommended: enable the spend HUD${x} \u2502
|
|
194
|
+
\u2502 \u2502
|
|
195
|
+
\u2502 Keep an eye on what your agents are spending. \u2502
|
|
196
|
+
\u2502 Shows your balance, active card, and recent tool usage \u2502
|
|
197
|
+
\u2502 on every prompt. \u2502
|
|
198
|
+
\u2502 \u2502
|
|
199
|
+
\u2502 ${f}$${x} visa-cli config hud enable \u2502
|
|
200
|
+
\u2502 \u2502
|
|
201
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
202
|
+
|
|
203
|
+
${g}Verify:${x} visa-cli status
|
|
204
|
+
${g}Docs:${x} https://visacli.sh
|
|
205
|
+
`)}catch(t){console.error("Error:",t.message),process.exit(1)}});K.command("install [client]",{hidden:!0}).description("Register MCP server with an AI client (claude, cursor, windsurf, cline, zed, ...)").option("--all","Install for all detected clients").option("--list","Show supported clients and install status").option("--check","Scan MCP client configs for stale visa-cli entries and exit without making changes").option("--repair","Repair stale MCP client configs without re-running the full setup flow").option("--scope <scope>","Install scope: global or project","global").action(async(e,t)=>{try{if(t.check){let o=Zn();hl(o,"MCP config check:"),o.length>0&&process.exit(1);return}if(t.repair){let o=Zn();if(o.length===0){console.log("\u2713 MCP config verified \u2014 nothing to repair.");return}for(let i of o)Fo(i),console.log(` \u2713 ${i.client.displayName} (${i.configPath.replace(X.homedir(),"~")}) \u2014 repaired stale ${i.staleReason} entry`);console.log(`
|
|
206
|
+
Repaired ${o.length} stale MCP config ${o.length===1?"entry":"entries"}.`);return}if(t.list){console.log(`
|
|
178
207
|
\x1B[1mSupported MCP Clients\x1B[0m
|
|
179
|
-
`),console.log(` ${"Client".padEnd(18)} ${"Detected".padEnd(10)} ${"Installed".padEnd(11)} Config Path`),console.log(` ${"\u2500".repeat(18)} ${"\u2500".repeat(10)} ${"\u2500".repeat(11)} ${"\u2500".repeat(40)}`);for(let a of
|
|
180
|
-
Supported clients: ${
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
`)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
`)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
208
|
+
`),console.log(` ${"Client".padEnd(18)} ${"Detected".padEnd(10)} ${"Installed".padEnd(11)} Config Path`),console.log(` ${"\u2500".repeat(18)} ${"\u2500".repeat(10)} ${"\u2500".repeat(11)} ${"\u2500".repeat(40)}`);for(let a of Me){let l=Jn(a),c=ul(a),u=l?"Yes":"No",d=c?"Yes":"No",g=a.globalConfigPath.replace(X.homedir(),"~");console.log(` ${a.displayName.padEnd(18)} ${u.padEnd(10)} ${d.padEnd(11)} ${g}`)}console.log("");return}let n=t.scope==="project"?"project":"global";if(t.all){let o=[],i=[];for(let a of Me){if(!Jn(a)){i.push(a.displayName);continue}Yn(a,n),o.push(a.displayName)}o.length>0&&console.log(`Installed for: ${o.join(", ")}.`),i.length>0&&console.log(`Skipped: ${i.map(a=>`${a} (not detected)`).join(", ")}.`),o.length===0&&i.length===0&&console.log("No supported clients found.");return}e||(console.error("Usage: visa-cli install <client>"),console.error(" visa-cli install --all"),console.error(" visa-cli install --list"),console.error(`
|
|
209
|
+
Supported clients: ${Me.map(o=>o.id).join(", ")}`),process.exit(1));let r=Do(e);r||(console.error(`Unknown client: ${e}`),console.error(`Supported clients: ${Me.map(o=>o.id).join(", ")}`),process.exit(1)),n==="global"&&!Jn(r)&&(console.error(`${r.displayName} not detected on this machine.`),console.error(`Expected: ${r.detectPaths.join(", ")}`),process.exit(1));let s=Yn(r,n);console.log(`Registered visa-cli MCP server in ${s.configPath}`),console.log(s.message)}catch(n){console.error("Error:",n.message),process.exit(1)}});K.command("pay <url>",{hidden:!0}).description("Pay a merchant URL (amount auto-detected from HTTP 402 response)").option("-m, --method <method>","HTTP method (GET or POST)","GET").option("-b, --body <json>","JSON request body for POST endpoints").action(async(e,t)=>{try{console.warn("Warning: `visa-cli pay` is deprecated and will be removed in a future release.\n Use the MCP `pay` tool via Claude Code or Cursor instead.\n See: https://github.com/Visa-Crypto-Labs/Visa-mono/issues/1913\n");let n=oc(e),r=ic(t.method),s=ac(t.body),o=Vr(n),i=new pe(()=>D.getSessionToken());console.log(`Checking payment for ${e}...`);let a=cc(await i.paymentPreview({url:e}));console.log(` Merchant: ${a.merchantName}`),console.log(` Amount: $${a.amount.toFixed(2)} ${a.currency}`),console.log(` Rail: auto-detected
|
|
210
|
+
`);let c=(await i.getStatus()).attestationRequired!==!1;c&&!Z()&&console.warn("Warning: Touch ID unavailable on this system \u2014 payment will proceed without biometric attestation.");let u=er.randomUUID(),d=await _n(i,async()=>{let g;if(c&&Z())try{let{nonce:f}=await i.getAttestationChallenge(),x=Buffer.from(JSON.stringify({nonce:f,amount:a.amount,merchant:o,context:e})).toString("base64");g={signature:await mn(x,`pay $${a.amount.toFixed(2)} to ${o}`),nonce:f,amount:a.amount,merchant:o}}catch(f){throw new Error(`Touch ID confirmation failed: ${f?.message||"user cancelled or biometric error"}`)}return i.pay({url:e,method:r,body:s,attestation:g,idempotencyKey:u})});if(d.success){if(console.log(`Payment complete: $${(d.amount??a.amount).toFixed(2)} \u2192 ${d.merchantName??a.merchantName}`),d.receipt?.urls?.length){console.log(`
|
|
211
|
+
Result URLs:`);for(let g of d.receipt.urls)console.log(` ${g}`)}mo()}else console.error(`Payment failed: ${d.message||"Unknown error"}`),process.exit(1)}catch(n){n instanceof he?console.error(`Error: ${n.message}`):console.error("Error:",n.message),process.exit(1)}});K.command("status").description("Check enrollment, cards, wallet, and spending controls").action(async()=>{Xn=!1;try{let e=ie(),[t,n]=await Promise.all([e.getStatus(),e.getTransactions().catch(s=>{if(process.env.VISA_CLI_DEBUG){let o=s instanceof Error?s.message:String(s);process.stderr.write(`[visa-cli] getTransactions failed (HUD will omit): ${o}
|
|
212
|
+
`)}return{transactions:[]}})]),r={currentVersion:e.getClientVersion(),latestVersion:e.lastSignals.updateAvailable?.latestVersion,updateCheckDisabled:De()};process.stdout.write(nl(t,Array.isArray(n?.transactions)?n.transactions:[],Z(),r)),Xn=!0}catch(e){Xn=!1,console.error("Error:",e.message),process.exit(1)}});function Jg(e){let t=e.map(rl),n=Math.max(2,...t.map(i=>i.id.length)),r=Math.max(5,...t.map(i=>i.brand.length)),s=Math.max(4,...t.map(i=>i.card.length)),o=7;console.log(`
|
|
213
|
+
Cards
|
|
214
|
+
`),console.log(` ${"ID".padEnd(n)} ${"Brand".padEnd(r)} ${"Card".padEnd(s)} Default`),console.log(` ${"\u2500".repeat(n)} ${"\u2500".repeat(r)} ${"\u2500".repeat(s)} ${"\u2500".repeat(o)}`);for(let i of t)console.log(` ${i.id.padEnd(n)} ${i.brand.padEnd(r)} ${i.card.padEnd(s)} ${i.default}`);console.log(`
|
|
215
|
+
Use:`),console.log(" visa-cli cards default <id>"),console.log(` visa-cli cards remove <id>
|
|
216
|
+
`)}async function Yg(e,t){if(t.yes)return"confirmed";if(!process.stdin.isTTY)return"refused-non-tty";let n=fl.createInterface({input:process.stdin,output:process.stdout});try{let r=(await n.question(`${e} [y/N] `)).trim();return/^y(es)?$/i.test(r)?"confirmed":"declined"}finally{n.close()}}var ls=K.command("cards").description("Manage enrolled payment cards").addHelpCommand(!1);ls.command("list").description("List enrolled payment cards").action(async()=>{try{let e=await Fe.getCards("visa-cli cards list"),t=Array.isArray(e.cards)?e.cards:[];if(t.length===0){console.log(e.message||"No cards enrolled. Add one with: visa-cli cards add");return}Jg(t)}catch(e){console.error("Error:",e.message),process.exit(1)}});ls.command("add").description("Add a new Visa card").action(async()=>{try{let e=await Fe.addCard("visa-cli cards add");if(e?.message){console.log(e.message);return}let t=e?.card?.last4;console.log(t?`Card ending in ****${t} enrolled.`:"Card enrollment complete.")}catch(e){console.error("Error:",e.message),process.exit(1)}});ls.command("remove <card-id>").description("Remove an enrolled card").option("-y, --yes","Skip the interactive confirmation prompt").action(async(e,t)=>{try{let n=Oo(e),r=await Yg(`Remove card ${n}? This cannot be undone.`,t);if(r==="refused-non-tty"&&(console.error("Refusing to remove card without --yes in a non-interactive shell."),process.exit(1)),r==="declined"){console.log("Aborted.");return}let s=await Fe.removeCard({cardId:n,confirm:!0},"visa-cli cards remove");s?.success===!1&&(console.error(s.error||s.message||"Failed to remove card."),process.exit(1)),console.log(s?.message||`Removed card ${n}.`)}catch(n){console.error("Error:",n.message),process.exit(1)}});ls.command("default <card-id>").alias("set-default").description("Set the default payment card").action(async e=>{try{let t=Oo(e),n=await Fe.setDefaultCard({cardId:t},"visa-cli cards default");n?.success===!1&&(console.error(n.error||n.message||"Failed to set default card."),process.exit(1)),console.log(n?.message||`Set card ${t} as default.`)}catch(t){console.error("Error:",t.message),process.exit(1)}});var zo=K.command("tokens").description("Create and manage API tokens for apps and agents").addHelpCommand(!1);function Wo(e){let t=e instanceof Error?e.message:String(e);console.error("Error:",t),t.includes("Not logged in")&&(console.error(""),console.error("Hint: if `visa-cli status` or `visa-cli setup` says you are authenticated, this process may not have access to your macOS Keychain."),console.error("In sandboxed agents such as Codex, rerun the tokens command with keychain access or run it from a normal terminal.")),process.exit(1)}zo.command("create [label]").description("Create an API token for the authenticated approved user").option("--tools <ids>","Comma-separated allowed tool ids (default: all tools)").option("--daily-cap <usd>","Daily cap in USD, between 1 and 100 (default: server default)").option("--json","Output raw JSON").action(async(e,t)=>{try{let r=await ie().createAppApiKey({label:$g(e),allowed_tools:Ig(t.tools),daily_cap_cents:Pg(t.dailyCap)});if(t.json){console.log(JSON.stringify(r,null,2));return}console.log("API token created."),console.log(""),console.log(`Key: ${r.key}`),console.log(`Label: ${r.label}`),console.log(`Owner: ${r.owner}`),console.log(`Allowed tools: ${yl(r.allowed_tools)}`),console.log(`Daily cap: ${Qn(r.daily_cap_cents)}/day`),console.log(""),console.log("Store this key now. It will not be shown again."),console.log(""),r.biometric_enabled?(console.log("---------------------------------------------------------------"),console.log("Biometric (Touch ID) is currently ON for this account."),console.log("This API token can still be used headlessly. Per-call Touch ID is"),console.log("not required; spending is bounded by the token daily cap and tools."),console.log("---------------------------------------------------------------"),console.log("")):r.biometric_warning&&(console.log("Note: API tokens bypass per-call biometric verification."),console.log("Keep daily caps and allowed tools scoped for headless use."),console.log("")),console.log("Example:"),console.log(` curl -X POST ${we()}/v1/api/shortcuts/or-gpt-4o-mini \\`),console.log(` -H "X-Api-Key: ${r.key}" \\`),console.log(' -H "Content-Type: application/json" \\'),console.log(` -d '{"prompt":"Say hello in one sentence."}'`)}catch(n){Wo(n)}});zo.command("list").description("List API tokens for the authenticated user").option("--json","Output raw JSON").action(async e=>{try{let n=await ie().listAppApiKeys();if(e.json){console.log(JSON.stringify(n,null,2));return}let r=n.keys||[];if(r.length===0){console.log("No API tokens found. Create one with: visa-cli tokens create");return}console.log("API tokens"),console.log("");for(let s of r)console.log(`${s.id}. ${s.label} (${s.key_prefix})`),console.log(` Status: ${s.status}`),console.log(` Owner: ${s.owner}`),console.log(` Allowed tools: ${yl(s.allowed_tools)}`),console.log(` Daily cap: ${Qn(s.daily_cap_cents)}/day`),console.log(` Last used: ${s.last_used_at||"never"}`)}catch(t){Wo(t)}});zo.command("revoke <id>").alias("delete").description("Revoke (or delete) an API token by id").action(async e=>{try{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new Error("API token id must be a positive integer. Run `visa-cli tokens list` first.");let r=await ie().revokeAppApiKey(t);console.log(`Revoked API token ${r.revoked}.`)}catch(t){Wo(t)}});async function xl(){try{console.log(`Resetting Visa CLI...
|
|
217
|
+
`);let e=ie();await Ag(e);try{await e.logout(),console.log(" Server session invalidated.")}catch{console.log(" Server logout skipped (no active session).")}if(await D.clearAll(),console.log(" Keychain credentials cleared."),Z())try{await $r(),console.log(" Secure Enclave key deleted.")}catch{console.log(" No Secure Enclave key to delete.")}console.log(`
|
|
218
|
+
Reset complete.`)}catch(e){console.error("Error:",e.message),process.exit(1)}}K.command("reset",{hidden:!0}).description("Deprecated alias for `config reset`").action(xl);var Zg=100,Jo=K.command("balance").description("Manage prepaid balance").addHelpCommand(!1);Jo.command("show").description("Show prepaid balance + recent ledger entries").action(async()=>{try{let t=await new pe(()=>D.getSessionToken()).getBalance();if(console.log(`
|
|
219
|
+
Balance: ${Ko(t.balanceMicros,t.balanceCents)}
|
|
220
|
+
`),t.ledger.length===0){console.log(` (no ledger entries \u2014 top up to begin: visa-cli balance topup --amount 5)
|
|
221
|
+
`);return}let n=t.ledger.slice(0,20),r=[],s=t.balanceCents,o=t.balanceMicros?BigInt(t.balanceMicros):null;for(let u of n)r.push(o!=null?o.toString():String(s*1e4)),o!=null&&u.deltaMicros?o-=BigInt(u.deltaMicros):(o=null,s-=u.deltaCents);let i=19,a=11,l=13,c=18;console.log(` ${"TIMESTAMP".padEnd(i)} ${"DELTA".padStart(a)} ${"BALANCE".padStart(l)} ${"REASON".padEnd(c)} TOOL`),console.log(` ${"\u2500".repeat(i)} ${"\u2500".repeat(a)} ${"\u2500".repeat(l)} ${"\u2500".repeat(c)} ${"\u2500".repeat(20)}`),n.forEach((u,d)=>{let g=(u.createdAt||"").slice(0,19),f=Ko(u.deltaMicros,u.deltaCents,!0),x=Rg(r[d]),y=(u.reason??"").slice(0,c),A=u.toolName??"";console.log(` ${g.padEnd(i)} ${f.padStart(a)} ${x.padStart(l)} ${y.padEnd(c)} ${A}`)}),console.log()}catch(e){console.error("Error:",e.message),process.exit(1)}});Jo.command("topup").description("Top up prepaid balance from your default card (same path as MCP buy_credits; Touch ID required)").requiredOption("-a, --amount <usd>","Amount in USD (e.g. 5 or 1.50)").action(async e=>{try{let t=parseFloat(e.amount);if(!Number.isFinite(t)||t<=0)throw new Error("amount must be a positive number");let n=Math.round(t*100);if(n<Zg)throw new Error("minimum top-up is $1.00");let r=new pe(()=>D.getSessionToken());if(!Z())throw new Error(Wr);let s=er.randomUUID(),o=await _n(r,async()=>{let i;if(Z()){let{nonce:a}=await r.getAttestationChallenge(),l=Buffer.from(JSON.stringify({nonce:a,amount:t,merchant:"Visa CLI Balance",context:"balance-topup"})).toString("base64");i={signature:await mn(l,`top up balance with $${t.toFixed(2)}`),nonce:a,amount:t,merchant:"Visa CLI Balance"}}return r.topupBalance({amount_cents:n,idempotency_key:s,attestation:i})});if(o.success)console.log(`Top-up complete: +$${(n/100).toFixed(2)} \u2192 balance now $${((o.balanceCents??0)/100).toFixed(2)}`),o.transactionId&&console.log(`Transaction: ${o.transactionId}`),mo();else{let i=o.error_code?` [${o.error_code}]`:"";console.error(`Top-up failed${i}: ${o.error||"Unknown error"}`),process.exit(1)}}catch(t){console.error("Error:",t.message),process.exit(1)}});var Cl=Jo.command("auto-topup").description("Show or disable automatic balance top-ups (read/disable only \u2014 re-enabling is retired pending mandate model)").addHelpCommand(!1);Cl.command("show").description("Show current auto-topup configuration").action(async()=>{try{let t=await new pe(()=>D.getSessionToken()).getAutoTopup();if(t.targetCents==null||t.targetCents===0){console.log(`
|
|
222
|
+
Auto-topup: disabled
|
|
223
|
+
`);return}let n=Qn(t.targetCents),r=Qn(t.thresholdCents),s=12,o=13;console.log(),console.log(` ${"STATE".padEnd(s)} enabled`),console.log(` ${"TARGET".padEnd(s)} ${n.padStart(o)} (refill balance to this amount)`),console.log(` ${"THRESHOLD".padEnd(s)} ${r.padStart(o)} (trigger refill when balance drops below this)`),console.log(),console.log(" Disable with: visa-cli balance auto-topup disable"),console.log()}catch(e){console.error("Error:",e.message),process.exit(1)}});Cl.command("disable").description("Disable auto-topup").action(async()=>{try{let t=await new pe(()=>D.getSessionToken()).disableAutoTopup();t.success||(console.error(`Auto-topup disable failed: ${t.error||"Unknown error"}`),process.exit(1)),console.log("Auto-topup disabled. Your balance will no longer refill automatically.")}catch(e){console.error("Error:",e.message),process.exit(1)}});var Xg=K.command("session",{hidden:!0}).description("Inspect session budgets");Xg.command("inspect <id>").description("Show a session-budget by id (e.g. sb_abc123)").action(async e=>{try{if(!e||e.length===0)throw new Error("session id required");let t=new pe(()=>D.getSessionToken()),[n,r]=await Promise.allSettled([t.getSessionBudget(e),t.getSessionLedger(e)]),s=n.status==="fulfilled"?n.value.budget:void 0,o=r.status==="fulfilled"?r.value:void 0;if(!s&&!o?.ledger?.length&&(console.error(`Session not found: ${e}`),process.exit(1)),console.log(`
|
|
224
|
+
Session: ${e}`),s){let i=(s.totalCents/100).toFixed(2),a=(s.cumulativeCents/100).toFixed(2),l=(s.remainingCents/100).toFixed(2);console.log(` Status: ${s.status}${s.expired?" (expired)":""}`),console.log(` Budget: $${i} \xB7 spent $${a} \xB7 remaining $${l}`),console.log(` Created: ${s.createdAt}`),console.log(` Expires: ${s.expiresAt}`)}if(o?.ledger?.length){console.log(`
|
|
225
|
+
PSP References (CyberSource activity):`);let i=8,a=9,l=36;console.log(` ${"TYPE".padEnd(i)} ${"AMOUNT".padStart(a)} ${"CYBERSOURCE TX ID".padEnd(l)} CREATED`),console.log(` ${"\u2500".repeat(i)} ${"\u2500".repeat(a)} ${"\u2500".repeat(l)} ${"\u2500".repeat(19)}`);for(let c of o.ledger){let u=`$${(c.amountCents/100).toFixed(2)}`;console.log(` ${c.type.padEnd(i)} ${u.padStart(a)} ${(c.transactionId||"").padEnd(l)} ${(c.createdAt||"").slice(0,19)}`)}}else s&&console.log(`
|
|
226
|
+
(no PSP references yet \u2014 no holds placed)`);console.log()}catch(t){console.error("Error:",t.message),process.exit(1)}});async function kl(e){(!e||e.trim().length===0)&&(console.log('Usage: visa-cli feedback "your message"'),process.exit(1));try{await D.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1)),await ie().feedback(e.trim()),console.log("Feedback submitted. Thanks!")}catch(t){console.error("Error:",t.message),process.exit(1)}}K.command("feedback").description("Submit feedback about Visa CLI").argument("[message]","Your feedback message").action(kl);K.command("update").description("Update Visa CLI to the latest stable version").action(async()=>{let e=oo();try{console.log(`Updating Visa CLI with ${e.packageManager}: ${e.display}`);let{stdout:t,stderr:n}=await Ho(e.command,e.args,{timeout:5*6e4,maxBuffer:10*1024*1024});t.trim()&&process.stdout.write(t),n.trim()&&process.stderr.write(n),console.log("Visa CLI update complete. Restart any running MCP clients to use the new version.")}catch(t){console.error(`Update failed while running: ${e.display}`),console.error(t?.message??String(t)),process.exit(1)}});var ot=K.command("config").description("Manage CLI configuration and local integrations").addHelpCommand(!1);ot.command("feedback",{hidden:!0}).description("Deprecated alias for `feedback`").argument("[message]","Your feedback message").action(kl);ot.command("list").description("Show resolved config values (env vars, server state, defaults) with their source").option("--json","Output as JSON for scripting / agent consumption").option("--dev","Include developer/test hooks (VISA_MOCK_*, VISA_CLI_DEBUG)").option("--verbose","Show one-line hints beneath entries that have them").action(async e=>{try{let t=ie(),n=await qr({api:t,includeDev:!!e.dev});if(e.json){console.log(nc(n));return}n.statusError&&(console.error(`Warning: could not reach auth server (${n.statusError}).`),console.error("Server-sourced entries show '\u2014'. Log in with `visa-cli setup` if you expected values here."),console.error("")),console.log(tc(n.entries,{verbose:!!e.verbose}))}catch(t){console.error("Error:",t.message),process.exit(1)}});function Qg(){return Object.entries(ft).map(([e,t])=>` ${e.padEnd(22)} (${t.type}) ${t.description}`).join(`
|
|
227
|
+
`)}ot.command("set <key> <value>").description("Persist a CLI setting to ~/.visa-mcp/settings.json").addHelpText("after",`
|
|
194
228
|
Settable keys:
|
|
195
|
-
${
|
|
196
|
-
`)});
|
|
197
|
-
`);let
|
|
229
|
+
${Qg()}`).action((e,t)=>{try{let n=vr(e,t);console.log(`Saved ${n.key}=${JSON.stringify(n.value)} \u2192 ${n.path}`),n.requiresRestart&&console.log("Restart Claude Code (or your MCP-enabled client) for the change to take effect.")}catch(n){n instanceof ze||n instanceof We||n instanceof mt?console.error(`Error: ${n.message}`):console.error(`Error: ${n.message}`),process.exit(1)}});ot.command("unset <key>").description("Remove a CLI setting from ~/.visa-mcp/settings.json (falls back to env var or default)").action(e=>{try{let t=br(e);t.removed?(console.log(`Removed ${t.key} from ${t.path}`),t.requiresRestart&&console.log("Restart Claude Code (or your MCP-enabled client) for the change to take effect.")):console.log(`No-op: ${t.key} was not set in ${t.path}.`)}catch(t){console.error(`Error: ${t.message}`),process.exit(1)}});ot.command("reset").description("Log out and clear all credentials").action(xl);var Yo=ot.command("biometric").description("Manage Touch ID / biometric attestation enforcement");Yo.command("status").description("Show current biometric enforcement state").action(async()=>{try{await D.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let n=await ie().getStatus(),r=n.attestationRequired!==!1,s=!!n.hasAttestationKey,o=Z();console.log(`Server policy: Touch ID ${r?"REQUIRED":"NOT required"}`),console.log(`Attestation key registered: ${s?"yes":"no"}`),console.log(`Touch ID available on this device: ${o?"yes":"no"}`)}catch(e){console.error("Error:",e.message),process.exit(1)}});Yo.command("on").description("Require Touch ID for payments (security upgrade \u2014 no Touch ID needed)").action(async()=>{try{await D.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let t=ie(),n=await t.setBiometricPreference({required:!0});n.success||(console.error(`Failed: ${n.error||"unknown error"}`),process.exit(1)),console.log("Touch ID is now REQUIRED for payments."),(await t.getStatus()).hasAttestationKey||console.warn("Note: no attestation key is registered yet. Run `visa-cli setup` to enroll Touch ID.")}catch(e){console.error("Error:",e.message),process.exit(1)}});Yo.command("off").description("Disable Touch ID requirement (security downgrade \u2014 one Touch ID confirmation required)").action(async()=>{try{await D.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let t=ie(),n=await t.getStatus();if(n.attestationRequired===!1){console.log("Touch ID is already disabled.");return}n.hasAttestationKey&&!Z()&&(console.error("Touch ID is unavailable on this device but the server has a registered key."),console.error("Disable Touch ID from a device that can sign, or contact support."),process.exit(1));let r=await _n(t,async()=>{let s;if(n.hasAttestationKey&&Z())try{let{nonce:o}=await t.getAttestationChallenge(),i=0,a="",l=Buffer.from(JSON.stringify({nonce:o,amount:i,merchant:a,context:"biometric-preference"})).toString("base64");s={signature:await mn(l,"disable Touch ID requirement"),nonce:o,amount:i,merchant:a}}catch(o){throw new Error(`Touch ID confirmation failed: ${o?.message||"cancelled"}`)}return t.setBiometricPreference({required:!1,attestation:s})});r.success||(console.error(`Failed: ${r.error||"unknown error"}`),process.exit(1)),console.log("Touch ID is no longer required for payments.")}catch(e){console.error("Error:",e.message),process.exit(1)}});var Xt=ot.command("shell-hud").description("Manage the shell prompt HUD (opt-in \u2014 prefer: visa-cli config hud enable)").addHelpCommand(!1);function us(){let e=Nr();e.installed||(console.error(e.message),process.exit(1)),console.log(e.message)}function ds(){let e=Lr();e.removed||(console.error(e.message),process.exit(1)),console.log(e.message)}Xt.command("install").description("Install the persistent shell HUD into your zsh or bash rc file").action(us);Xt.command("enable").description("Enable the persistent shell HUD").action(us);Xt.command("uninstall").description("Remove the persistent shell HUD from your shell rc file").action(ds);Xt.command("disable").description("Disable the persistent shell HUD").action(ds);Xt.command("segment").description("Print the cached shell HUD segment").action(()=>{process.stdout.write(`${Dr()}
|
|
230
|
+
`)});Xt.command("doctor").description("Diagnose shell HUD installation and connectivity").action(async()=>{let{existsSync:e,readFileSync:t}=await import("fs"),n=!0,r=(d,g,f)=>{console.log(` ${g?"\u2713":"\u2717"} ${d}: ${f}`),g||(n=!1)};console.log(`Shell HUD Doctor
|
|
231
|
+
`);let s=yn();if(r("Shell detected",!!s,s??"none (zsh, bash, or PowerShell required)"),s){let d=Bn(s),g=e(d);if(r("RC file exists",g,d.replace(X.homedir(),"~")),g){let x=t(d,"utf-8").includes("visa-cli shell hud v2");r("HUD block installed",!!x,x?"found in rc file":"missing \u2014 run: visa-cli config shell-hud install")}}let o=vt(),i=e(o);if(r("Cache file",i,i?o.replace(X.homedir(),"~"):"missing \u2014 HUD has not refreshed yet"),i)try{let d=JSON.parse(t(o,"utf-8")),g=Date.now()-(d.renderedAt??0),f=Math.round(g/1e3),x=f<=30;console.log(` ${x?"\u2713":"\u26A0"} Cache freshness: ${f}s old${x?"":" (stale \u2014 will refresh on next prompt)"}`)}catch{r("Cache readable",!1,"corrupt JSON")}let a=Mr(),l=e(a),c="missing";if(l)try{c=t(a,"utf-8").trim().slice(0,80)}catch{c="unreadable"}r("Line file",l,c);let u=!1;try{u=!!await D.getSessionToken()}catch{}if(r("Auth token",u,u?"found in keychain":"missing \u2014 run: visa-cli setup"),u)try{await ie().getStatus(),r("API connectivity",!0,"GET /v1/status OK")}catch(d){let g=d instanceof Error?d.message:"unknown error";r("API connectivity",!1,g)}console.log(n?`
|
|
232
|
+
All checks passed.`:`
|
|
233
|
+
Some checks failed \u2014 see above.`),n||process.exit(1)});async function Tl(e){if(!(!e.force&&Za()))try{let t=ie(),[n,r,s,o]=await Promise.allSettled([t.getStatus(),t.getBalance(),t.listAppApiKeys(),t.getTransactions({limit:1})]);if(n.status==="rejected")throw n.reason;let i=n.value,a=i.prepaidBalance?.cents;if(typeof a=="number"){i.balanceCents=a;let u=i.prepaidBalance?.amountUsd;i.amountUsd=typeof u=="number"?u:a/100}if(r.status==="fulfilled"&&r.value.success&&(i.balanceCents=r.value.balanceCents,i.amountUsd=r.value.amountUsd),s.status==="fulfilled"&&s.value.success&&(i.apiKeyCount=Array.isArray(s.value.keys)?s.value.keys.length:0),o.status==="fulfilled"){let u=o.value,g=(Array.isArray(u)?u:Array.isArray(u.transactions)?u.transactions:[]).find(f=>f&&typeof f.tool_name=="string"&&f.tool_name.length>0);g&&g.created_at&&(i.lastService={toolName:g.tool_name,createdAt:g.created_at})}let l={currentVersion:t.getClientVersion(),latestVersion:t.lastSignals.updateAvailable?.latestVersion,updateCheckDisabled:De()},c=lo(i,l);uo(c,i)}catch(t){let n=t instanceof Error?t.message:"unknown refresh failure";Xa(n)}finally{Fn()}}Xt.command("refresh").description("Refresh the shell HUD cache (no-op if cache is fresh unless --force)").option("--force","Bypass the cache freshness gate and always refresh").action(Tl);var Qt=K.command("shell-hud",{hidden:!0}).description("Deprecated alias for `config shell-hud`");Qt.command("install").description("Install the persistent shell HUD into your zsh or bash rc file").action(us);Qt.command("enable").description("Enable the persistent shell HUD").action(us);Qt.command("uninstall").description("Remove the persistent shell HUD from your shell rc file").action(ds);Qt.command("disable").description("Disable the persistent shell HUD").action(ds);Qt.command("segment").description("Print the cached shell HUD segment").action(()=>{process.stdout.write(`${Dr()}
|
|
234
|
+
`)});Qt.command("doctor").description("Show the new shell HUD doctor command").action(()=>{console.log("Run: visa-cli config shell-hud doctor")});Qt.command("refresh").description("Refresh the shell HUD cache (no-op if cache is fresh unless --force)").option("--force","Bypass the cache freshness gate and always refresh").action(Tl);async function El(e){try{let t=await Ei(),n=Dr(),r=n,s=n.split(`
|
|
235
|
+
`)[0],o=Qa();if(!t&&s.includes("loading")){process.stdout.write(`VISA | HUD not initialized \u2014 run: visa-cli config hud enable
|
|
236
|
+
`);return}if(e.json){let a=await Mi(r,t,o);process.stdout.write(`${JSON.stringify(a,null,2)}
|
|
237
|
+
`);return}let i=await $i(r,t,o);process.stdout.write(`${i}
|
|
238
|
+
`)}catch(t){let n=t instanceof Error?t.message:"unknown error";console.error(`Failed to render Visa HUD: ${n}`),process.exit(1)}}ot.command("statusline").description("Output the Visa HUD for agent statusline integrations").option("--json","Output structured JSON for clients that render their own HUD").action(El);K.command("statusline",{hidden:!0}).description("Deprecated alias for `config statusline`").option("--json","Output structured JSON for clients that render their own HUD").action(El);var Cn=ot.command("hud").description("Manage the Visa spend HUD \u2014 one command for all surfaces").addHelpCommand(!1);Cn.description("Show which HUD surfaces are currently enabled").action(()=>{let e="\x1B[1m",t="\x1B[2m",n="\x1B[32m",r="\x1B[33m",s="\x1B[0m";console.log(`
|
|
239
|
+
${e}Visa HUD Status${s}
|
|
240
|
+
`);let o=st.join(X.homedir(),".claude","settings.json"),i=!1,a=!1;try{if(Oe.existsSync(o)){let f=JSON.parse(Oe.readFileSync(o,"utf-8")),x=typeof f.statusLine=="object"?f.statusLine.command:"";i=Et(x),a=!!f.statusLine&&!i}}catch{}let l=i?`${n}\u2713${s}`:`${t}\u2717${s}`,c=i?"registered in ~/.claude/settings.json":a?`${r}another HUD is configured${s} \u2014 edit settings.json to switch`:"not enabled";console.log(` ${l} ${e}Claude Code${s} (statusLine) ${c}`);let u=Or(),d=u?`${n}\u2713${s}`:`${t}\u2717${s}`;console.log(` ${d} ${e}Shell prompt${s} ${u?"installed in shell rc file":"not installed (opt-in)"}`),console.log(`
|
|
241
|
+
${e}Quick start:${s}`),i||console.log(` visa-cli config hud enable ${t}# Claude Code statusLine (recommended)${s}`),u||console.log(` visa-cli config hud enable shell ${t}# zsh/bash prompt line (opt-in)${s}`),i&&u&&console.log(` ${n}All surfaces enabled.${s}`),(i||u)&&console.log(` visa-cli config hud disable [shell] ${t}# remove a surface${s}`),console.log(` visa-cli config hud doctor ${t}# diagnose connectivity${s}`),console.log()});Cn.command("enable").description("Enable the Visa HUD \u2014 claude (default), shell, codex, or all").argument("[surface]","Target surface: claude (default), shell, codex, or all").action(e=>{let t=e??"claude",n=Rs(t);if(t==="shell"||t==="prompt"){let r=Nr();r.installed||(console.error(r.message),process.exit(1)),console.log(r.message);return}if(n||(console.error(`Unknown HUD surface: ${t}`),console.error("Supported: claude (default), shell, codex, all"),process.exit(1)),n==="claude"||n==="claude-code"||n==="all"){let r=st.join(X.homedir(),".claude","settings.json"),s=mr(r);console.log(s.message),(s.installed==="error"||s.installed==="malformed-json")&&process.exit(1)}if(n==="codex"||n==="all"){let r=Nr();console.log(r.message),console.log("Codex structured HUD payload is available with: visa-cli config statusline --json"),r.installed||process.exit(1)}});Cn.command("disable").description("Disable the Visa HUD from a surface: claude (default), shell, codex, or all").argument("[surface]","Target surface: claude (default), shell, codex, or all").action(e=>{let t=e??"claude";if(t==="shell"||t==="prompt"){let o=Lr();o.removed||(console.error(o.message),process.exit(1)),console.log(o.message);return}let n=Rs(t);n||(console.error(`Unknown HUD surface: ${t}`),console.error("Supported: claude (default), shell, codex, all"),process.exit(1));let r=!1,s=!1;if(n==="claude"||n==="claude-code"||n==="all"){let o=st.join(X.homedir(),".claude","settings.json"),i=ks(o);console.log(i.message),i.removed&&(s=!0),!i.removed&&n!=="all"&&(r=!0)}if(n==="codex"||n==="all"){let o=Lr();console.log(o.message),o.removed&&(s=!0),!o.removed&&n!=="all"&&(r=!0)}n==="all"&&!s&&(r=!0),r&&process.exit(1)});Cn.command("doctor").description("Diagnose HUD installation and connectivity across all surfaces").action(async()=>{let e=!0,t=(l,c,u)=>{console.log(` ${c?"\u2713":"\u2717"} ${l}: ${u}`),c||(e=!1)};console.log(`Visa HUD Doctor
|
|
242
|
+
`);let n=st.join(X.homedir(),".claude","settings.json"),r=!1;try{if(Oe.existsSync(n)){let l=JSON.parse(Oe.readFileSync(n,"utf-8")),c=typeof l.statusLine=="object"?l.statusLine.command:"";r=Et(c)}}catch{}t("Claude Code statusLine",r,r?"registered":"not registered \u2014 run: visa-cli config hud enable");let s=yn();if(t("Shell detected",!!s,s??"none (zsh, bash, or PowerShell required)"),s){let l=Bn(s),c=Oe.existsSync(l);if(t("RC file exists",c,l.replace(X.homedir(),"~")),c){let d=Oe.readFileSync(l,"utf-8").includes("visa-cli shell hud v2");console.log(` ${d?"\u2713":"\u2013"} Shell HUD block: ${d?"installed":"not installed (opt-in \u2014 run: visa-cli config hud enable shell)"}`)}}let o=vt(),i=Oe.existsSync(o);if(t("HUD cache file",i,i?o.replace(X.homedir(),"~"):"missing \u2014 HUD has not refreshed yet"),i)try{let l=JSON.parse(Oe.readFileSync(o,"utf-8")),c=Date.now()-(l.renderedAt??0),u=Math.round(c/1e3),d=u<=30;console.log(` ${d?"\u2713":"\u26A0"} Cache freshness: ${u}s old${d?"":" (stale \u2014 will refresh on next prompt)"}`)}catch{t("Cache readable",!1,"corrupt JSON")}let a=!1;try{a=!!await D.getSessionToken()}catch{}if(t("Auth token",a,a?"found in keychain":"missing \u2014 run: visa-cli setup"),a)try{await ie().getStatus(),t("API connectivity",!0,"GET /v1/status OK")}catch(l){let c=l instanceof Error?l.message:"unknown error";t("API connectivity",!1,c)}console.log(e?`
|
|
198
243
|
All checks passed.`:`
|
|
199
|
-
Some checks failed \u2014 see above.`),
|
|
200
|
-
|
|
201
|
-
`);return}let
|
|
202
|
-
`)}catch(
|
|
244
|
+
Some checks failed \u2014 see above.`),e||process.exit(1)});Cn.command("enable-claude").description("Alias for: hud enable claude").action(()=>{let e=st.join(X.homedir(),".claude","settings.json"),t=mr(e);console.log(t.message),(t.installed==="error"||t.installed==="malformed-json")&&process.exit(1)});Cn.command("disable-claude").description("Alias for: hud disable claude").action(()=>{let e=st.join(X.homedir(),".claude","settings.json"),t=ks(e);console.log(t.message),t.removed||process.exit(1)});var kn=K.command("merchants").description("List discoverable platform merchants and refresh JIT tools").addHelpCommand(!1);kn.description("Discover and run paid merchant tools");kn.command("list").description("List live platform merchants and the tools they expose").option("--json","Print machine-readable JSON").action(async e=>{try{let t=new pe(()=>D.getSessionToken()),n=await t.listPublicMerchants();if(n.length===0){e.json?console.log(JSON.stringify({merchants:[]},null,2)):console.log(`
|
|
245
|
+
No live platform merchants on this auth server.
|
|
246
|
+
`);return}let r=await Promise.all(n.map(async a=>{let l=await t.getPublicMerchantDiscover(a.slug);return{slug:a.slug,display_name:a.display_name,provider:l?.title??a.display_name,merchant_of_record:l?.merchant_of_record??a.display_name,upstream:l?.upstream,tools:(l?.routes??[]).filter(c=>c.tool_id).map(c=>({tool_id:c.tool_id,mcp_name:c.tool_id.replace(/-/g,"_"),method:c.method,path:c.path,price_cents:c.price_cents,category:c.category??null,description:c.description??null}))}}));if(e.json){console.log(JSON.stringify({merchants:r},null,2));return}let s="\x1B[1m",o="\x1B[2m",i="\x1B[0m";console.log();for(let a of r){let l=a.merchant_of_record!==a.provider?` ${o}(MoR: ${a.merchant_of_record})${i}`:"";if(console.log(` ${s}${a.provider}${i}${l} ${o}\u2014 slug: ${a.slug}${i}`),a.upstream&&console.log(` ${o}upstream: ${a.upstream}${i}`),a.tools.length===0)console.log(` ${o}(no routes with tool_id \u2014 agents can't see this merchant yet)${i}`);else for(let c of a.tools){let u=c.category?` ${o}[${c.category}]${i}`:"",d=`$${(c.price_cents/100).toFixed(2)}`;console.log(` ${c.tool_id}${u} ${o}\u2192 Claude: ${c.mcp_name}${i} ${d} ${o}${c.method} ${c.path}${i}`),c.description&&console.log(` ${o}${c.description}${i}`)}console.log()}console.log(` ${o}To enable JIT tools in your MCP server, set: visa-cli config set merchants.discover all (or =<slug,...>)${i}
|
|
247
|
+
`)}catch(t){console.error("Error:",t.message),process.exit(1)}});kn.command("tools").description("List available merchant tools").option("--category <category>","Filter by category (image, video, audio, 3d, llm)").option("--query <query>","Search by intent or keyword").option("--verbose","Show grouped cards with descriptions").option("--json","Print machine-readable JSON").action(async e=>{try{let t=ie(),n=await Vg(t,{query:e.query,category:e.category});if(e.json){console.log(JSON.stringify({tools:n},null,2));return}if(n.length===0){console.log("No merchant tools found. Try: visa-cli merchants tools --category image");return}e.verbose?Lg(n):Ng(n)}catch(t){console.error("Error:",t.message),process.exit(1)}});kn.command("describe <tool>").description("Show tool schema, price, and examples").action(async e=>{try{let n=await ie().catalogTool(e,"discover_tools");n||(console.error(`Tool not found: ${e}`),console.error('Search with: visa-cli merchants tools --query "what you want to do"'),process.exit(1)),console.log(`
|
|
248
|
+
${n.id}
|
|
249
|
+
`),console.log(n.description),console.log(`
|
|
250
|
+
Price`),console.log(` ${Go(n.priceCents,n.priceDisplay)}`),console.log(`
|
|
251
|
+
Provider`),console.log(` ${n.provider} \xB7 ${n.category}`),console.log(`
|
|
252
|
+
Inputs`);let r=n.inputSchema?.properties;if(r&&typeof r=="object"&&!Array.isArray(r)){let o=Array.isArray(n.inputSchema.required)?new Set(n.inputSchema.required):new Set;for(let[i,a]of Object.entries(r)){let l=o.has(i)?"required":"optional",c=a?.description?` - ${a.description}`:"";console.log(` ${i.padEnd(12)} ${l}${c}`)}}else console.log(" No published schema. Use --json with the request body.");console.log(`
|
|
253
|
+
Examples`);let s=el(n);console.log(` visa-cli merchants run ${n.id} --json '${JSON.stringify(s)}'`),n.category==="image"&&console.log(' visa-cli generate image "a lobster on a marble counter"'),console.log()}catch(t){console.error("Error:",t.message),process.exit(1)}});function eh(e){return["generate_image_card","generate_image_fast_card","generate_video_tempo_card","generate_music_tempo_card","check_music_status_tempo_card","query_onchain_prices_card"].includes(e)}async function Al(e,t,n){return eh(e)?Fe.shortcut(e,t,n):Fe.executeTool({tool_id:e,params:t},n,"execute_tool")}kn.command("run <tool>").description("Run any merchant tool by id").option("--json <json>","Tool parameters as a JSON object").option("--prompt <prompt>","Prompt parameter for prompt-shaped tools").action(async(e,t)=>{try{let n=Mg(t.json,"--json");t.prompt&&(n.prompt=t.prompt),console.log(`Running ${e}`);let r=await Al(e,n,`visa-cli merchants run ${e}`);vl(r),Sl(r)}catch(n){console.error("Error:",n.message),process.exit(1)}});kn.command("refresh").description("Hint: restart the MCP server (Claude/Cursor) to refresh discovered tools \u2014 discovery is in-process").action(()=>{console.log(`
|
|
254
|
+
Platform-merchant tool discovery is cached in-process by the MCP server.`),console.log(" Cache TTL: VISA_MERCHANT_DISCOVER_TTL_MS (default 300000ms = 5min)."),console.log(` To force-refresh now, restart Claude / Cursor \u2014 the next tools/list will re-fetch.
|
|
255
|
+
`)});var tr=K.command("generate").description("Generate media with merchant tools").addHelpCommand(!1);async function nr(e){console.log(`
|
|
256
|
+
${e.kind}
|
|
257
|
+
`),console.log(`Using: ${e.toolId}`),console.log(`Prompt: ${e.prompt}
|
|
258
|
+
`);let t=await Al(e.toolId,e.params,`visa-cli generate ${e.kind.toLowerCase()}: ${e.prompt}`);vl(t),Sl(t)}var th=(e,t)=>n=>(t.includes(n)||K.error(`error: option '${e}' accepts ${t.map(r=>`'${r}'`).join(", ")} (got '${n}')`,{exitCode:2}),n);tr.command("image <prompt>").description("Generate an image from a prompt").option("--quality <quality>","Image quality: standard or high",th("--quality",["standard","high"]),"standard").option("--fast","Use the fast image tool").option("--tool <tool>","Exact tool id override").action(async(e,t)=>{try{let n=t.tool??(t.fast||t.quality!=="high"?"generate_image_fast_card":"generate_image_card");await nr({kind:"Image generation",toolId:n,params:{prompt:e},prompt:e})}catch(n){console.error("Error:",n.message),process.exit(1)}});tr.command("video <prompt>").description("Generate a video from a prompt").option("--tool <tool>","Exact tool id override").option("--aspect-ratio <ratio>","Aspect ratio, when supported by the selected tool").option("--duration <seconds>","Duration in seconds, when supported by the selected tool").action(async(e,t)=>{try{let n={prompt:e};t.aspectRatio&&(n.aspect_ratio=t.aspectRatio),t.duration&&(n.duration=Number(t.duration)),await nr({kind:"Video generation",toolId:t.tool??"generate_video_tempo_card",params:n,prompt:e})}catch(n){console.error("Error:",n.message),process.exit(1)}});tr.command("music <prompt>").description("Generate music from a prompt").option("--tool <tool>","Exact tool id override").option("--instrumental","Generate instrumental music").option("--duration <seconds>","Duration in seconds, when supported by the selected tool").action(async(e,t)=>{try{let n={prompt:e};t.instrumental&&(n.instrumental=!0),t.duration&&(n.duration=Number(t.duration)),await nr({kind:"Music generation",toolId:t.tool??"fal-ace-step-music",params:n,prompt:e})}catch(n){console.error("Error:",n.message),process.exit(1)}});tr.command("speech <text>").description("Generate speech from text").option("--tool <tool>","Exact tool id override").option("--ref-audio-url <url>","Reference audio URL for voice cloning").option("--ref-text <text>","Transcription of reference audio").option("--remove-silence","Remove silence from generated speech").action(async(e,t)=>{try{let n={gen_text:e};t.refAudioUrl&&(n.ref_audio_url=t.refAudioUrl),t.refText&&(n.ref_text=t.refText),t.removeSilence&&(n.remove_silence=!0),await nr({kind:"Speech generation",toolId:t.tool??"generate_speech_card",params:n,prompt:e})}catch(n){console.error("Error:",n.message),process.exit(1)}});tr.command("3d <prompt>").alias("model").description("Generate a 3D model from a prompt").option("--tool <tool>","Exact tool id override").option("--style <style>","Style prompt for the generated model").option("--negative <prompt>","Negative prompt").option("--art-style <style>","Art style, when supported by the selected tool").action(async(e,t)=>{try{let n={object_prompt:e};t.style&&(n.style_prompt=t.style),t.negative&&(n.negative_prompt=t.negative),t.artStyle&&(n.art_style=t.artStyle),await nr({kind:"3D generation",toolId:t.tool??"generate_3d_card",params:n,prompt:e})}catch(n){console.error("Error:",n.message),process.exit(1)}});K.command("uninstall [client]").description("Remove MCP server from an AI client").option("--all","Remove from all clients").option("--scope <scope>","Uninstall scope: global or project","global").action(async(e,t)=>{try{let n=t.scope==="project"?"project":"global";if(t.all){let o=[];for(let i of Me)Vo(i,n).removed&&o.push(i.displayName);o.length>0?console.log(`Removed visa-cli from: ${o.join(", ")}.`):console.log("visa-cli was not installed in any client.");return}e||(console.error("Usage: visa-cli uninstall <client>"),console.error(" visa-cli uninstall --all"),console.error(`
|
|
259
|
+
Supported clients: ${Me.map(o=>o.id).join(", ")}`),process.exit(1));let r=Do(e);r||(console.error(`Unknown client: ${e}`),console.error(`Supported clients: ${Me.map(o=>o.id).join(", ")}`),process.exit(1));let s=Vo(r,n);s.removed?console.log(`Removed visa-cli from ${s.configPath}`):console.log(`visa-cli was not installed for ${r.displayName}.`)}catch(n){console.error("Error:",n.message),process.exit(1)}});K.hook("postAction",()=>{if(Xn){Xn=!1;return}as&&Qc(as.lastSignals)});Wg(["setup","install","status","cards","tokens","balance","merchants","generate","config","feedback","update","uninstall"]);wl(K);K.parseAsync().catch(async e=>{console.error("Error:",e instanceof Error?e.message:String(e));let{reportFatal:t}=await Promise.resolve().then(()=>(is(),os));await t(e)});process.on("uncaughtException",async e=>{console.error("Uncaught exception:",e);let{reportFatal:t}=await Promise.resolve().then(()=>(is(),os));await t(e)});process.on("unhandledRejection",async e=>{console.error("Unhandled rejection:",e);let{reportFatal:t}=await Promise.resolve().then(()=>(is(),os));await t(e)});
|