@visa/cli 2.0.0-rc.9 → 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/dist/cli.js CHANGED
@@ -1,18 +1,8 @@
1
- "use strict";var U8=Object.create;var Ml=Object.defineProperty;var w8=Object.getOwnPropertyDescriptor;var V8=Object.getOwnPropertyNames;var B8=Object.getPrototypeOf,G8=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 V8(e))!G8.call(t,o)&&o!==n&&Ml(t,o,{get:()=>e[o],enumerable:!(r=w8(e,o))||r.enumerable});return t};var I=(t,e,n)=>(n=t!=null?U8(B8(t)):{},cN(e||!t||!t.__esModule?Ml(n,"default",{value:t,enumerable:!0}):n,t)),C=t=>cN(Ml({},"__esModule",{value:!0}),t);var IS=f((q0e,Q8)=>{Q8.exports={name:"@visa/cli",version:"2.0.0-rc.9",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 NJ(t){let e=new Set([t]),n=new Set,r=t.match(VI);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(VI);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 VI,BI,GI=U(()=>{sT();VI=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;BI=NJ(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||!BI(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 IJ,Oc,Nc,hs=U(()=>{sT();GI();IJ=Br.split(".")[0],Oc=Symbol.for(`opentelemetry.js.api.${IJ}`),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,HI=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 kI(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 FI=U(()=>{ap()});var CJ,nt,gs=U(()=>{HI();FI();ap();hs();CJ="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=kI((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(CJ,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,jI=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 $I,YI=U(()=>{$I=Symbol("BaggageEntryMetadata")});function qI(t={}){return new cp(new Map(Object.entries(t)))}function KI(t){return typeof t!="string"&&(PJ.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:$I,toString(){return t}}}var PJ,iT=U(()=>{gs();jI();YI();PJ=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,WI=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 XI(){return mT}var lT,hi,pT,dT,_T,ET,Pc,fT,ST,TT,mT,MJ,yJ,vJ,bJ,LJ,DJ,xJ,hT=U(()=>{lT=class{constructor(){}createGauge(e,n){return yJ}createHistogram(e,n){return vJ}createCounter(e,n){return MJ}createUpDownCounter(e,n){return bJ}createObservableGauge(e,n){return DJ}createObservableCounter(e,n){return LJ}createObservableUpDownCounter(e,n){return xJ}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,MJ=new pT,yJ=new _T,vJ=new ET,bJ=new dT,LJ=new fT,DJ=new ST,xJ=new TT});var lp,zI=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,JI=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,UJ,ar,Mc=U(()=>{JI();hs();gs();AT="context",UJ=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)||UJ}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 QI(){return Tp(ar.getInstance().active())}function vc(t,e){return t.setValue(OT,e)}function ZI(t){return t.deleteValue(OT)}function eC(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 tC(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 tC(t,32)&&t!==As}function CT(t){return tC(t,16)&&t!==yc}function Gr(t){return IT(t.traceId)&&CT(t.spanId)}function nC(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 wJ(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 wJ(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 VJ,Ai,yT=U(()=>{MT();VJ=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):VJ}}});var Ap,rC=U(()=>{MT();Ap=class{getTracer(e,n,r){return new gi}}});var BJ,Rs,vT=U(()=>{yT();rC();BJ=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:BJ}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,oC=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,sC=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,iC=U(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Se||(Se={}))});function aC(t){return kJ.test(t)}function cC(t){return FJ.test(t)&&!jJ.test(t)}var bT,GJ,HJ,kJ,FJ,jJ,uC=U(()=>{bT="[_0-9a-z-*/]",GJ=`[a-z]${bT}{0,255}`,HJ=`[a-z0-9]${bT}{0,240}@[a-z]${bT}{0,13}`,kJ=new RegExp(`^(?:${GJ}|${HJ})$`),FJ=/^[ -~]{0,255}[!-~]$/,jJ=/,|=/});var lC,$J,pC,dC,Op,_C=U(()=>{uC();lC=32,$J=512,pC=",",dC="=",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+dC+this.get(n)),e),[]).join(pC)}_parse(e){e.length>$J||(this._internalState=e.split(pC).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(dC);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);aC(i)&&cC(a)&&n.set(i,a)}return n},new Map),this._internalState.size>lC&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,lC))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function EC(t){return new Op(t)}var fC=U(()=>{_C()});var k,SC=U(()=>{Mc();k=ar.getInstance()});var an,TC=U(()=>{gs();an=nt.instance()});var LT,mC,hC=U(()=>{hT();LT=class{getMeter(e,n,r){return mT}},mC=new LT});var DT,Np,gC=U(()=>{hC();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)||mC}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){ir(DT,nt.instance())}}});var xT,AC=U(()=>{gC();xT=Np.getInstance()});var Ip,RC=U(()=>{Ip=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function wT(t){return t.getValue(UT)||void 0}function OC(){return wT(ar.getInstance().active())}function NC(t,e){return t.setValue(UT,e)}function IC(t){return t.deleteValue(UT)}var UT,CC=U(()=>{Mc();Cc();UT=Bn("OpenTelemetry Baggage Key")});var VT,YJ,Cp,PC=U(()=>{hs();RC();gT();CC();iT();gs();VT="propagation",YJ=new Ip,Cp=class t{constructor(){this.createBaggage=qI,this.getBaggage=wT,this.getActiveBaggage=OC,this.setBaggage=NC,this.deleteBaggage=IC}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)||YJ}}});var xt,MC=U(()=>{PC();xt=Cp.getInstance()});var BT,Pp,yC=U(()=>{hs();vT();gp();NT();gs();BT="trace",Pp=class t{constructor(){this._proxyTracerProvider=new Rs,this.wrapSpanContext=nC,this.isSpanContextValid=Gr,this.deleteSpan=ZI,this.getSpan=Tp,this.getActiveSpan=QI,this.getSpanContext=mp,this.setSpan=vc,this.setSpanContext=eC}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,vC=U(()=>{yC();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:()=>KI,context:()=>k,createContextKey:()=>Bn,createNoopMeter:()=>XI,createTraceState:()=>EC,default:()=>qJ,defaultTextMapGetter:()=>pp,defaultTextMapSetter:()=>dp,diag:()=>an,isSpanContextValid:()=>Gr,isValidSpanId:()=>CT,isValidTraceId:()=>IT,metrics:()=>xT,propagation:()=>xt,trace:()=>K});var qJ,y=U(()=>{iT();Cc();WI();ap();hT();zI();gT();yT();vT();oC();sC();iC();RT();fC();gp();fp();SC();TC();AC();MC();vC();qJ={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 KJ=(y(),C(x)),GT=(0,KJ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function WJ(t){return t.setValue(GT,!0)}So.suppressTracing=WJ;function XJ(t){return t.deleteValue(GT)}So.unsuppressTracing=XJ;function zJ(t){return t.getValue(GT)===!0}So.isTracingSuppressed=zJ});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 JJ=(y(),C(x)),Os=HT();function QJ(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=QJ;function ZJ(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=ZJ;function bC(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,JJ.baggageEntryMetadataFromString)(e.join(Os.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:i}}ur.parsePairKeyValue=bC;function eQ(t){return typeof t!="string"||t.length===0?{}:t.split(Os.BAGGAGE_ITEMS_SEPARATOR).map(e=>bC(e)).filter(e=>e!==void 0&&e.value.length>0).reduce((e,n)=>(e[n.key]=n.value,e),{})}ur.parseKeyPairsIntoRecord=eQ});var LC=f(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});Mp.W3CBaggagePropagator=void 0;var FT=(y(),C(x)),tQ=bc(),Ns=HT(),jT=kT(),$T=class{inject(e,n,r){let o=FT.propagation.getBaggage(e);if(!o||(0,tQ.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 DC=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 BC=f(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.isAttributeValue=To.isAttributeKey=To.sanitizeAttributes=void 0;var xC=(y(),C(x));function nQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let[n,r]of Object.entries(t)){if(!UC(n)){xC.diag.warn(`Invalid attribute key: ${n}`);continue}if(!wC(r)){xC.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}To.sanitizeAttributes=nQ;function UC(t){return typeof t=="string"&&t.length>0}To.isAttributeKey=UC;function wC(t){return t==null?!0:Array.isArray(t)?rQ(t):VC(t)}To.isAttributeValue=wC;function rQ(t){let e;for(let n of t)if(n!=null){if(!e){if(VC(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}function VC(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 oQ=(y(),C(x));function sQ(){return t=>{oQ.diag.error(iQ(t))}}vp.loggingErrorHandler=sQ;function iQ(t){return typeof t=="string"?t:JSON.stringify(aQ(t))}function aQ(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 cQ=qT(),GC=(0,cQ.loggingErrorHandler)();function uQ(t){GC=t}Ri.setGlobalErrorHandler=uQ;function lQ(t){try{GC(t)}catch{}}Ri.globalErrorHandler=lQ});var WT=f(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.TracesSamplerValues=void 0;var pQ;(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"})(pQ=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(),C(x)),dQ=WT(),_Q=",",EQ=["OTEL_SDK_DISABLED"];function fQ(t){return EQ.indexOf(t)>-1}var SQ=["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 TQ(t){return SQ.indexOf(t)>-1}var mQ=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function hQ(t){return mQ.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:dQ.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 gQ(t,e,n){if(typeof n[t]>"u")return;let r=String(n[t]);e[t]=r.toLowerCase()==="true"}function AQ(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 RQ(t,e,n,r=_Q){let o=n[t];typeof o=="string"&&(e[t]=o.split(r).map(s=>s.trim()))}var OQ={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 NQ(t,e,n){let r=n[t];if(typeof r=="string"){let o=OQ[r.toUpperCase()];o!=null&&(e[t]=o)}}function IQ(t){let e={};for(let n in Ne.DEFAULT_ENVIRONMENT){let r=n;switch(r){case"OTEL_LOG_LEVEL":NQ(r,e,t);break;default:if(fQ(r))gQ(r,e,t);else if(TQ(r))AQ(r,e,t);else if(hQ(r))RQ(r,e,t);else{let o=t[r];typeof o<"u"&&o!==null&&(e[r]=String(o))}}}return e}Ne.parseEnvironment=IQ});var HC=f(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.getEnvWithoutDefaults=Oi.getEnv=void 0;var zT=XT();function CQ(){let t=(0,zT.parseEnvironment)(process.env);return Object.assign({},zT.DEFAULT_ENVIRONMENT,t)}Oi.getEnv=CQ;function PQ(){return(0,zT.parseEnvironment)(process.env)}Oi.getEnvWithoutDefaults=PQ});var kC=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 FC(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function MQ(t){let e=new Uint8Array(t.length/2),n=0;for(let r=0;r<t.length;r+=2){let o=FC(t.charCodeAt(r)),s=FC(t.charCodeAt(r+1));e[n++]=o<<4|s}return e}Lp.hexToBinary=MQ});var jC=f(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.hexToBase64=void 0;var yQ=JT();function vQ(t){return Buffer.from((0,yQ.hexToBinary)(t)).toString("base64")}Dp.hexToBase64=vQ});var qC=f(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.RandomIdGenerator=void 0;var bQ=8,YC=16,QT=class{constructor(){this.generateTraceId=$C(YC),this.generateSpanId=$C(bQ)}};Up.RandomIdGenerator=QT;var xp=Buffer.allocUnsafe(YC);function $C(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 KC=f(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.otperformance=void 0;var LQ=require("perf_hooks");wp.otperformance=LQ.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 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,dy,_y,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,zZ,JZ,QZ,ZZ,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,sv,iv,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,$7,Y7,q7,K7,av,cv,uv,lv,pv,dv,_v,Ev,fv,Sv,Tv,W7,X7,z7,J7,Q7,Z7,eee,tee,nee,ree,oee,see,mv,hv,gv,Av,Rv,iee,aee,cee,uee,lee,pee,Ov,Nv,Iv,dee,_ee,Eee,fee,Cv,Pv,Mv,yv,See,Tee,mee,hee,gee,vv,bv,Lv,Dv,xv,Uv,wv,Aee,Ree,Oee,Nee,Iee,Cee,Pee,Mee,Vv,Bv,Gv,Hv,kv,yee,vee,bee,Lee,Dee,xee,Fv,jv,$v,Yv,qv,Kv,Wv,Xv,zv,Jv,Qv,Zv,eb,tb,nb,rb,ob,sb,ib,ab,cb,Uee,wee,Vee,Bee,Gee,Hee,kee,Fee,jee,$ee,Yee,qee,Kee,Wee,Xee,zee,Jee,Qee,Zee,ete,tte,nte,ub,lb,pb,db,_b,rte,ote,ste,ite,ate,cte,Eb,fb,ute,lte,pte,Sb,Tb,dte,_te,Ete,mb,hb,gb,Ab,Rb,Ob,Nb,Ib,Cb,Pb,Mb,yb,vb,bb,Lb,Db,xb,fte,Ste,Tte,mte,hte,gte,Ate,Rte,Ote,Nte,Ite,Cte,Pte,Mte,yte,vte,bte,Lte,Ub,wb,Dte,xte,Ute,Vb=U(()=>{em();WC="aws.lambda.invoked_arn",XC="db.system",zC="db.connection_string",JC="db.user",QC="db.jdbc.driver_classname",ZC="db.name",eP="db.statement",tP="db.operation",nP="db.mssql.instance_name",rP="db.cassandra.keyspace",oP="db.cassandra.page_size",sP="db.cassandra.consistency_level",iP="db.cassandra.table",aP="db.cassandra.idempotence",cP="db.cassandra.speculative_execution_count",uP="db.cassandra.coordinator.id",lP="db.cassandra.coordinator.dc",pP="db.hbase.namespace",dP="db.redis.database_index",_P="db.mongodb.collection",EP="db.sql.table",fP="exception.type",SP="exception.message",TP="exception.stacktrace",mP="exception.escaped",hP="faas.trigger",gP="faas.execution",AP="faas.document.collection",RP="faas.document.operation",OP="faas.document.time",NP="faas.document.name",IP="faas.time",CP="faas.cron",PP="faas.coldstart",MP="faas.invoked_name",yP="faas.invoked_provider",vP="faas.invoked_region",bP="net.transport",LP="net.peer.ip",DP="net.peer.port",xP="net.peer.name",UP="net.host.ip",wP="net.host.port",VP="net.host.name",BP="net.host.connection.type",GP="net.host.connection.subtype",HP="net.host.carrier.name",kP="net.host.carrier.mcc",FP="net.host.carrier.mnc",jP="net.host.carrier.icc",$P="peer.service",YP="enduser.id",qP="enduser.role",KP="enduser.scope",WP="thread.id",XP="thread.name",zP="code.function",JP="code.namespace",QP="code.filepath",ZP="code.lineno",eM="http.method",tM="http.url",nM="http.target",rM="http.host",oM="http.scheme",sM="http.status_code",iM="http.flavor",aM="http.user_agent",cM="http.request_content_length",uM="http.request_content_length_uncompressed",lM="http.response_content_length",pM="http.response_content_length_uncompressed",dM="http.server_name",_M="http.route",EM="http.client_ip",fM="aws.dynamodb.table_names",SM="aws.dynamodb.consumed_capacity",TM="aws.dynamodb.item_collection_metrics",mM="aws.dynamodb.provisioned_read_capacity",hM="aws.dynamodb.provisioned_write_capacity",gM="aws.dynamodb.consistent_read",AM="aws.dynamodb.projection",RM="aws.dynamodb.limit",OM="aws.dynamodb.attributes_to_get",NM="aws.dynamodb.index_name",IM="aws.dynamodb.select",CM="aws.dynamodb.global_secondary_indexes",PM="aws.dynamodb.local_secondary_indexes",MM="aws.dynamodb.exclusive_start_table",yM="aws.dynamodb.table_count",vM="aws.dynamodb.scan_forward",bM="aws.dynamodb.segment",LM="aws.dynamodb.total_segments",DM="aws.dynamodb.count",xM="aws.dynamodb.scanned_count",UM="aws.dynamodb.attribute_definitions",wM="aws.dynamodb.global_secondary_index_updates",VM="messaging.system",BM="messaging.destination",GM="messaging.destination_kind",HM="messaging.temp_destination",kM="messaging.protocol",FM="messaging.protocol_version",jM="messaging.url",$M="messaging.message_id",YM="messaging.conversation_id",qM="messaging.message_payload_size_bytes",KM="messaging.message_payload_compressed_size_bytes",WM="messaging.operation",XM="messaging.consumer_id",zM="messaging.rabbitmq.routing_key",JM="messaging.kafka.message_key",QM="messaging.kafka.consumer_group",ZM="messaging.kafka.client_id",ey="messaging.kafka.partition",ty="messaging.kafka.tombstone",ny="rpc.system",ry="rpc.service",oy="rpc.method",sy="rpc.grpc.status_code",iy="rpc.jsonrpc.version",ay="rpc.jsonrpc.request_id",cy="rpc.jsonrpc.error_code",uy="rpc.jsonrpc.error_message",ly="message.type",py="message.id",dy="message.compressed_size",_y="message.uncompressed_size",DQ=WC,xQ=XC,UQ=zC,wQ=JC,VQ=QC,BQ=ZC,GQ=eP,HQ=tP,kQ=nP,FQ=rP,jQ=oP,$Q=sP,YQ=iP,qQ=aP,KQ=cP,WQ=uP,XQ=lP,zQ=pP,JQ=dP,QQ=_P,ZQ=EP,e9=fP,t9=SP,n9=TP,r9=mP,o9=hP,s9=gP,i9=AP,a9=RP,c9=OP,u9=NP,l9=IP,p9=CP,d9=PP,_9=MP,E9=yP,f9=vP,S9=bP,T9=LP,m9=DP,h9=xP,g9=UP,A9=wP,R9=VP,O9=BP,N9=GP,I9=HP,C9=kP,P9=FP,M9=jP,y9=$P,v9=YP,b9=qP,L9=KP,D9=WP,x9=XP,U9=zP,w9=JP,V9=QP,B9=ZP,G9=eM,H9=tM,k9=nM,F9=rM,j9=oM,$9=sM,Y9=iM,q9=aM,K9=cM,W9=uM,X9=lM,z9=pM,J9=dM,Q9=_M,Z9=EM,eZ=fM,tZ=SM,nZ=TM,rZ=mM,oZ=hM,sZ=gM,iZ=AM,aZ=RM,cZ=OM,uZ=NM,lZ=IM,pZ=CM,dZ=PM,_Z=MM,EZ=yM,fZ=vM,SZ=bM,TZ=LM,mZ=DM,hZ=xM,gZ=UM,AZ=wM,RZ=VM,OZ=BM,NZ=GM,IZ=HM,CZ=kM,PZ=FM,MZ=jM,yZ=$M,vZ=YM,bZ=qM,LZ=KM,DZ=WM,xZ=XM,UZ=zM,wZ=JM,VZ=QM,BZ=ZM,GZ=ey,HZ=ty,kZ=ny,FZ=ry,jZ=oy,$Z=sy,YZ=iy,qZ=ay,KZ=cy,WZ=uy,XZ=ly,zZ=py,JZ=dy,QZ=_y,ZZ=Be([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,dy,_y]),Ey="other_sql",fy="mssql",Sy="mysql",Ty="oracle",my="db2",hy="postgresql",gy="redshift",Ay="hive",Ry="cloudscape",Oy="hsqldb",Ny="progress",Iy="maxdb",Cy="hanadb",Py="ingres",My="firstsql",yy="edb",vy="cache",by="adabas",Ly="firebird",Dy="derby",xy="filemaker",Uy="informix",wy="instantdb",Vy="interbase",By="mariadb",Gy="netezza",Hy="pervasive",ky="pointbase",Fy="sqlite",jy="sybase",$y="teradata",Yy="vertica",qy="h2",Ky="coldfusion",Wy="cassandra",Xy="hbase",zy="mongodb",Jy="redis",Qy="couchbase",Zy="couchdb",ev="cosmosdb",tv="dynamodb",nv="neo4j",rv="geode",ov="elasticsearch",sv="memcached",iv="cockroachdb",e7=Ey,t7=fy,n7=Sy,r7=Ty,o7=my,s7=hy,i7=gy,a7=Ay,c7=Ry,u7=Oy,l7=Ny,p7=Iy,d7=Cy,_7=Py,E7=My,f7=yy,S7=vy,T7=by,m7=Ly,h7=Dy,g7=xy,A7=Uy,R7=wy,O7=Vy,N7=By,I7=Gy,C7=Hy,P7=ky,M7=Fy,y7=jy,v7=$y,b7=Yy,L7=qy,D7=Ky,x7=Wy,U7=Xy,w7=zy,V7=Jy,B7=Qy,G7=Zy,H7=ev,k7=tv,F7=nv,j7=rv,$7=ov,Y7=sv,q7=iv,K7=Be([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,sv,iv]),av="all",cv="each_quorum",uv="quorum",lv="local_quorum",pv="one",dv="two",_v="three",Ev="local_one",fv="any",Sv="serial",Tv="local_serial",W7=av,X7=cv,z7=uv,J7=lv,Q7=pv,Z7=dv,eee=_v,tee=Ev,nee=fv,ree=Sv,oee=Tv,see=Be([av,cv,uv,lv,pv,dv,_v,Ev,fv,Sv,Tv]),mv="datasource",hv="http",gv="pubsub",Av="timer",Rv="other",iee=mv,aee=hv,cee=gv,uee=Av,lee=Rv,pee=Be([mv,hv,gv,Av,Rv]),Ov="insert",Nv="edit",Iv="delete",dee=Ov,_ee=Nv,Eee=Iv,fee=Be([Ov,Nv,Iv]),Cv="alibaba_cloud",Pv="aws",Mv="azure",yv="gcp",See=Cv,Tee=Pv,mee=Mv,hee=yv,gee=Be([Cv,Pv,Mv,yv]),vv="ip_tcp",bv="ip_udp",Lv="ip",Dv="unix",xv="pipe",Uv="inproc",wv="other",Aee=vv,Ree=bv,Oee=Lv,Nee=Dv,Iee=xv,Cee=Uv,Pee=wv,Mee=Be([vv,bv,Lv,Dv,xv,Uv,wv]),Vv="wifi",Bv="wired",Gv="cell",Hv="unavailable",kv="unknown",yee=Vv,vee=Bv,bee=Gv,Lee=Hv,Dee=kv,xee=Be([Vv,Bv,Gv,Hv,kv]),Fv="gprs",jv="edge",$v="umts",Yv="cdma",qv="evdo_0",Kv="evdo_a",Wv="cdma2000_1xrtt",Xv="hsdpa",zv="hsupa",Jv="hspa",Qv="iden",Zv="evdo_b",eb="lte",tb="ehrpd",nb="hspap",rb="gsm",ob="td_scdma",sb="iwlan",ib="nr",ab="nrnsa",cb="lte_ca",Uee=Fv,wee=jv,Vee=$v,Bee=Yv,Gee=qv,Hee=Kv,kee=Wv,Fee=Xv,jee=zv,$ee=Jv,Yee=Qv,qee=Zv,Kee=eb,Wee=tb,Xee=nb,zee=rb,Jee=ob,Qee=sb,Zee=ib,ete=ab,tte=cb,nte=Be([Fv,jv,$v,Yv,qv,Kv,Wv,Xv,zv,Jv,Qv,Zv,eb,tb,nb,rb,ob,sb,ib,ab,cb]),ub="1.0",lb="1.1",pb="2.0",db="SPDY",_b="QUIC",rte=ub,ote=lb,ste=pb,ite=db,ate=_b,cte={HTTP_1_0:ub,HTTP_1_1:lb,HTTP_2_0:pb,SPDY:db,QUIC:_b},Eb="queue",fb="topic",ute=Eb,lte=fb,pte=Be([Eb,fb]),Sb="receive",Tb="process",dte=Sb,_te=Tb,Ete=Be([Sb,Tb]),mb=0,hb=1,gb=2,Ab=3,Rb=4,Ob=5,Nb=6,Ib=7,Cb=8,Pb=9,Mb=10,yb=11,vb=12,bb=13,Lb=14,Db=15,xb=16,fte=mb,Ste=hb,Tte=gb,mte=Ab,hte=Rb,gte=Ob,Ate=Nb,Rte=Ib,Ote=Cb,Nte=Pb,Ite=Mb,Cte=yb,Pte=vb,Mte=bb,yte=Lb,vte=Db,bte=xb,Lte={OK:mb,CANCELLED:hb,UNKNOWN:gb,INVALID_ARGUMENT:Ab,DEADLINE_EXCEEDED:Rb,NOT_FOUND:Ob,ALREADY_EXISTS:Nb,PERMISSION_DENIED:Ib,RESOURCE_EXHAUSTED:Cb,FAILED_PRECONDITION:Pb,ABORTED:Mb,OUT_OF_RANGE:yb,UNIMPLEMENTED:vb,INTERNAL:bb,UNAVAILABLE:Lb,DATA_LOSS:Db,UNAUTHENTICATED:xb},Ub="SENT",wb="RECEIVED",Dte=Ub,xte=wb,Ute=Be([Ub,wb])});var Bb=U(()=>{Vb()});var 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,lD,pD,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,ire,are,cre,ure,dD,_D,ED,fD,lre,pre,dre,_re,Ere,SD,TD,mD,hD,gD,AD,RD,OD,ND,ID,CD,PD,MD,yD,vD,bD,LD,fre,Sre,Tre,mre,hre,gre,Are,Rre,Ore,Nre,Ire,Cre,Pre,Mre,yre,vre,bre,Lre,DD,xD,Dre,xre,Ure,UD,wD,VD,BD,GD,HD,kD,wre,Vre,Bre,Gre,Hre,kre,Fre,jre,FD,jD,$D,YD,qD,KD,WD,XD,zD,JD,QD,$re,Yre,qre,Kre,Wre,Xre,zre,Jre,Qre,Zre,eoe,toe,ZD,ex,tx,nx,rx,ox,sx,ix,ax,cx,noe,roe,ooe,soe,ioe,aoe,coe,uoe,loe,poe,doe,ux=U(()=>{em();Gb="cloud.provider",Hb="cloud.account.id",kb="cloud.region",Fb="cloud.availability_zone",jb="cloud.platform",$b="aws.ecs.container.arn",Yb="aws.ecs.cluster.arn",qb="aws.ecs.launchtype",Kb="aws.ecs.task.arn",Wb="aws.ecs.task.family",Xb="aws.ecs.task.revision",zb="aws.eks.cluster.arn",Jb="aws.log.group.names",Qb="aws.log.group.arns",Zb="aws.log.stream.names",eL="aws.log.stream.arns",tL="container.name",nL="container.id",rL="container.runtime",oL="container.image.name",sL="container.image.tag",iL="deployment.environment",aL="device.id",cL="device.model.identifier",uL="device.model.name",lL="faas.name",pL="faas.id",dL="faas.version",_L="faas.instance",EL="faas.max_memory",fL="host.id",SL="host.name",TL="host.type",mL="host.arch",hL="host.image.name",gL="host.image.id",AL="host.image.version",RL="k8s.cluster.name",OL="k8s.node.name",NL="k8s.node.uid",IL="k8s.namespace.name",CL="k8s.pod.uid",PL="k8s.pod.name",ML="k8s.container.name",yL="k8s.replicaset.uid",vL="k8s.replicaset.name",bL="k8s.deployment.uid",LL="k8s.deployment.name",DL="k8s.statefulset.uid",xL="k8s.statefulset.name",UL="k8s.daemonset.uid",wL="k8s.daemonset.name",VL="k8s.job.uid",BL="k8s.job.name",GL="k8s.cronjob.uid",HL="k8s.cronjob.name",kL="os.type",FL="os.description",jL="os.name",$L="os.version",YL="process.pid",qL="process.executable.name",KL="process.executable.path",WL="process.command",XL="process.command_line",zL="process.command_args",JL="process.owner",QL="process.runtime.name",ZL="process.runtime.version",eD="process.runtime.description",tD="service.name",nD="service.namespace",rD="service.instance.id",oD="service.version",sD="telemetry.sdk.name",iD="telemetry.sdk.language",aD="telemetry.sdk.version",cD="telemetry.auto.version",uD="webengine.name",lD="webengine.version",pD="webengine.description",wte=Gb,Vte=Hb,Bte=kb,Gte=Fb,Hte=jb,kte=$b,Fte=Yb,jte=qb,$te=Kb,Yte=Wb,qte=Xb,Kte=zb,Wte=Jb,Xte=Qb,zte=Zb,Jte=eL,Qte=tL,Zte=nL,ene=rL,tne=oL,nne=sL,rne=iL,one=aL,sne=cL,ine=uL,ane=lL,cne=pL,une=dL,lne=_L,pne=EL,dne=fL,_ne=SL,Ene=TL,fne=mL,Sne=hL,Tne=gL,mne=AL,hne=RL,gne=OL,Ane=NL,Rne=IL,One=CL,Nne=PL,Ine=ML,Cne=yL,Pne=vL,Mne=bL,yne=LL,vne=DL,bne=xL,Lne=UL,Dne=wL,xne=VL,Une=BL,wne=GL,Vne=HL,Bne=kL,Gne=FL,Hne=jL,kne=$L,Fne=YL,jne=qL,$ne=KL,Yne=WL,qne=XL,Kne=zL,Wne=JL,Xne=QL,zne=ZL,Jne=eD,Qne=tD,Zne=nD,ere=rD,tre=oD,nre=sD,rre=iD,ore=aD,sre=cD,ire=uD,are=lD,cre=pD,ure=Be([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,lD,pD]),dD="alibaba_cloud",_D="aws",ED="azure",fD="gcp",lre=dD,pre=_D,dre=ED,_re=fD,Ere=Be([dD,_D,ED,fD]),SD="alibaba_cloud_ecs",TD="alibaba_cloud_fc",mD="aws_ec2",hD="aws_ecs",gD="aws_eks",AD="aws_lambda",RD="aws_elastic_beanstalk",OD="azure_vm",ND="azure_container_instances",ID="azure_aks",CD="azure_functions",PD="azure_app_service",MD="gcp_compute_engine",yD="gcp_cloud_run",vD="gcp_kubernetes_engine",bD="gcp_cloud_functions",LD="gcp_app_engine",fre=SD,Sre=TD,Tre=mD,mre=hD,hre=gD,gre=AD,Are=RD,Rre=OD,Ore=ND,Nre=ID,Ire=CD,Cre=PD,Pre=MD,Mre=yD,yre=vD,vre=bD,bre=LD,Lre=Be([SD,TD,mD,hD,gD,AD,RD,OD,ND,ID,CD,PD,MD,yD,vD,bD,LD]),DD="ec2",xD="fargate",Dre=DD,xre=xD,Ure=Be([DD,xD]),UD="amd64",wD="arm32",VD="arm64",BD="ia64",GD="ppc32",HD="ppc64",kD="x86",wre=UD,Vre=wD,Bre=VD,Gre=BD,Hre=GD,kre=HD,Fre=kD,jre=Be([UD,wD,VD,BD,GD,HD,kD]),FD="windows",jD="linux",$D="darwin",YD="freebsd",qD="netbsd",KD="openbsd",WD="dragonflybsd",XD="hpux",zD="aix",JD="solaris",QD="z_os",$re=FD,Yre=jD,qre=$D,Kre=YD,Wre=qD,Xre=KD,zre=WD,Jre=XD,Qre=zD,Zre=JD,eoe=QD,toe=Be([FD,jD,$D,YD,qD,KD,WD,XD,zD,JD,QD]),ZD="cpp",ex="dotnet",tx="erlang",nx="go",rx="java",ox="nodejs",sx="php",ix="python",ax="ruby",cx="webjs",noe=ZD,roe=ex,ooe=tx,soe=nx,ioe=rx,aoe=ox,coe=sx,uoe=ix,loe=ax,poe=cx,doe=Be([ZD,ex,tx,nx,rx,ox,sx,ix,ax,cx])});var lx=U(()=>{ux()});var _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,pie,die,_ie,Eie,px=U(()=>{_oe="aspnetcore.rate_limiting.result",Eoe="acquired",foe="endpoint_limiter",Soe="global_limiter",Toe="request_canceled",moe="telemetry.sdk.language",hoe="cpp",goe="dotnet",Aoe="erlang",Roe="go",Ooe="java",Noe="nodejs",Ioe="php",Coe="python",Poe="ruby",Moe="rust",yoe="swift",voe="webjs",boe="telemetry.sdk.name",Loe="telemetry.sdk.version",Doe="aspnetcore.diagnostics.handler.type",xoe="aspnetcore.diagnostics.exception.result",Uoe="aborted",woe="handled",Voe="skipped",Boe="unhandled",Goe="aspnetcore.rate_limiting.policy",Hoe="aspnetcore.request.is_unhandled",koe="aspnetcore.routing.is_fallback",Foe="aspnetcore.routing.match_status",joe="failure",$oe="success",Yoe="client.address",qoe="client.port",Koe="error.type",Woe="_OTHER",Xoe="exception.escaped",zoe="exception.message",Joe="exception.stacktrace",Qoe="exception.type",Zoe=function(t){return"http.request.header."+t},ese="http.request.method",tse="_OTHER",nse="CONNECT",rse="DELETE",ose="GET",sse="HEAD",ise="OPTIONS",ase="PATCH",cse="POST",use="PUT",lse="TRACE",pse="http.request.method_original",dse="http.request.resend_count",_se=function(t){return"http.response.header."+t},Ese="http.response.status_code",fse="http.route",Sse="jvm.gc.action",Tse="jvm.gc.name",mse="jvm.memory.pool.name",hse="jvm.memory.type",gse="heap",Ase="non_heap",Rse="jvm.thread.daemon",Ose="jvm.thread.state",Nse="blocked",Ise="new",Cse="runnable",Pse="terminated",Mse="timed_waiting",yse="waiting",vse="network.local.address",bse="network.local.port",Lse="network.peer.address",Dse="network.peer.port",xse="network.protocol.name",Use="network.protocol.version",wse="network.transport",Vse="pipe",Bse="quic",Gse="tcp",Hse="udp",kse="unix",Fse="network.type",jse="ipv4",$se="ipv6",Yse="otel.scope.name",qse="otel.scope.version",Kse="otel.status_code",Wse="ERROR",Xse="OK",zse="otel.status_description",Jse="server.address",Qse="server.port",Zse="service.name",eie="service.version",tie="signalr.connection.status",nie="app_shutdown",rie="normal_closure",oie="timeout",sie="signalr.transport",iie="long_polling",aie="server_sent_events",cie="web_sockets",uie="url.fragment",lie="url.full",pie="url.path",die="url.query",_ie="url.scheme",Eie="user_agent.original"});var 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,Fie,jie,$ie,Yie,dx=U(()=>{fie="aspnetcore.diagnostics.exceptions",Sie="aspnetcore.rate_limiting.active_request_leases",Tie="aspnetcore.rate_limiting.queued_requests",mie="aspnetcore.rate_limiting.request.time_in_queue",hie="aspnetcore.rate_limiting.request_lease.duration",gie="aspnetcore.rate_limiting.requests",Aie="aspnetcore.routing.match_attempts",Rie="http.client.request.duration",Oie="http.server.request.duration",Nie="jvm.class.count",Iie="jvm.class.loaded",Cie="jvm.class.unloaded",Pie="jvm.cpu.count",Mie="jvm.cpu.recent_utilization",yie="jvm.cpu.time",vie="jvm.gc.duration",bie="jvm.memory.committed",Lie="jvm.memory.limit",Die="jvm.memory.used",xie="jvm.memory.used_after_last_gc",Uie="jvm.thread.count",wie="kestrel.active_connections",Vie="kestrel.active_tls_handshakes",Bie="kestrel.connection.duration",Gie="kestrel.queued_connections",Hie="kestrel.queued_requests",kie="kestrel.rejected_connections",Fie="kestrel.tls_handshake.duration",jie="kestrel.upgraded_connections",$ie="signalr.server.active_connections",Yie="signalr.server.connection.duration"});var mn={};mS(mn,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>Uoe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>woe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>Voe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>Boe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>Eoe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>foe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>Soe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>Toe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>joe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>$oe,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>xoe,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>Doe,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>Goe,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>_oe,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>Hoe,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>koe,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>Foe,ATTR_CLIENT_ADDRESS:()=>Yoe,ATTR_CLIENT_PORT:()=>qoe,ATTR_ERROR_TYPE:()=>Koe,ATTR_EXCEPTION_ESCAPED:()=>Xoe,ATTR_EXCEPTION_MESSAGE:()=>zoe,ATTR_EXCEPTION_STACKTRACE:()=>Joe,ATTR_EXCEPTION_TYPE:()=>Qoe,ATTR_HTTP_REQUEST_HEADER:()=>Zoe,ATTR_HTTP_REQUEST_METHOD:()=>ese,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>pse,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>dse,ATTR_HTTP_RESPONSE_HEADER:()=>_se,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>Ese,ATTR_HTTP_ROUTE:()=>fse,ATTR_JVM_GC_ACTION:()=>Sse,ATTR_JVM_GC_NAME:()=>Tse,ATTR_JVM_MEMORY_POOL_NAME:()=>mse,ATTR_JVM_MEMORY_TYPE:()=>hse,ATTR_JVM_THREAD_DAEMON:()=>Rse,ATTR_JVM_THREAD_STATE:()=>Ose,ATTR_NETWORK_LOCAL_ADDRESS:()=>vse,ATTR_NETWORK_LOCAL_PORT:()=>bse,ATTR_NETWORK_PEER_ADDRESS:()=>Lse,ATTR_NETWORK_PEER_PORT:()=>Dse,ATTR_NETWORK_PROTOCOL_NAME:()=>xse,ATTR_NETWORK_PROTOCOL_VERSION:()=>Use,ATTR_NETWORK_TRANSPORT:()=>wse,ATTR_NETWORK_TYPE:()=>Fse,ATTR_OTEL_SCOPE_NAME:()=>Yse,ATTR_OTEL_SCOPE_VERSION:()=>qse,ATTR_OTEL_STATUS_CODE:()=>Kse,ATTR_OTEL_STATUS_DESCRIPTION:()=>zse,ATTR_SERVER_ADDRESS:()=>Jse,ATTR_SERVER_PORT:()=>Qse,ATTR_SERVICE_NAME:()=>Zse,ATTR_SERVICE_VERSION:()=>eie,ATTR_SIGNALR_CONNECTION_STATUS:()=>tie,ATTR_SIGNALR_TRANSPORT:()=>sie,ATTR_TELEMETRY_SDK_LANGUAGE:()=>moe,ATTR_TELEMETRY_SDK_NAME:()=>boe,ATTR_TELEMETRY_SDK_VERSION:()=>Loe,ATTR_URL_FRAGMENT:()=>uie,ATTR_URL_FULL:()=>lie,ATTR_URL_PATH:()=>pie,ATTR_URL_QUERY:()=>die,ATTR_URL_SCHEME:()=>_ie,ATTR_USER_AGENT_ORIGINAL:()=>Eie,AWSECSLAUNCHTYPEVALUES_EC2:()=>Dre,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>xre,AwsEcsLaunchtypeValues:()=>Ure,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>fre,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>Sre,CLOUDPLATFORMVALUES_AWS_EC2:()=>Tre,CLOUDPLATFORMVALUES_AWS_ECS:()=>mre,CLOUDPLATFORMVALUES_AWS_EKS:()=>hre,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>Are,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>gre,CLOUDPLATFORMVALUES_AZURE_AKS:()=>Nre,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>Cre,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>Ore,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>Ire,CLOUDPLATFORMVALUES_AZURE_VM:()=>Rre,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>bre,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>vre,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>Mre,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>Pre,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>yre,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>lre,CLOUDPROVIDERVALUES_AWS:()=>pre,CLOUDPROVIDERVALUES_AZURE:()=>dre,CLOUDPROVIDERVALUES_GCP:()=>_re,CloudPlatformValues:()=>Lre,CloudProviderValues:()=>Ere,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>W7,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>nee,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>X7,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>tee,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>J7,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>oee,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>Q7,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>z7,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>ree,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>eee,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>Z7,DBSYSTEMVALUES_ADABAS:()=>T7,DBSYSTEMVALUES_CACHE:()=>S7,DBSYSTEMVALUES_CASSANDRA:()=>x7,DBSYSTEMVALUES_CLOUDSCAPE:()=>c7,DBSYSTEMVALUES_COCKROACHDB:()=>q7,DBSYSTEMVALUES_COLDFUSION:()=>D7,DBSYSTEMVALUES_COSMOSDB:()=>H7,DBSYSTEMVALUES_COUCHBASE:()=>B7,DBSYSTEMVALUES_COUCHDB:()=>G7,DBSYSTEMVALUES_DB2:()=>o7,DBSYSTEMVALUES_DERBY:()=>h7,DBSYSTEMVALUES_DYNAMODB:()=>k7,DBSYSTEMVALUES_EDB:()=>f7,DBSYSTEMVALUES_ELASTICSEARCH:()=>$7,DBSYSTEMVALUES_FILEMAKER:()=>g7,DBSYSTEMVALUES_FIREBIRD:()=>m7,DBSYSTEMVALUES_FIRSTSQL:()=>E7,DBSYSTEMVALUES_GEODE:()=>j7,DBSYSTEMVALUES_H2:()=>L7,DBSYSTEMVALUES_HANADB:()=>d7,DBSYSTEMVALUES_HBASE:()=>U7,DBSYSTEMVALUES_HIVE:()=>a7,DBSYSTEMVALUES_HSQLDB:()=>u7,DBSYSTEMVALUES_INFORMIX:()=>A7,DBSYSTEMVALUES_INGRES:()=>_7,DBSYSTEMVALUES_INSTANTDB:()=>R7,DBSYSTEMVALUES_INTERBASE:()=>O7,DBSYSTEMVALUES_MARIADB:()=>N7,DBSYSTEMVALUES_MAXDB:()=>p7,DBSYSTEMVALUES_MEMCACHED:()=>Y7,DBSYSTEMVALUES_MONGODB:()=>w7,DBSYSTEMVALUES_MSSQL:()=>t7,DBSYSTEMVALUES_MYSQL:()=>n7,DBSYSTEMVALUES_NEO4J:()=>F7,DBSYSTEMVALUES_NETEZZA:()=>I7,DBSYSTEMVALUES_ORACLE:()=>r7,DBSYSTEMVALUES_OTHER_SQL:()=>e7,DBSYSTEMVALUES_PERVASIVE:()=>C7,DBSYSTEMVALUES_POINTBASE:()=>P7,DBSYSTEMVALUES_POSTGRESQL:()=>s7,DBSYSTEMVALUES_PROGRESS:()=>l7,DBSYSTEMVALUES_REDIS:()=>V7,DBSYSTEMVALUES_REDSHIFT:()=>i7,DBSYSTEMVALUES_SQLITE:()=>M7,DBSYSTEMVALUES_SYBASE:()=>y7,DBSYSTEMVALUES_TERADATA:()=>v7,DBSYSTEMVALUES_VERTICA:()=>b7,DbCassandraConsistencyLevelValues:()=>see,DbSystemValues:()=>K7,ERROR_TYPE_VALUE_OTHER:()=>Woe,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>Eee,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>_ee,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>dee,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>See,FAASINVOKEDPROVIDERVALUES_AWS:()=>Tee,FAASINVOKEDPROVIDERVALUES_AZURE:()=>mee,FAASINVOKEDPROVIDERVALUES_GCP:()=>hee,FAASTRIGGERVALUES_DATASOURCE:()=>iee,FAASTRIGGERVALUES_HTTP:()=>aee,FAASTRIGGERVALUES_OTHER:()=>lee,FAASTRIGGERVALUES_PUBSUB:()=>cee,FAASTRIGGERVALUES_TIMER:()=>uee,FaasDocumentOperationValues:()=>fee,FaasInvokedProviderValues:()=>gee,FaasTriggerValues:()=>pee,HOSTARCHVALUES_AMD64:()=>wre,HOSTARCHVALUES_ARM32:()=>Vre,HOSTARCHVALUES_ARM64:()=>Bre,HOSTARCHVALUES_IA64:()=>Gre,HOSTARCHVALUES_PPC32:()=>Hre,HOSTARCHVALUES_PPC64:()=>kre,HOSTARCHVALUES_X86:()=>Fre,HTTPFLAVORVALUES_HTTP_1_0:()=>rte,HTTPFLAVORVALUES_HTTP_1_1:()=>ote,HTTPFLAVORVALUES_HTTP_2_0:()=>ste,HTTPFLAVORVALUES_QUIC:()=>ate,HTTPFLAVORVALUES_SPDY:()=>ite,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>nse,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>rse,HTTP_REQUEST_METHOD_VALUE_GET:()=>ose,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>sse,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>ise,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>tse,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>ase,HTTP_REQUEST_METHOD_VALUE_POST:()=>cse,HTTP_REQUEST_METHOD_VALUE_PUT:()=>use,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>lse,HostArchValues:()=>jre,HttpFlavorValues:()=>cte,JVM_MEMORY_TYPE_VALUE_HEAP:()=>gse,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>Ase,JVM_THREAD_STATE_VALUE_BLOCKED:()=>Nse,JVM_THREAD_STATE_VALUE_NEW:()=>Ise,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>Cse,JVM_THREAD_STATE_VALUE_TERMINATED:()=>Pse,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>Mse,JVM_THREAD_STATE_VALUE_WAITING:()=>yse,MESSAGETYPEVALUES_RECEIVED:()=>xte,MESSAGETYPEVALUES_SENT:()=>Dte,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>ute,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>lte,MESSAGINGOPERATIONVALUES_PROCESS:()=>_te,MESSAGINGOPERATIONVALUES_RECEIVE:()=>dte,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>fie,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>Sie,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>Tie,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>gie,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>hie,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>mie,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>Aie,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>Rie,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>Oie,METRIC_JVM_CLASS_COUNT:()=>Nie,METRIC_JVM_CLASS_LOADED:()=>Iie,METRIC_JVM_CLASS_UNLOADED:()=>Cie,METRIC_JVM_CPU_COUNT:()=>Pie,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Mie,METRIC_JVM_CPU_TIME:()=>yie,METRIC_JVM_GC_DURATION:()=>vie,METRIC_JVM_MEMORY_COMMITTED:()=>bie,METRIC_JVM_MEMORY_LIMIT:()=>Lie,METRIC_JVM_MEMORY_USED:()=>Die,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>xie,METRIC_JVM_THREAD_COUNT:()=>Uie,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>wie,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Vie,METRIC_KESTREL_CONNECTION_DURATION:()=>Bie,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Gie,METRIC_KESTREL_QUEUED_REQUESTS:()=>Hie,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>kie,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>Fie,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>jie,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>$ie,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>Yie,MessageTypeValues:()=>Ute,MessagingDestinationKindValues:()=>pte,MessagingOperationValues:()=>Ete,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>Bee,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>kee,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>wee,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>Wee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>Gee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>Hee,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>qee,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>Uee,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>zee,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>Fee,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>$ee,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>Xee,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>jee,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>Yee,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>Qee,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>Kee,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>tte,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>Zee,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>ete,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>Jee,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>Vee,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>bee,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>Lee,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>Dee,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>yee,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>vee,NETTRANSPORTVALUES_INPROC:()=>Cee,NETTRANSPORTVALUES_IP:()=>Oee,NETTRANSPORTVALUES_IP_TCP:()=>Aee,NETTRANSPORTVALUES_IP_UDP:()=>Ree,NETTRANSPORTVALUES_OTHER:()=>Pee,NETTRANSPORTVALUES_PIPE:()=>Iee,NETTRANSPORTVALUES_UNIX:()=>Nee,NETWORK_TRANSPORT_VALUE_PIPE:()=>Vse,NETWORK_TRANSPORT_VALUE_QUIC:()=>Bse,NETWORK_TRANSPORT_VALUE_TCP:()=>Gse,NETWORK_TRANSPORT_VALUE_UDP:()=>Hse,NETWORK_TRANSPORT_VALUE_UNIX:()=>kse,NETWORK_TYPE_VALUE_IPV4:()=>jse,NETWORK_TYPE_VALUE_IPV6:()=>$se,NetHostConnectionSubtypeValues:()=>nte,NetHostConnectionTypeValues:()=>xee,NetTransportValues:()=>Mee,OSTYPEVALUES_AIX:()=>Qre,OSTYPEVALUES_DARWIN:()=>qre,OSTYPEVALUES_DRAGONFLYBSD:()=>zre,OSTYPEVALUES_FREEBSD:()=>Kre,OSTYPEVALUES_HPUX:()=>Jre,OSTYPEVALUES_LINUX:()=>Yre,OSTYPEVALUES_NETBSD:()=>Wre,OSTYPEVALUES_OPENBSD:()=>Xre,OSTYPEVALUES_SOLARIS:()=>Zre,OSTYPEVALUES_WINDOWS:()=>$re,OSTYPEVALUES_Z_OS:()=>eoe,OTEL_STATUS_CODE_VALUE_ERROR:()=>Wse,OTEL_STATUS_CODE_VALUE_OK:()=>Xse,OsTypeValues:()=>toe,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>Ite,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>Ate,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>Ste,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>vte,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>hte,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>Nte,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>Mte,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>mte,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>gte,RPCGRPCSTATUSCODEVALUES_OK:()=>fte,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>Cte,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>Rte,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>Ote,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>bte,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>yte,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>Pte,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>Tte,RpcGrpcStatusCodeValues:()=>Lte,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>cZ,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>gZ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>sZ,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>tZ,SEMATTRS_AWS_DYNAMODB_COUNT:()=>mZ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>_Z,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>pZ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>AZ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>uZ,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>nZ,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>aZ,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>dZ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>iZ,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>rZ,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>oZ,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>hZ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>fZ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>SZ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>lZ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>EZ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>eZ,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>TZ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>DQ,SEMATTRS_CODE_FILEPATH:()=>V9,SEMATTRS_CODE_FUNCTION:()=>U9,SEMATTRS_CODE_LINENO:()=>B9,SEMATTRS_CODE_NAMESPACE:()=>w9,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>$Q,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>XQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>WQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>qQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>FQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>jQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>KQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>YQ,SEMATTRS_DB_CONNECTION_STRING:()=>UQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>zQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>VQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>QQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>kQ,SEMATTRS_DB_NAME:()=>BQ,SEMATTRS_DB_OPERATION:()=>HQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>JQ,SEMATTRS_DB_SQL_TABLE:()=>ZQ,SEMATTRS_DB_STATEMENT:()=>GQ,SEMATTRS_DB_SYSTEM:()=>xQ,SEMATTRS_DB_USER:()=>wQ,SEMATTRS_ENDUSER_ID:()=>v9,SEMATTRS_ENDUSER_ROLE:()=>b9,SEMATTRS_ENDUSER_SCOPE:()=>L9,SEMATTRS_EXCEPTION_ESCAPED:()=>r9,SEMATTRS_EXCEPTION_MESSAGE:()=>t9,SEMATTRS_EXCEPTION_STACKTRACE:()=>n9,SEMATTRS_EXCEPTION_TYPE:()=>e9,SEMATTRS_FAAS_COLDSTART:()=>d9,SEMATTRS_FAAS_CRON:()=>p9,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>i9,SEMATTRS_FAAS_DOCUMENT_NAME:()=>u9,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>a9,SEMATTRS_FAAS_DOCUMENT_TIME:()=>c9,SEMATTRS_FAAS_EXECUTION:()=>s9,SEMATTRS_FAAS_INVOKED_NAME:()=>_9,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>E9,SEMATTRS_FAAS_INVOKED_REGION:()=>f9,SEMATTRS_FAAS_TIME:()=>l9,SEMATTRS_FAAS_TRIGGER:()=>o9,SEMATTRS_HTTP_CLIENT_IP:()=>Z9,SEMATTRS_HTTP_FLAVOR:()=>Y9,SEMATTRS_HTTP_HOST:()=>F9,SEMATTRS_HTTP_METHOD:()=>G9,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>K9,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>W9,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>X9,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>z9,SEMATTRS_HTTP_ROUTE:()=>Q9,SEMATTRS_HTTP_SCHEME:()=>j9,SEMATTRS_HTTP_SERVER_NAME:()=>J9,SEMATTRS_HTTP_STATUS_CODE:()=>$9,SEMATTRS_HTTP_TARGET:()=>k9,SEMATTRS_HTTP_URL:()=>H9,SEMATTRS_HTTP_USER_AGENT:()=>q9,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>JZ,SEMATTRS_MESSAGE_ID:()=>zZ,SEMATTRS_MESSAGE_TYPE:()=>XZ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>QZ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>xZ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>vZ,SEMATTRS_MESSAGING_DESTINATION:()=>OZ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>NZ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>BZ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>VZ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>wZ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>GZ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>HZ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>yZ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>LZ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>bZ,SEMATTRS_MESSAGING_OPERATION:()=>DZ,SEMATTRS_MESSAGING_PROTOCOL:()=>CZ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>PZ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>UZ,SEMATTRS_MESSAGING_SYSTEM:()=>RZ,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>IZ,SEMATTRS_MESSAGING_URL:()=>MZ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>M9,SEMATTRS_NET_HOST_CARRIER_MCC:()=>C9,SEMATTRS_NET_HOST_CARRIER_MNC:()=>P9,SEMATTRS_NET_HOST_CARRIER_NAME:()=>I9,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>N9,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>O9,SEMATTRS_NET_HOST_IP:()=>g9,SEMATTRS_NET_HOST_NAME:()=>R9,SEMATTRS_NET_HOST_PORT:()=>A9,SEMATTRS_NET_PEER_IP:()=>T9,SEMATTRS_NET_PEER_NAME:()=>h9,SEMATTRS_NET_PEER_PORT:()=>m9,SEMATTRS_NET_TRANSPORT:()=>S9,SEMATTRS_PEER_SERVICE:()=>y9,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>$Z,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>KZ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>WZ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>qZ,SEMATTRS_RPC_JSONRPC_VERSION:()=>YZ,SEMATTRS_RPC_METHOD:()=>jZ,SEMATTRS_RPC_SERVICE:()=>FZ,SEMATTRS_RPC_SYSTEM:()=>kZ,SEMATTRS_THREAD_ID:()=>D9,SEMATTRS_THREAD_NAME:()=>x9,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>Fte,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>kte,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>jte,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>$te,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>Yte,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>qte,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>Kte,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>Xte,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>Wte,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>Jte,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>zte,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>Vte,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>Gte,SEMRESATTRS_CLOUD_PLATFORM:()=>Hte,SEMRESATTRS_CLOUD_PROVIDER:()=>wte,SEMRESATTRS_CLOUD_REGION:()=>Bte,SEMRESATTRS_CONTAINER_ID:()=>Zte,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>tne,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>nne,SEMRESATTRS_CONTAINER_NAME:()=>Qte,SEMRESATTRS_CONTAINER_RUNTIME:()=>ene,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>rne,SEMRESATTRS_DEVICE_ID:()=>one,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>sne,SEMRESATTRS_DEVICE_MODEL_NAME:()=>ine,SEMRESATTRS_FAAS_ID:()=>cne,SEMRESATTRS_FAAS_INSTANCE:()=>lne,SEMRESATTRS_FAAS_MAX_MEMORY:()=>pne,SEMRESATTRS_FAAS_NAME:()=>ane,SEMRESATTRS_FAAS_VERSION:()=>une,SEMRESATTRS_HOST_ARCH:()=>fne,SEMRESATTRS_HOST_ID:()=>dne,SEMRESATTRS_HOST_IMAGE_ID:()=>Tne,SEMRESATTRS_HOST_IMAGE_NAME:()=>Sne,SEMRESATTRS_HOST_IMAGE_VERSION:()=>mne,SEMRESATTRS_HOST_NAME:()=>_ne,SEMRESATTRS_HOST_TYPE:()=>Ene,SEMRESATTRS_K8S_CLUSTER_NAME:()=>hne,SEMRESATTRS_K8S_CONTAINER_NAME:()=>Ine,SEMRESATTRS_K8S_CRONJOB_NAME:()=>Vne,SEMRESATTRS_K8S_CRONJOB_UID:()=>wne,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>Dne,SEMRESATTRS_K8S_DAEMONSET_UID:()=>Lne,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>yne,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>Mne,SEMRESATTRS_K8S_JOB_NAME:()=>Une,SEMRESATTRS_K8S_JOB_UID:()=>xne,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>Rne,SEMRESATTRS_K8S_NODE_NAME:()=>gne,SEMRESATTRS_K8S_NODE_UID:()=>Ane,SEMRESATTRS_K8S_POD_NAME:()=>Nne,SEMRESATTRS_K8S_POD_UID:()=>One,SEMRESATTRS_K8S_REPLICASET_NAME:()=>Pne,SEMRESATTRS_K8S_REPLICASET_UID:()=>Cne,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>bne,SEMRESATTRS_K8S_STATEFULSET_UID:()=>vne,SEMRESATTRS_OS_DESCRIPTION:()=>Gne,SEMRESATTRS_OS_NAME:()=>Hne,SEMRESATTRS_OS_TYPE:()=>Bne,SEMRESATTRS_OS_VERSION:()=>kne,SEMRESATTRS_PROCESS_COMMAND:()=>Yne,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>Kne,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>qne,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>jne,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>$ne,SEMRESATTRS_PROCESS_OWNER:()=>Wne,SEMRESATTRS_PROCESS_PID:()=>Fne,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>Jne,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>Xne,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>zne,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>ere,SEMRESATTRS_SERVICE_NAME:()=>Qne,SEMRESATTRS_SERVICE_NAMESPACE:()=>Zne,SEMRESATTRS_SERVICE_VERSION:()=>tre,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>sre,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>rre,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>nre,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>ore,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>cre,SEMRESATTRS_WEBENGINE_NAME:()=>ire,SEMRESATTRS_WEBENGINE_VERSION:()=>are,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>nie,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>rie,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>oie,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>iie,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>aie,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>cie,SemanticAttributes:()=>ZZ,SemanticResourceAttributes:()=>ure,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>noe,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>roe,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>ooe,TELEMETRYSDKLANGUAGEVALUES_GO:()=>soe,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>ioe,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>aoe,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>coe,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>uoe,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>loe,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>poe,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>hoe,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>goe,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>Aoe,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Roe,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>Ooe,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Noe,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Ioe,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Coe,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Poe,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Moe,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>yoe,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>voe,TelemetrySdkLanguageValues:()=>doe});var hn=U(()=>{Bb();lx();px();dx()});var _x=f(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.SDK_INFO=void 0;var qie=ZT(),Dc=(hn(),C(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]:qie.VERSION}});var Ex=f(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.unrefTimer=void 0;function Kie(t){t.unref()}Gp.unrefTimer=Kie});var Sx=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 fx=HC();Object.defineProperty(rt,"getEnvWithoutDefaults",{enumerable:!0,get:function(){return fx.getEnvWithoutDefaults}});Object.defineProperty(rt,"getEnv",{enumerable:!0,get:function(){return fx.getEnv}});var Wie=kC();Object.defineProperty(rt,"_globalThis",{enumerable:!0,get:function(){return Wie._globalThis}});var Xie=jC();Object.defineProperty(rt,"hexToBase64",{enumerable:!0,get:function(){return Xie.hexToBase64}});var zie=qC();Object.defineProperty(rt,"RandomIdGenerator",{enumerable:!0,get:function(){return zie.RandomIdGenerator}});var Jie=KC();Object.defineProperty(rt,"otperformance",{enumerable:!0,get:function(){return Jie.otperformance}});var Qie=_x();Object.defineProperty(rt,"SDK_INFO",{enumerable:!0,get:function(){return Qie.SDK_INFO}});var Zie=Ex();Object.defineProperty(rt,"unrefTimer",{enumerable:!0,get:function(){return Zie.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=Sx();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 gx=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(),Tx=9,eae=6,tae=Math.pow(10,eae),Hp=Math.pow(10,Tx);function xc(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*tae);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 mx(t){let e=xc(rm()),n=xc(typeof t=="number"?t:nm.otperformance.now());return hx(e,n)}fe.hrTime=mx;function nae(t){if(om(t))return t;if(typeof t=="number")return t<rm()?mx(t):xc(t);if(t instanceof Date)return xc(t.getTime());throw TypeError("Invalid input type")}fe.timeInputToHrTime=nae;function rae(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Hp),[n,r]}fe.hrTimeDuration=rae;function oae(t){let e=Tx,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=oae;function sae(t){return t[0]*Hp+t[1]}fe.hrTimeToNanoseconds=sae;function iae(t){return t[0]*1e3+t[1]/1e6}fe.hrTimeToMilliseconds=iae;function aae(t){return t[0]*1e6+t[1]/1e3}fe.hrTimeToMicroseconds=aae;function om(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}fe.isTimeInputHrTime=om;function cae(t){return om(t)||typeof t=="number"||t instanceof Date}fe.isTimeInput=cae;function hx(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=hx});var Ax=f(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.ExportResultCode=void 0;var uae;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(uae=Uc.ExportResultCode||(Uc.ExportResultCode={}))});var Ox=f(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.CompositePropagator=void 0;var Rx=(y(),C(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){Rx.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){Rx.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};kp.CompositePropagator=sm});var Nx=f(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.validateValue=Ni.validateKey=void 0;var im="[_0-9a-z-*/]",lae=`[a-z]${im}{0,255}`,pae=`[a-z0-9]${im}{0,240}@[a-z]${im}{0,13}`,dae=new RegExp(`^(?:${lae}|${pae})$`),_ae=/^[ -~]{0,255}[!-~]$/,Eae=/,|=/;function fae(t){return dae.test(t)}Ni.validateKey=fae;function Sae(t){return _ae.test(t)&&!Eae.test(t)}Ni.validateValue=Sae});var cm=f(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.TraceState=void 0;var Ix=Nx(),Cx=32,Tae=512,Px=",",Mx="=",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+Mx+this.get(n)),e),[]).join(Px)}_parse(e){e.length>Tae||(this._internalState=e.split(Px).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Mx);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Ix.validateKey)(i)&&(0,Ix.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>Cx&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Cx))))}_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 vx=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(),C(x)),mae=bc(),hae=cm();gt.TRACE_PARENT_HEADER="traceparent";gt.TRACE_STATE_HEADER="tracestate";var gae="00",Aae="(?!ff)[\\da-f]{2}",Rae="(?![0]{32})[\\da-f]{32}",Oae="(?![0]{16})[\\da-f]{16}",Nae="[\\da-f]{2}",Iae=new RegExp(`^\\s?(${Aae})-(${Rae})-(${Oae})-(${Nae})(-.*)?\\s?$`);function yx(t){let e=Iae.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}gt.parseTraceParent=yx;var um=class{inject(e,n,r){let o=jp.trace.getSpanContext(e);if(!o||(0,mae.isTracingSuppressed)(e)||!(0,jp.isSpanContextValid)(o))return;let s=`${gae}-${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=yx(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 hae.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 bx=f(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.getRPCMetadata=Gn.deleteRPCMetadata=Gn.setRPCMetadata=Gn.RPCType=void 0;var Cae=(y(),C(x)),lm=(0,Cae.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Pae;(function(t){t.HTTP="http"})(Pae=Gn.RPCType||(Gn.RPCType={}));function Mae(t,e){return t.setValue(lm,e)}Gn.setRPCMetadata=Mae;function yae(t){return t.deleteValue(lm)}Gn.deleteRPCMetadata=yae;function vae(t){return t.getValue(lm)}Gn.getRPCMetadata=vae});var dm=f($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.AlwaysOffSampler=void 0;var bae=(y(),C(x)),pm=class{shouldSample(){return{decision:bae.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 Lae=(y(),C(x)),_m=class{shouldSample(){return{decision:Lae.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};Yp.AlwaysOnSampler=_m});var Dx=f(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.ParentBasedSampler=void 0;var qp=(y(),C(x)),Dae=KT(),Lx=dm(),fm=Em(),Sm=class{constructor(e){var n,r,o,s;this._root=e.root,this._root||((0,Dae.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 Lx.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 Lx.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 xx=f(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.TraceIdRatioBasedSampler=void 0;var Tm=(y(),C(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 Gx=f(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.isPlainObject=void 0;var xae="[object Object]",Uae="[object Null]",wae="[object Undefined]",Vae=Function.prototype,Ux=Vae.toString,Bae=Ux.call(Object),Gae=Hae(Object.getPrototypeOf,Object),wx=Object.prototype,Vx=wx.hasOwnProperty,Is=Symbol?Symbol.toStringTag:void 0,Bx=wx.toString;function Hae(t,e){return function(n){return t(e(n))}}function kae(t){if(!Fae(t)||jae(t)!==xae)return!1;let e=Gae(t);if(e===null)return!0;let n=Vx.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Ux.call(n)===Bae}Xp.isPlainObject=kae;function Fae(t){return t!=null&&typeof t=="object"}function jae(t){return t==null?t===void 0?wae:Uae:Is&&Is in Object(t)?$ae(t):Yae(t)}function $ae(t){let e=Vx.call(t,Is),n=t[Is],r=!1;try{t[Is]=void 0,r=!0}catch{}let o=Bx.call(t);return r&&(e?t[Is]=n:delete t[Is]),o}function Yae(t){return Bx.call(t)}});var $x=f(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});Qp.merge=void 0;var Hx=Gx(),qae=20;function Kae(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=Fx(e,t.shift(),0,n);return e}Qp.merge=Kae;function hm(t){return Jp(t)?t.slice():t}function Fx(t,e,n=0,r){let o;if(!(n>qae)){if(n++,zp(t)||zp(e)||jx(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(!Wae(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(kx(t,c,r)||kx(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]=Fx(o[c],u,n,r)}}}}else o=e;return o}}function kx(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 jx(t){return typeof t=="function"}function wc(t){return!zp(t)&&!Jp(t)&&!jx(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 Wae(t,e){return!(!(0,Hx.isPlainObject)(t)||!(0,Hx.isPlainObject)(e))}});var Yx=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 Xae(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=Xae});var Kx=f(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.isUrlIgnored=Ci.urlMatches=void 0;function qx(t,e){return typeof e=="string"?t===e:!!t.match(e)}Ci.urlMatches=qx;function zae(t,e){if(!e)return!1;for(let n of e)if(qx(t,n))return!0;return!1}Ci.isUrlIgnored=zae});var Wx=f(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.isWrapped=void 0;function Jae(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ed.isWrapped=Jae});var Xx=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 zx=f(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.BindOnceFuture=void 0;var Qae=Xx(),Am=class{constructor(e,n){this._callback=e,this._that=n,this._isCalled=!1,this._deferred=new Qae.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 Qx=f(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd._export=void 0;var Jx=(y(),C(x)),Zae=bc();function ece(t,e){return new Promise(n=>{Jx.context.with((0,Zae.suppressTracing)(Jx.context.active()),()=>{t.export(e,r=>{n(r)})})})}rd._export=ece});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 tce=LC();Object.defineProperty(g,"W3CBaggagePropagator",{enumerable:!0,get:function(){return tce.W3CBaggagePropagator}});var nce=DC();Object.defineProperty(g,"AnchoredClock",{enumerable:!0,get:function(){return nce.AnchoredClock}});var Rm=BC();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 rce=qT();Object.defineProperty(g,"loggingErrorHandler",{enumerable:!0,get:function(){return rce.loggingErrorHandler}});var gn=gx();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 oce=JT();Object.defineProperty(g,"hexToBinary",{enumerable:!0,get:function(){return oce.hexToBinary}});var sce=Ax();Object.defineProperty(g,"ExportResultCode",{enumerable:!0,get:function(){return sce.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 ice=Ox();Object.defineProperty(g,"CompositePropagator",{enumerable:!0,get:function(){return ice.CompositePropagator}});var sd=vx();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=bx();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 ace=dm();Object.defineProperty(g,"AlwaysOffSampler",{enumerable:!0,get:function(){return ace.AlwaysOffSampler}});var cce=Em();Object.defineProperty(g,"AlwaysOnSampler",{enumerable:!0,get:function(){return cce.AlwaysOnSampler}});var uce=Dx();Object.defineProperty(g,"ParentBasedSampler",{enumerable:!0,get:function(){return uce.ParentBasedSampler}});var lce=xx();Object.defineProperty(g,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return lce.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 pce=cm();Object.defineProperty(g,"TraceState",{enumerable:!0,get:function(){return pce.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 dce=$x();Object.defineProperty(g,"merge",{enumerable:!0,get:function(){return dce.merge}});var _ce=WT();Object.defineProperty(g,"TracesSamplerValues",{enumerable:!0,get:function(){return _ce.TracesSamplerValues}});var eU=Yx();Object.defineProperty(g,"TimeoutError",{enumerable:!0,get:function(){return eU.TimeoutError}});Object.defineProperty(g,"callWithTimeout",{enumerable:!0,get:function(){return eU.callWithTimeout}});var tU=Kx();Object.defineProperty(g,"isUrlIgnored",{enumerable:!0,get:function(){return tU.isUrlIgnored}});Object.defineProperty(g,"urlMatches",{enumerable:!0,get:function(){return tU.urlMatches}});var Ece=Wx();Object.defineProperty(g,"isWrapped",{enumerable:!0,get:function(){return Ece.isWrapped}});var fce=zx();Object.defineProperty(g,"BindOnceFuture",{enumerable:!0,get:function(){return fce.BindOnceFuture}});var Sce=ZT();Object.defineProperty(g,"VERSION",{enumerable:!0,get:function(){return Sce.VERSION}});var Tce=Qx();g.internal={_export:Tce._export}});var Vc=f(($Be,nU)=>{"use strict";var mce="2.0.0",hce=Number.MAX_SAFE_INTEGER||9007199254740991,gce=16,Ace=250,Rce=["major","premajor","minor","preminor","patch","prepatch","prerelease"];nU.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gce,MAX_SAFE_BUILD_LENGTH:Ace,MAX_SAFE_INTEGER:hce,RELEASE_TYPES:Rce,SEMVER_SPEC_VERSION:mce,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Bc=f((YBe,rU)=>{"use strict";var Oce=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};rU.exports=Oce});var Mi=f((lr,oU)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Nm,MAX_SAFE_BUILD_LENGTH:Nce,MAX_LENGTH:Ice}=Vc(),Cce=Bc();lr=oU.exports={};var Pce=lr.re=[],Mce=lr.safeRe=[],b=lr.src=[],yce=lr.safeSrc=[],L=lr.t={},vce=0,Im="[a-zA-Z0-9-]",bce=[["\\s",1],["\\d",Ice],[Im,Nce]],Lce=t=>{for(let[e,n]of bce)t=t.split(`${e}*`).join(`${e}{0,${n}}`).split(`${e}+`).join(`${e}{1,${n}}`);return t},Y=(t,e,n)=>{let r=Lce(e),o=vce++;Cce(t,o,e),L[t]=o,b[o]=e,yce[o]=r,Pce[o]=new RegExp(e,n?"g":void 0),Mce[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((qBe,sU)=>{"use strict";var Dce=Object.freeze({loose:!0}),xce=Object.freeze({}),Uce=t=>t?typeof t!="object"?Dce:t:xce;sU.exports=Uce});var Cm=f((KBe,cU)=>{"use strict";var iU=/^[0-9]+$/,aU=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let n=iU.test(t),r=iU.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},wce=(t,e)=>aU(e,t);cU.exports={compareIdentifiers:aU,rcompareIdentifiers:wce}});var At=f((WBe,lU)=>{"use strict";var cd=Bc(),{MAX_LENGTH:uU,MAX_SAFE_INTEGER:ud}=Vc(),{safeRe:ld,t:pd}=Mi(),Vce=ad(),{compareIdentifiers:Pm}=Cm(),Mm=class t{constructor(e,n){if(n=Vce(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>uU)throw new TypeError(`version is longer than ${uU} 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}};lU.exports=Mm});var Cs=f((XBe,dU)=>{"use strict";var pU=At(),Bce=(t,e,n=!1)=>{if(t instanceof pU)return t;try{return new pU(t,e)}catch(r){if(!n)return null;throw r}};dU.exports=Bce});var EU=f((zBe,_U)=>{"use strict";var Gce=Cs(),Hce=(t,e)=>{let n=Gce(t,e);return n?n.version:null};_U.exports=Hce});var SU=f((JBe,fU)=>{"use strict";var kce=Cs(),Fce=(t,e)=>{let n=kce(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};fU.exports=Fce});var hU=f((QBe,mU)=>{"use strict";var TU=At(),jce=(t,e,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new TU(t instanceof TU?t.version:t,n).inc(e,r,o).version}catch{return null}};mU.exports=jce});var RU=f((ZBe,AU)=>{"use strict";var gU=Cs(),$ce=(t,e)=>{let n=gU(t,null,!0),r=gU(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"};AU.exports=$ce});var NU=f((eGe,OU)=>{"use strict";var Yce=At(),qce=(t,e)=>new Yce(t,e).major;OU.exports=qce});var CU=f((tGe,IU)=>{"use strict";var Kce=At(),Wce=(t,e)=>new Kce(t,e).minor;IU.exports=Wce});var MU=f((nGe,PU)=>{"use strict";var Xce=At(),zce=(t,e)=>new Xce(t,e).patch;PU.exports=zce});var vU=f((rGe,yU)=>{"use strict";var Jce=Cs(),Qce=(t,e)=>{let n=Jce(t,e);return n&&n.prerelease.length?n.prerelease:null};yU.exports=Qce});var An=f((oGe,LU)=>{"use strict";var bU=At(),Zce=(t,e,n)=>new bU(t,n).compare(new bU(e,n));LU.exports=Zce});var xU=f((sGe,DU)=>{"use strict";var eue=An(),tue=(t,e,n)=>eue(e,t,n);DU.exports=tue});var wU=f((iGe,UU)=>{"use strict";var nue=An(),rue=(t,e)=>nue(t,e,!0);UU.exports=rue});var dd=f((aGe,BU)=>{"use strict";var VU=At(),oue=(t,e,n)=>{let r=new VU(t,n),o=new VU(e,n);return r.compare(o)||r.compareBuild(o)};BU.exports=oue});var HU=f((cGe,GU)=>{"use strict";var sue=dd(),iue=(t,e)=>t.sort((n,r)=>sue(n,r,e));GU.exports=iue});var FU=f((uGe,kU)=>{"use strict";var aue=dd(),cue=(t,e)=>t.sort((n,r)=>aue(r,n,e));kU.exports=cue});var Gc=f((lGe,jU)=>{"use strict";var uue=An(),lue=(t,e,n)=>uue(t,e,n)>0;jU.exports=lue});var _d=f((pGe,$U)=>{"use strict";var pue=An(),due=(t,e,n)=>pue(t,e,n)<0;$U.exports=due});var ym=f((dGe,YU)=>{"use strict";var _ue=An(),Eue=(t,e,n)=>_ue(t,e,n)===0;YU.exports=Eue});var vm=f((_Ge,qU)=>{"use strict";var fue=An(),Sue=(t,e,n)=>fue(t,e,n)!==0;qU.exports=Sue});var Ed=f((EGe,KU)=>{"use strict";var Tue=An(),mue=(t,e,n)=>Tue(t,e,n)>=0;KU.exports=mue});var fd=f((fGe,WU)=>{"use strict";var hue=An(),gue=(t,e,n)=>hue(t,e,n)<=0;WU.exports=gue});var bm=f((SGe,XU)=>{"use strict";var Aue=ym(),Rue=vm(),Oue=Gc(),Nue=Ed(),Iue=_d(),Cue=fd(),Pue=(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 Aue(t,n,r);case"!=":return Rue(t,n,r);case">":return Oue(t,n,r);case">=":return Nue(t,n,r);case"<":return Iue(t,n,r);case"<=":return Cue(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};XU.exports=Pue});var JU=f((TGe,zU)=>{"use strict";var Mue=At(),yue=Cs(),{safeRe:Sd,t:Td}=Mi(),vue=(t,e)=>{if(t instanceof Mue)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 yue(`${r}.${o}.${s}${i}${a}`,e)};zU.exports=vue});var ZU=f((mGe,QU)=>{"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}};QU.exports=Lm});var Rn=f((hGe,r0)=>{"use strict";var bue=/\s+/g,Dm=class t{constructor(e,n){if(n=Due(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(bue," "),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=>!t0(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&&Hue(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&&Bue)|(this.options.loose&&Gue))+":"+e,o=e0.get(r);if(o)return o;let s=this.options.loose,i=s?Ut[Rt.HYPHENRANGELOOSE]:Ut[Rt.HYPHENRANGE];e=e.replace(i,zue(this.options.includePrerelease)),Te("hyphen replace",e),e=e.replace(Ut[Rt.COMPARATORTRIM],Uue),Te("comparator trim",e),e=e.replace(Ut[Rt.TILDETRIM],wue),Te("tilde trim",e),e=e.replace(Ut[Rt.CARETTRIM],Vue),Te("caret trim",e);let a=e.split(" ").map(p=>kue(p,this.options)).join(" ").split(/\s+/).map(p=>Xue(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(t0(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return e0.set(r,l),l}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(r=>n0(r,n)&&e.set.some(o=>n0(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 xue(e,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(Jue(this.set[n],e,this.options))return!0;return!1}};r0.exports=Dm;var Lue=ZU(),e0=new Lue,Due=ad(),xm=Hc(),Te=Bc(),xue=At(),{safeRe:Ut,t:Rt,comparatorTrimReplace:Uue,tildeTrimReplace:wue,caretTrimReplace:Vue}=Mi(),{FLAG_INCLUDE_PRERELEASE:Bue,FLAG_LOOSE:Gue}=Vc(),t0=t=>t.value==="<0.0.0-0",Hue=t=>t.value==="",n0=(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},kue=(t,e)=>(t=t.replace(Ut[Rt.BUILD],""),Te("comp",t,e),t=$ue(t,e),Te("caret",t),t=Fue(t,e),Te("tildes",t),t=que(t,e),Te("xrange",t),t=Wue(t,e),Te("stars",t),t),wt=t=>!t||t.toLowerCase()==="x"||t==="*",Fue=(t,e)=>t.trim().split(/\s+/).map(n=>jue(n,e)).join(" "),jue=(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})},$ue=(t,e)=>t.trim().split(/\s+/).map(n=>Yue(n,e)).join(" "),Yue=(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})},que=(t,e)=>(Te("replaceXRanges",t,e),t.split(/\s+/).map(n=>Kue(n,e)).join(" ")),Kue=(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})},Wue=(t,e)=>(Te("replaceStars",t,e),t.trim().replace(Ut[Rt.STAR],"")),Xue=(t,e)=>(Te("replaceGTE0",t,e),t.trim().replace(Ut[e.includePrerelease?Rt.GTE0PRE:Rt.GTE0],"")),zue=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()),Jue=(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((gGe,u0)=>{"use strict";var kc=Symbol("SemVer ANY"),Vm=class t{static get ANY(){return kc}constructor(e,n){if(n=o0(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?s0[i0.COMPARATORLOOSE]:s0[i0.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 a0(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 a0(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 c0(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new c0(this.value,n).test(e.semver):(n=o0(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(">")))}};u0.exports=Vm;var o0=ad(),{safeRe:s0,t:i0}=Mi(),Um=bm(),wm=Bc(),a0=At(),c0=Rn()});var Fc=f((AGe,l0)=>{"use strict";var Que=Rn(),Zue=(t,e,n)=>{try{e=new Que(e,n)}catch{return!1}return e.test(t)};l0.exports=Zue});var d0=f((RGe,p0)=>{"use strict";var ele=Rn(),tle=(t,e)=>new ele(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));p0.exports=tle});var E0=f((OGe,_0)=>{"use strict";var nle=At(),rle=Rn(),ole=(t,e,n)=>{let r=null,o=null,s=null;try{s=new rle(e,n)}catch{return null}return t.forEach(i=>{s.test(i)&&(!r||o.compare(i)===-1)&&(r=i,o=new nle(r,n))}),r};_0.exports=ole});var S0=f((NGe,f0)=>{"use strict";var sle=At(),ile=Rn(),ale=(t,e,n)=>{let r=null,o=null,s=null;try{s=new ile(e,n)}catch{return null}return t.forEach(i=>{s.test(i)&&(!r||o.compare(i)===1)&&(r=i,o=new sle(r,n))}),r};f0.exports=ale});var h0=f((IGe,m0)=>{"use strict";var Bm=At(),cle=Rn(),T0=Gc(),ule=(t,e)=>{t=new cle(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||T0(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!n||T0(n,s))&&(n=s)}return n&&t.test(n)?n:null};m0.exports=ule});var A0=f((CGe,g0)=>{"use strict";var lle=Rn(),ple=(t,e)=>{try{return new lle(t,e).range||"*"}catch{return null}};g0.exports=ple});var md=f((PGe,I0)=>{"use strict";var dle=At(),N0=Hc(),{ANY:_le}=N0,Ele=Rn(),fle=Fc(),R0=Gc(),O0=_d(),Sle=fd(),Tle=Ed(),mle=(t,e,n,r)=>{t=new dle(t,r),e=new Ele(e,r);let o,s,i,a,c;switch(n){case">":o=R0,s=Sle,i=O0,a=">",c=">=";break;case"<":o=O0,s=Tle,i=R0,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(fle(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===_le&&(_=new N0(">=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};I0.exports=mle});var P0=f((MGe,C0)=>{"use strict";var hle=md(),gle=(t,e,n)=>hle(t,e,">",n);C0.exports=gle});var y0=f((yGe,M0)=>{"use strict";var Ale=md(),Rle=(t,e,n)=>Ale(t,e,"<",n);M0.exports=Rle});var L0=f((vGe,b0)=>{"use strict";var v0=Rn(),Ole=(t,e,n)=>(t=new v0(t,n),e=new v0(e,n),t.intersects(e,n));b0.exports=Ole});var x0=f((bGe,D0)=>{"use strict";var Nle=Fc(),Ile=An();D0.exports=(t,e,n)=>{let r=[],o=null,s=null,i=t.sort((l,p)=>Ile(l,p,n));for(let l of i)Nle(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 H0=f((LGe,G0)=>{"use strict";var U0=Rn(),Hm=Hc(),{ANY:Gm}=Hm,jc=Fc(),km=An(),Cle=(t,e,n={})=>{if(t===e)return!0;t=new U0(t,n),e=new U0(e,n);let r=!1;e:for(let o of t.set){for(let s of e.set){let i=Mle(o,s,n);if(r=r||i!==null,i)continue e}if(r)return!1}return!0},Ple=[new Hm(">=0.0.0-0")],w0=[new Hm(">=0.0.0")],Mle=(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=Ple:t=w0}if(e.length===1&&e[0].semver===Gm){if(n.includePrerelease)return!0;e=w0}let r=new Set,o,s;for(let _ of t)_.operator===">"||_.operator===">="?o=V0(o,_,n):_.operator==="<"||_.operator==="<="?s=B0(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=V0(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=B0(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)},V0=(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},B0=(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};G0.exports=Cle});var jm=f((DGe,j0)=>{"use strict";var Fm=Mi(),k0=Vc(),yle=At(),F0=Cm(),vle=Cs(),ble=EU(),Lle=SU(),Dle=hU(),xle=RU(),Ule=NU(),wle=CU(),Vle=MU(),Ble=vU(),Gle=An(),Hle=xU(),kle=wU(),Fle=dd(),jle=HU(),$le=FU(),Yle=Gc(),qle=_d(),Kle=ym(),Wle=vm(),Xle=Ed(),zle=fd(),Jle=bm(),Qle=JU(),Zle=Hc(),epe=Rn(),tpe=Fc(),npe=d0(),rpe=E0(),ope=S0(),spe=h0(),ipe=A0(),ape=md(),cpe=P0(),upe=y0(),lpe=L0(),ppe=x0(),dpe=H0();j0.exports={parse:vle,valid:ble,clean:Lle,inc:Dle,diff:xle,major:Ule,minor:wle,patch:Vle,prerelease:Ble,compare:Gle,rcompare:Hle,compareLoose:kle,compareBuild:Fle,sort:jle,rsort:$le,gt:Yle,lt:qle,eq:Kle,neq:Wle,gte:Xle,lte:zle,cmp:Jle,coerce:Qle,Comparator:Zle,Range:epe,satisfies:tpe,toComparators:npe,maxSatisfying:rpe,minSatisfying:ope,minVersion:spe,validRange:ipe,outside:ape,gtr:cpe,ltr:upe,intersects:lpe,simplifyRange:ppe,subset:dpe,SemVer:yle,re:Fm.re,src:Fm.src,tokens:Fm.t,SEMVER_SPEC_VERSION:k0.SEMVER_SPEC_VERSION,RELEASE_TYPES:k0.RELEASE_TYPES,compareIdentifiers:F0.compareIdentifiers,rcompareIdentifiers:F0.rcompareIdentifiers}});var $0=f(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.VERSION=void 0;hd.VERSION="0.57.2"});var Y0=f($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.SeverityNumber=void 0;var _pe;(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"})(_pe=$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 Epe=Ad(),Rd=class{getLogger(e,n,r){return new Epe.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 fpe=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):fpe.NOOP_LOGGER}};Nd.ProxyLogger=$m});var Km=f(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.ProxyLoggerProvider=void 0;var Spe=Od(),Tpe=Ym(),qm=class{getLogger(e,n,r){var o;return(o=this.getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Tpe.ProxyLogger(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Spe.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 q0=f(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd._globalThis=void 0;Cd._globalThis=typeof globalThis=="object"?globalThis:global});var K0=f(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd._globalThis=void 0;var mpe=q0();Object.defineProperty(Pd,"_globalThis",{enumerable:!0,get:function(){return mpe._globalThis}})});var W0=f(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md._globalThis=void 0;var hpe=K0();Object.defineProperty(Md,"_globalThis",{enumerable:!0,get:function(){return hpe._globalThis}})});var X0=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 gpe=W0();pr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");pr._global=gpe._globalThis;function Ape(t,e,n){return r=>r===t?e:n}pr.makeGetter=Ape;pr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var J0=f(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});yd.LogsAPI=void 0;var On=X0(),Rpe=Od(),z0=Km(),Wm=class t{constructor(){this._proxyLoggerProvider=new z0.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,Rpe.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 z0.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 Ope=Y0();Object.defineProperty(st,"SeverityNumber",{enumerable:!0,get:function(){return Ope.SeverityNumber}});var Q0=Ad();Object.defineProperty(st,"NOOP_LOGGER",{enumerable:!0,get:function(){return Q0.NOOP_LOGGER}});Object.defineProperty(st,"NoopLogger",{enumerable:!0,get:function(){return Q0.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 Npe=Ym();Object.defineProperty(st,"ProxyLogger",{enumerable:!0,get:function(){return Npe.ProxyLogger}});var Ipe=Km();Object.defineProperty(st,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Ipe.ProxyLoggerProvider}});var Cpe=J0();st.logs=Cpe.LogsAPI.getInstance()});var ew=f(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.disableInstrumentations=bi.enableInstrumentations=void 0;function Ppe(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=Ppe;function Mpe(t){t.forEach(e=>e.disable())}bi.disableInstrumentations=Mpe});var rw=f(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.registerInstrumentations=void 0;var tw=(y(),C(x)),ype=Xm(),nw=ew();function vpe(t){var e,n;let r=t.tracerProvider||tw.trace.getTracerProvider(),o=t.meterProvider||tw.metrics.getMeterProvider(),s=t.loggerProvider||ype.logs.getLoggerProvider(),i=(n=(e=t.instrumentations)===null||e===void 0?void 0:e.flat())!==null&&n!==void 0?n:[];return(0,nw.enableInstrumentations)(i,r,o,s),()=>{(0,nw.disableInstrumentations)(i)}}vd.registerInstrumentations=vpe});var Jm=f((WGe,iw)=>{"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 ow(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 bpe(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){ow(r,o,n)})})}function sw(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 Lpe(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){sw(n,r)})})}qc.wrap=ow;qc.massWrap=bpe;qc.unwrap=sw;qc.massUnwrap=Lpe;iw.exports=qc});var aw=f(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.InstrumentationAbstract=void 0;var Qm=(y(),C(x)),Dpe=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=Dpe.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 uw=f((zGe,cw)=>{var Li=1e3,Di=Li*60,xi=Di*60,Ps=xi*24,xpe=Ps*7,Upe=Ps*365.25;cw.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return wpe(t);if(n==="number"&&isFinite(t))return e.long?Bpe(t):Vpe(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function wpe(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*Upe;case"weeks":case"week":case"w":return n*xpe;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 Vpe(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 Bpe(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((JGe,lw)=>{function Gpe(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=uw(),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}lw.exports=Gpe});var pw=f((Xt,xd)=>{Xt.formatArgs=kpe;Xt.save=Fpe;Xt.load=jpe;Xt.useColors=Hpe;Xt.storage=$pe();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 Hpe(){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 kpe(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 Fpe(t){try{t?Xt.storage.setItem("debug",t):Xt.storage.removeItem("debug")}catch{}}function jpe(){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 $pe(){try{return localStorage}catch{}}xd.exports=eh()(Xt);var{formatters:Ype}=xd.exports;Ype.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var _w=f((QGe,dw)=>{"use strict";dw.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 Sw=f((ZGe,fw)=>{"use strict";var qpe=require("os"),Ew=require("tty"),Nn=_w(),{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=qpe.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 Kpe(t){let e=nh(t,t&&t.isTTY);return th(e)}fw.exports={supportsColor:Kpe,stdout:th(nh(!0,Ew.isatty(1))),stderr:th(nh(!0,Ew.isatty(2)))}});var mw=f((at,wd)=>{var Wpe=require("tty"),Ud=require("util");at.init=tde;at.log=Qpe;at.formatArgs=zpe;at.save=Zpe;at.load=ede;at.useColors=Xpe;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=Sw();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 Xpe(){return"colors"in at.inspectOpts?!!at.inspectOpts.colors:Wpe.isatty(process.stderr.fd)}function zpe(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
- `).join(`
3
- `+s),t.push(o+"m+"+wd.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Jpe()+e+" "+t[0]}function Jpe(){return at.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Qpe(...t){return process.stderr.write(Ud.formatWithOptions(at.inspectOpts,...t)+`
4
- `)}function Zpe(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function ede(){return process.env.DEBUG}function tde(t){t.inspectOpts={};let e=Object.keys(at.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=at.inspectOpts[e[n]]}wd.exports=eh()(at);var{formatters:Tw}=wd.exports;Tw.o=function(t){return this.inspectOpts.colors=this.useColors,Ud.inspect(t,this.inspectOpts).split(`
5
- `).map(e=>e.trim()).join(" ")};Tw.O=function(t){return this.inspectOpts.colors=this.useColors,Ud.inspect(t,this.inspectOpts)}});var hw=f((eHe,rh)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?rh.exports=pw():rh.exports=mw()});var sh=f((tHe,gw)=>{"use strict";var oh=require("path").sep;gw.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((nHe,Aw)=>{"use strict";var nde=require("os");Aw.exports=nde.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((rHe,Rw)=>{"use strict";Rw.exports=Error});var ah=f((oHe,Ow)=>{"use strict";var Bd=Vd();Ow.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 Nw=f((sHe,Kc)=>{"use strict";var rde=process.platform==="win32",ode=/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/,ch={};function sde(t){return ode.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=sde(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 ide=/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/,uh={};function ade(t){return ide.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=ade(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]}};rde?Kc.exports=ch.parse:Kc.exports=uh.parse;Kc.exports.posix=uh.parse;Kc.exports.win32=ch.parse});var lh=f((iHe,Mw)=>{var Pw=require("path"),Iw=Pw.parse||Nw(),cde=/^([A-Za-z]:)/,ude=/^\\\\/;function Cw(t,e){var n="/";cde.test(t)?n="":ude.test(t)&&(n="\\\\");for(var r=[t],o=Iw(t);o.dir!==r[r.length-1];)r.push(o.dir),o=Iw(o.dir);return r.reduce(function(s,i){return s.concat(e.map(function(a){return Pw.resolve(n,i,a)}))},[])}Mw.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 Cw(e,o)},n);var s=Cw(e,o);return n&&n.paths?s.concat(n.paths):s}});var ph=f((aHe,yw)=>{yw.exports=function(t,e){return e||{}}});var Lw=f((cHe,bw)=>{"use strict";var lde="Function.prototype.bind called on incompatible ",pde=Object.prototype.toString,dde=Math.max,_de="[object Function]",vw=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},Ede=function(e,n){for(var r=[],o=n||0,s=0;o<e.length;o+=1,s+=1)r[s]=e[o];return r},fde=function(t,e){for(var n="",r=0;r<t.length;r+=1)n+=t[r],r+1<t.length&&(n+=e);return n};bw.exports=function(e){var n=this;if(typeof n!="function"||pde.apply(n)!==_de)throw new TypeError(lde+n);for(var r=Ede(arguments,1),o,s=function(){if(this instanceof o){var l=n.apply(this,vw(r,arguments));return Object(l)===l?l:this}return n.apply(e,vw(r,arguments))},i=dde(0,n.length-r.length),a=[],c=0;c<i;c++)a[c]="$"+c;if(o=Function("binder","return function ("+fde(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 xw=f((uHe,Dw)=>{"use strict";var Sde=Lw();Dw.exports=Function.prototype.bind||Sde});var ww=f((lHe,Uw)=>{"use strict";var Tde=Function.prototype.call,mde=Object.prototype.hasOwnProperty,hde=xw();Uw.exports=hde.call(Tde,mde)});var Vw=f((pHe,gde)=>{gde.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((dHe,Hw)=>{"use strict";var Ade=ww();function Rde(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 Bw(t,e){var n=e.split(/ ?&& ?/);if(n.length===0)return!1;for(var r=0;r<n.length;++r)if(!Rde(t,n[r]))return!1;return!0}function Ode(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(Bw(n,e[r]))return!0;return!1}return Bw(n,e)}var Gw=Vw();Hw.exports=function(e,n){return Ade(Gw,e)&&Ode(n,Gw[e])}});var dh=f((_He,kw)=>{"use strict";kw.exports=TypeError});var $w=f((EHe,jw)=>{var Ms=require("fs"),Nde=ih(),Ye=require("path"),Ide=ah(),Cde=lh(),Pde=ph(),Mde=Wc(),Fw=Vd(),_h=dh(),yde=process.platform!=="win32"&&Ms.realpath&&typeof Ms.realpath.native=="function"?Ms.realpath.native:Ms.realpath,vde=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,bde=/^\w:[/\\]*$/,Lde=/[/\\]node_modules[/\\]*$/,Eh=Nde();function Dde(){return Eh?[Ye.join(Eh,".node_modules"),Ye.join(Eh,".node_libraries")]:[]}var xde=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())})},Ude=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())})},wde=function(e,n){yde(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 Vde(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 Bde(t,e,n){for(var r=Cde(e,n,t),o=0;o<r.length;o++)r[o]=Ye.join(r[o],t);return r}jw.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=Pde(e,s);var a=s.isFile||xde,c=s.isDirectory||Ude,u=s.readFile||Ms.readFile,l=s.realpath||wde,p=s.readPackage||Vde;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(Ide()),h=s.filename||T;s.paths=s.paths||Dde();var R=Ye.resolve(T);Xc(l,R,s,function(w,Q){w?o(w):N(Q)});var O;function N(w){if(vde.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&&Mde(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 Fw("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 Fw("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"&&bde.test(w)||Lde.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 Bde(w,Q,s)};q(Re,_?_(w,Q,ne,s):ne())}}});var Yw=f((fHe,Gde)=>{Gde.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 Xw=f((SHe,Ww)=>{"use strict";var Hde=Wc(),qw=Yw(),Kw={};for(Gd in qw)Object.prototype.hasOwnProperty.call(qw,Gd)&&(Kw[Gd]=Hde(Gd));var Gd;Ww.exports=Kw});var Jw=f((THe,zw)=>{var kde=Wc();zw.exports=function(e){return kde(e)}});var Zw=f((mHe,Qw)=>{var Fde=Wc(),ys=require("fs"),Ot=require("path"),jde=Vd(),fh=dh(),$de=ih(),Yde=ah(),qde=lh(),Kde=ph(),Wde=process.platform!=="win32"&&ys.realpathSync&&typeof ys.realpathSync.native=="function"?ys.realpathSync.native:ys.realpathSync,Xde=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,zde=/^\w:[/\\]*$/,Jde=/[/\\]node_modules[/\\]*$/,Sh=$de();function Qde(){return Sh?[Ot.join(Sh,".node_modules"),Ot.join(Sh,".node_libraries")]:[]}var 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.isFile()||n.isFIFO())},e_e=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()},t_e=function(e){try{return Wde(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 n_e(t,e){var n=t(e);try{var r=JSON.parse(n);return r}catch{}}function r_e(t,e,n){for(var r=qde(e,n,t),o=0;o<r.length;o++)r[o]=Ot.join(r[o],t);return r}Qw.exports=function(e,n){if(typeof e!="string")throw new fh("Path must be a string.");var r=Kde(e,n),o=r.isFile||Zde,s=r.readFileSync||ys.readFileSync,i=r.isDirectory||e_e,a=r.realpathSync||t_e,c=r.readPackageSync||n_e;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(Yde()),_=r.filename||d;r.paths=r.paths||Qde();var E=zc(a,Ot.resolve(d),r);if(Xde.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&&Fde(e))return e;var h=M(e,E);if(h)return zc(a,h,r)}var R=new jde("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"&&zde.test(v))&&!Jde.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 r_e(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((hHe,e1)=>{var Hd=$w();Hd.core=Xw();Hd.isCore=Jw();Hd.sync=Zw();e1.exports=Hd});var t1=f((gHe,o_e)=>{o_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((AHe,gh)=>{"use strict";var wi=require("path"),Hn=require("module"),Ge=hw()("require-in-the-middle"),s_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 i_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 a_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,t1().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=s_e(d);if(R===void 0)return Ge("could not parse filename: %s",d),T;_=R.name,E=R.basedir;let O=c_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=i_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 c_e(t){let e=wi.sep!=="/"?t.path.split(wi.sep).join("/"):t.path;return wi.posix.join(t.name,e).replace(a_e,"")}});var n1=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 o1=f(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.RequireInTheMiddleSingleton=void 0;var u_e=Ah(),r1=require("path"),Oh=n1(),l_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 u_e.Hook(null,{internals:!0},(e,n,r)=>{let o=p_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 l_e?new t:this._instance=(e=this._instance)!==null&&e!==void 0?e:new t}};jd.RequireInTheMiddleSingleton=Nh;function p_e(t){return r1.sep!==Oh.ModuleNameSeparator?t.split(r1.sep).join(Oh.ModuleNameSeparator):t}});var l1=f(vs=>{var s1=[],Ih=new WeakMap,i1=new WeakMap,a1=new Map,c1=[],d_e={set(t,e,n){return Ih.get(t)[e](n)},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=i1.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 __e(t,e,n,r,o){a1.set(t,o),Ih.set(e,n),i1.set(e,r);let s=new Proxy(e,d_e);s1.forEach(i=>i(t,s)),c1.push([t,s])}var u1=!1;function E_e(){return u1}function f_e(t){u1=t}vs.register=__e;vs.importHooks=s1;vs.specifiers=a1;vs.toHook=c1;vs.getExperimentalPatchInternals=E_e;vs.setExperimentalPatchInternals=f_e});var $d=f((IHe,Vi)=>{var p1=require("path"),S_e=sh(),{fileURLToPath:d1}=require("url"),{MessageChannel:T_e}=require("worker_threads"),{importHooks:Ch,specifiers:m_e,toHook:h_e,getExperimentalPatchInternals:g_e}=l1();function E1(t){Ch.push(t),h_e.forEach(([e,n])=>t(e,n))}function f1(t){let e=Ch.indexOf(t);e>-1&&Ch.splice(e,1)}function _1(t,e,n,r){let o=t(e,n,r);o&&o!==e&&(e.default=o)}var Ph;function A_e(){let{port1:t,port2:e}=new T_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=d1(o)}catch{}let u=S_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+p1.sep+p1.relative(c,d1(i));else if(!g_e()&&!c.endsWith(m_e.get(i)))continue}_1(n,s,o,c)}}else _1(n,s,o,c)},E1(this._iitmHook)}Qc.prototype.unhook=function(){f1(this._iitmHook)};Vi.exports=Qc;Vi.exports.Hook=Qc;Vi.exports.addHook=E1;Vi.exports.removeHook=f1;Vi.exports.createAddHookMessageChannel=A_e});var Mh=f(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isWrapped=Oo.safeExecuteInTheMiddleAsync=Oo.safeExecuteInTheMiddle=void 0;function R_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=R_e;async function O_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=O_e;function N_e(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Oo.isWrapped=N_e});var m1=f(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.InstrumentationBase=void 0;var Zc=require("path"),S1=require("util"),I_e=jm(),yh=Jm(),C_e=aw(),P_e=o1(),M_e=$d(),eu=(y(),C(x)),y_e=Ah(),v_e=require("fs"),b_e=Mh(),vh=class extends C_e.InstrumentationAbstract{constructor(e,n,r){super(e,n,r),this._hooks=[],this._requireInTheMiddleSingleton=P_e.RequireInTheMiddleSingleton.getInstance(),this._enabled=!1,this._wrap=(s,i,a)=>{if((0,b_e.isWrapped)(s[i])&&this._unwrap(s,i),S1.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)=>S1.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,v_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 T1(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=>T1(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 y_e.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new M_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 T1(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,I_e.satisfies)(e,r,{includePrerelease:n}))}});var h1=f(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.normalize=void 0;var L_e=require("path");Object.defineProperty(qd,"normalize",{enumerable:!0,get:function(){return L_e.normalize}})});var g1=f(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.normalize=Bi.InstrumentationBase=void 0;var D_e=m1();Object.defineProperty(Bi,"InstrumentationBase",{enumerable:!0,get:function(){return D_e.InstrumentationBase}});var x_e=h1();Object.defineProperty(Bi,"normalize",{enumerable:!0,get:function(){return x_e.normalize}})});var bh=f(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.normalize=Gi.InstrumentationBase=void 0;var A1=g1();Object.defineProperty(Gi,"InstrumentationBase",{enumerable:!0,get:function(){return A1.InstrumentationBase}});Object.defineProperty(Gi,"normalize",{enumerable:!0,get:function(){return A1.normalize}})});var R1=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 O1=f(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.InstrumentationNodeModuleFile=void 0;var U_e=bh(),Dh=class{constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,U_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 w_e=rw();Object.defineProperty(Nt,"registerInstrumentations",{enumerable:!0,get:function(){return w_e.registerInstrumentations}});var V_e=bh();Object.defineProperty(Nt,"InstrumentationBase",{enumerable:!0,get:function(){return V_e.InstrumentationBase}});var B_e=R1();Object.defineProperty(Nt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return B_e.InstrumentationNodeModuleDefinition}});var G_e=O1();Object.defineProperty(Nt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return G_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 N1=f(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.AttributeNames=void 0;var H_e;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(H_e=tu.AttributeNames||(tu.AttributeNames={}))});var C1=f((UHe,I1)=>{"use strict";var k_e=require("util");function Uh(t,e){Error.captureStackTrace(this,Uh),this.name=this.constructor.name,this.message=t,this.input=e}k_e.inherits(Uh,Error);I1.exports=Uh});var M1=f((wHe,P1)=>{"use strict";function F_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 j_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 $_e(t){return t>=32&&t<=126}function Y_e(t){return t>=128&&t<=255}P1.exports={isDelimiter:F_e,isTokenChar:j_e,isExtended:Y_e,isPrint:$_e}});var D1=f((VHe,L1)=>{"use strict";var q_e=require("util"),Hi=C1(),Xd=M1(),K_e=Xd.isDelimiter,y1=Xd.isTokenChar,v1=Xd.isExtended,W_e=Xd.isPrint;function b1(t){return t.replace(/\\(.)/g,"$1")}function nu(t,e){return q_e.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function X_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(y1(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||W_e(u)||v1(u)))n=!1;else if(y1(u)){if(a!==-1)throw new Hi(nu(t,l),t);i===-1&&(i=l)}else if(K_e(u)||v1(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?b1(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?b1(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}L1.exports=X_e});var G1=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(),C(x)),P=(hn(),C(mn)),x1=oe(),z_e=require("url"),zd=N1(),J_e=D1(),Q_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=Q_e;var Z_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=Z_e;var eEe=(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=eEe;var tEe=(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=tEe;var nEe=(t,e)=>{let n=U1(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=nEe;var rEe=(t,e)=>{let n=U1(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=rEe;function U1(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var oEe=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};B.isCompressed=oEe;function sEe(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 iEe=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=sEe(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 z_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=iEe;var aEe=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};B.isValidOptionsType=aEe;var cEe=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=cEe;var uEe=(t,e,n)=>{var r,o;let s=e.hostname,i=e.port,a=(r=t.method)!==null&&r!==void 0?r:"GET",c=V1(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=uEe;var lEe=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=lEe;var pEe=(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=pEe;var dEe=(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=dEe;var _Ee=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=_Ee;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 EEe(t,e){let n=t.headers.forwarded;if(n){for(let s of B1(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 w1(t){let e=t.headers.forwarded;if(e){for(let o of B1(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=w1;function fEe(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 SEe=(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=V1(u),p=EEe(t,e.component),d=e.serverName,_=w1(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=fEe(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=SEe;var TEe=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=TEe;var mEe=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[P.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,x1.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===x1.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=mEe;var hEe=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=hEe;var gEe=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=gEe;function AEe(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=AEe;var REe=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]);function V1(t){if(t==null)return"GET";let e=t.toUpperCase();return REe.has(e)?e:"_OTHER"}function B1(t){try{return J_e(t)}catch{return[]}}});var k1=f(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.HttpInstrumentation=void 0;var F=(y(),C(x)),ki=oe(),H1=jm(),OEe=require("url"),NEe=$0(),In=te(),wh=oe(),Vh=require("events"),ve=(hn(),C(mn)),Ie=G1(),Bh=class extends In.InstrumentationBase{constructor(e={}){super("@opentelemetry/instrumentation-http",NEe.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),H1.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 OEe.URL)?i.shift():void 0,{method:c,invalidUrl:u,optionsParsed:l}=(0,Ie.getRequestInfo)(r._diag,s,a);if(e==="http"&&H1.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 F1=f(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.HttpInstrumentation=void 0;var IEe=k1();Object.defineProperty(Qd,"HttpInstrumentation",{enumerable:!0,get:function(){return IEe.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 _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,bk,Lk,aTe,Wg,cTe,uTe,lTe,pTe,Xg,dTe,_Te,ETe,fTe,STe,TTe,mTe,hTe,gTe,ATe,RTe,OTe,NTe,ITe,CTe,PTe,MTe,yTe,zg,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,ime,ame,cme,ume,Iu,ia,Jg,lme,pme,Y_,dme,_me,Eme,fme,Sme,Tme,mme,Cu,hme,gme,Ame,Rme,Ome,Nme,Ime,Cme,Pme,Mme,yme,vme,bme,Lme,Dme,xme,Ume,wme,Vme,Bme,Gme,Hme,kme,Qg,Fme,jme,$me,Yme,qme,Kme,Wme,Xme,zme,Jme,Qme,Zme,ehe,the,nhe,rhe,ohe,she,ihe,Zg,ahe,eA,che,uhe,lhe,phe,dhe,_he,Ehe,fhe,She,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,NF,IF,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,age,cge,uge,lge,CF,PF,MF,yF,vF,bF,LF,DF,xF,UF,wF,pge,dge,_ge,Ege,fge,Sge,Tge,mge,hge,gge,Age,Rge,VF,BF,GF,HF,kF,Oge,Nge,Ige,Cge,Pge,Mge,FF,jF,$F,yge,vge,bge,Lge,YF,qF,KF,WF,Dge,xge,Uge,wge,Vge,XF,zF,JF,QF,ZF,ej,tj,Bge,Gge,Hge,kge,Fge,jge,$ge,Yge,nj,rj,oj,sj,ij,qge,Kge,Wge,Xge,zge,Jge,aj,cj,uj,lj,pj,dj,_j,Ej,fj,Sj,Tj,mj,hj,gj,Aj,Rj,Oj,Nj,Ij,Cj,Pj,Qge,Zge,eAe,tAe,nAe,rAe,oAe,sAe,iAe,aAe,cAe,uAe,lAe,pAe,dAe,_Ae,EAe,fAe,SAe,TAe,mAe,hAe,Mj,yj,vj,bj,Lj,gAe,AAe,RAe,OAe,NAe,IAe,Dj,xj,CAe,PAe,MAe,Uj,wj,yAe,vAe,bAe,Vj,Bj,Gj,Hj,kj,Fj,jj,$j,Yj,qj,Kj,Wj,Xj,zj,Jj,Qj,Zj,LAe,DAe,xAe,UAe,wAe,VAe,BAe,GAe,HAe,kAe,FAe,jAe,$Ae,YAe,qAe,KAe,WAe,XAe,e$,t$,zAe,JAe,QAe,n$=U(()=>{Kg();_G="aws.lambda.invoked_arn",EG="db.system",fG="db.connection_string",SG="db.user",TG="db.jdbc.driver_classname",mG="db.name",hG="db.statement",gG="db.operation",AG="db.mssql.instance_name",RG="db.cassandra.keyspace",OG="db.cassandra.page_size",NG="db.cassandra.consistency_level",IG="db.cassandra.table",CG="db.cassandra.idempotence",PG="db.cassandra.speculative_execution_count",MG="db.cassandra.coordinator.id",yG="db.cassandra.coordinator.dc",vG="db.hbase.namespace",bG="db.redis.database_index",LG="db.mongodb.collection",DG="db.sql.table",xG="exception.type",UG="exception.message",wG="exception.stacktrace",VG="exception.escaped",BG="faas.trigger",GG="faas.execution",HG="faas.document.collection",kG="faas.document.operation",FG="faas.document.time",jG="faas.document.name",$G="faas.time",YG="faas.cron",qG="faas.coldstart",KG="faas.invoked_name",WG="faas.invoked_provider",XG="faas.invoked_region",zG="net.transport",JG="net.peer.ip",QG="net.peer.port",ZG="net.peer.name",eH="net.host.ip",tH="net.host.port",nH="net.host.name",rH="net.host.connection.type",oH="net.host.connection.subtype",sH="net.host.carrier.name",iH="net.host.carrier.mcc",aH="net.host.carrier.mnc",cH="net.host.carrier.icc",uH="peer.service",lH="enduser.id",pH="enduser.role",dH="enduser.scope",_H="thread.id",EH="thread.name",fH="code.function",SH="code.namespace",TH="code.filepath",mH="code.lineno",hH="http.method",gH="http.url",AH="http.target",RH="http.host",OH="http.scheme",NH="http.status_code",IH="http.flavor",CH="http.user_agent",PH="http.request_content_length",MH="http.request_content_length_uncompressed",yH="http.response_content_length",vH="http.response_content_length_uncompressed",bH="http.server_name",LH="http.route",DH="http.client_ip",xH="aws.dynamodb.table_names",UH="aws.dynamodb.consumed_capacity",wH="aws.dynamodb.item_collection_metrics",VH="aws.dynamodb.provisioned_read_capacity",BH="aws.dynamodb.provisioned_write_capacity",GH="aws.dynamodb.consistent_read",HH="aws.dynamodb.projection",kH="aws.dynamodb.limit",FH="aws.dynamodb.attributes_to_get",jH="aws.dynamodb.index_name",$H="aws.dynamodb.select",YH="aws.dynamodb.global_secondary_indexes",qH="aws.dynamodb.local_secondary_indexes",KH="aws.dynamodb.exclusive_start_table",WH="aws.dynamodb.table_count",XH="aws.dynamodb.scan_forward",zH="aws.dynamodb.segment",JH="aws.dynamodb.total_segments",QH="aws.dynamodb.count",ZH="aws.dynamodb.scanned_count",ek="aws.dynamodb.attribute_definitions",tk="aws.dynamodb.global_secondary_index_updates",nk="messaging.system",rk="messaging.destination",ok="messaging.destination_kind",sk="messaging.temp_destination",ik="messaging.protocol",ak="messaging.protocol_version",ck="messaging.url",uk="messaging.message_id",lk="messaging.conversation_id",pk="messaging.message_payload_size_bytes",dk="messaging.message_payload_compressed_size_bytes",_k="messaging.operation",Ek="messaging.consumer_id",fk="messaging.rabbitmq.routing_key",Sk="messaging.kafka.message_key",Tk="messaging.kafka.consumer_group",mk="messaging.kafka.client_id",hk="messaging.kafka.partition",gk="messaging.kafka.tombstone",Ak="rpc.system",Rk="rpc.service",Ok="rpc.method",Nk="rpc.grpc.status_code",Ik="rpc.jsonrpc.version",Ck="rpc.jsonrpc.request_id",Pk="rpc.jsonrpc.error_code",Mk="rpc.jsonrpc.error_message",yk="message.type",vk="message.id",bk="message.compressed_size",Lk="message.uncompressed_size",aTe=_G,Wg=EG,cTe=fG,uTe=SG,lTe=TG,pTe=mG,Xg=hG,dTe=gG,_Te=AG,ETe=RG,fTe=OG,STe=NG,TTe=IG,mTe=CG,hTe=PG,gTe=MG,ATe=yG,RTe=vG,OTe=bG,NTe=LG,ITe=DG,CTe=xG,PTe=UG,MTe=wG,yTe=VG,zg=BG,vTe=GG,bTe=HG,LTe=kG,DTe=FG,xTe=jG,UTe=$G,wTe=YG,VTe=qG,BTe=KG,GTe=WG,HTe=XG,kTe=zG,FTe=JG,jTe=QG,$Te=ZG,YTe=eH,qTe=tH,KTe=nH,WTe=rH,XTe=oH,zTe=sH,JTe=iH,QTe=aH,ZTe=cH,eme=uH,tme=lH,nme=pH,rme=dH,ome=_H,sme=EH,ime=fH,ame=SH,cme=TH,ume=mH,Iu=hH,ia=gH,Jg=AH,lme=RH,pme=OH,Y_=NH,dme=IH,_me=CH,Eme=PH,fme=MH,Sme=yH,Tme=vH,mme=bH,Cu=LH,hme=DH,gme=xH,Ame=UH,Rme=wH,Ome=VH,Nme=BH,Ime=GH,Cme=HH,Pme=kH,Mme=FH,yme=jH,vme=$H,bme=YH,Lme=qH,Dme=KH,xme=WH,Ume=XH,wme=zH,Vme=JH,Bme=QH,Gme=ZH,Hme=ek,kme=tk,Qg=nk,Fme=rk,jme=ok,$me=sk,Yme=ik,qme=ak,Kme=ck,Wme=uk,Xme=lk,zme=pk,Jme=dk,Qme=_k,Zme=Ek,ehe=fk,the=Sk,nhe=Tk,rhe=mk,ohe=hk,she=gk,ihe=Ak,Zg=Rk,ahe=Ok,eA=Nk,che=Ik,uhe=Ck,lhe=Pk,phe=Mk,dhe=yk,_he=vk,Ehe=bk,fhe=Lk,She=Fe([_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,bk,Lk]),Dk="other_sql",xk="mssql",Uk="mysql",wk="oracle",Vk="db2",Bk="postgresql",Gk="redshift",Hk="hive",kk="cloudscape",Fk="hsqldb",jk="progress",$k="maxdb",Yk="hanadb",qk="ingres",Kk="firstsql",Wk="edb",Xk="cache",zk="adabas",Jk="firebird",Qk="derby",Zk="filemaker",eF="informix",tF="instantdb",nF="interbase",rF="mariadb",oF="netezza",sF="pervasive",iF="pointbase",aF="sqlite",cF="sybase",uF="teradata",lF="vertica",pF="h2",dF="coldfusion",_F="cassandra",EF="hbase",fF="mongodb",SF="redis",TF="couchbase",mF="couchdb",hF="cosmosdb",gF="dynamodb",AF="neo4j",RF="geode",OF="elasticsearch",NF="memcached",IF="cockroachdb",The=Dk,mhe=xk,hhe=Uk,ghe=wk,Ahe=Vk,Rhe=Bk,Ohe=Gk,Nhe=Hk,Ihe=kk,Che=Fk,Phe=jk,Mhe=$k,yhe=Yk,vhe=qk,bhe=Kk,Lhe=Wk,Dhe=Xk,xhe=zk,Uhe=Jk,whe=Qk,Vhe=Zk,Bhe=eF,Ghe=tF,Hhe=nF,khe=rF,Fhe=oF,jhe=sF,$he=iF,Yhe=aF,qhe=cF,Khe=uF,Whe=lF,Xhe=pF,zhe=dF,Jhe=_F,Qhe=EF,Zhe=fF,ege=SF,tge=TF,nge=mF,rge=hF,oge=gF,sge=AF,ige=RF,age=OF,cge=NF,uge=IF,lge=Fe([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,NF,IF]),CF="all",PF="each_quorum",MF="quorum",yF="local_quorum",vF="one",bF="two",LF="three",DF="local_one",xF="any",UF="serial",wF="local_serial",pge=CF,dge=PF,_ge=MF,Ege=yF,fge=vF,Sge=bF,Tge=LF,mge=DF,hge=xF,gge=UF,Age=wF,Rge=Fe([CF,PF,MF,yF,vF,bF,LF,DF,xF,UF,wF]),VF="datasource",BF="http",GF="pubsub",HF="timer",kF="other",Oge=VF,Nge=BF,Ige=GF,Cge=HF,Pge=kF,Mge=Fe([VF,BF,GF,HF,kF]),FF="insert",jF="edit",$F="delete",yge=FF,vge=jF,bge=$F,Lge=Fe([FF,jF,$F]),YF="alibaba_cloud",qF="aws",KF="azure",WF="gcp",Dge=YF,xge=qF,Uge=KF,wge=WF,Vge=Fe([YF,qF,KF,WF]),XF="ip_tcp",zF="ip_udp",JF="ip",QF="unix",ZF="pipe",ej="inproc",tj="other",Bge=XF,Gge=zF,Hge=JF,kge=QF,Fge=ZF,jge=ej,$ge=tj,Yge=Fe([XF,zF,JF,QF,ZF,ej,tj]),nj="wifi",rj="wired",oj="cell",sj="unavailable",ij="unknown",qge=nj,Kge=rj,Wge=oj,Xge=sj,zge=ij,Jge=Fe([nj,rj,oj,sj,ij]),aj="gprs",cj="edge",uj="umts",lj="cdma",pj="evdo_0",dj="evdo_a",_j="cdma2000_1xrtt",Ej="hsdpa",fj="hsupa",Sj="hspa",Tj="iden",mj="evdo_b",hj="lte",gj="ehrpd",Aj="hspap",Rj="gsm",Oj="td_scdma",Nj="iwlan",Ij="nr",Cj="nrnsa",Pj="lte_ca",Qge=aj,Zge=cj,eAe=uj,tAe=lj,nAe=pj,rAe=dj,oAe=_j,sAe=Ej,iAe=fj,aAe=Sj,cAe=Tj,uAe=mj,lAe=hj,pAe=gj,dAe=Aj,_Ae=Rj,EAe=Oj,fAe=Nj,SAe=Ij,TAe=Cj,mAe=Pj,hAe=Fe([aj,cj,uj,lj,pj,dj,_j,Ej,fj,Sj,Tj,mj,hj,gj,Aj,Rj,Oj,Nj,Ij,Cj,Pj]),Mj="1.0",yj="1.1",vj="2.0",bj="SPDY",Lj="QUIC",gAe=Mj,AAe=yj,RAe=vj,OAe=bj,NAe=Lj,IAe={HTTP_1_0:Mj,HTTP_1_1:yj,HTTP_2_0:vj,SPDY:bj,QUIC:Lj},Dj="queue",xj="topic",CAe=Dj,PAe=xj,MAe=Fe([Dj,xj]),Uj="receive",wj="process",yAe=Uj,vAe=wj,bAe=Fe([Uj,wj]),Vj=0,Bj=1,Gj=2,Hj=3,kj=4,Fj=5,jj=6,$j=7,Yj=8,qj=9,Kj=10,Wj=11,Xj=12,zj=13,Jj=14,Qj=15,Zj=16,LAe=Vj,DAe=Bj,xAe=Gj,UAe=Hj,wAe=kj,VAe=Fj,BAe=jj,GAe=$j,HAe=Yj,kAe=qj,FAe=Kj,jAe=Wj,$Ae=Xj,YAe=zj,qAe=Jj,KAe=Qj,WAe=Zj,XAe={OK:Vj,CANCELLED:Bj,UNKNOWN:Gj,INVALID_ARGUMENT:Hj,DEADLINE_EXCEEDED:kj,NOT_FOUND:Fj,ALREADY_EXISTS:jj,PERMISSION_DENIED:$j,RESOURCE_EXHAUSTED:Yj,FAILED_PRECONDITION:qj,ABORTED:Kj,OUT_OF_RANGE:Wj,UNIMPLEMENTED:Xj,INTERNAL:zj,UNAVAILABLE:Jj,DATA_LOSS:Qj,UNAUTHENTICATED:Zj},e$="SENT",t$="RECEIVED",zAe=e$,JAe=t$,QAe=Fe([e$,t$])});var r$=U(()=>{n$()});var 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,yY,vY,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,dOe,_Oe,EOe,fOe,tA,SOe,TOe,mOe,hOe,gOe,AOe,ROe,OOe,NOe,IOe,bY,LY,DY,xY,COe,POe,MOe,yOe,vOe,UY,wY,VY,BY,GY,HY,kY,FY,jY,$Y,YY,qY,KY,WY,XY,zY,JY,bOe,LOe,DOe,xOe,UOe,wOe,VOe,BOe,GOe,HOe,kOe,FOe,jOe,$Oe,YOe,qOe,KOe,WOe,QY,ZY,XOe,zOe,JOe,eq,tq,nq,rq,oq,sq,iq,QOe,ZOe,eNe,tNe,nNe,rNe,oNe,sNe,aq,cq,uq,lq,pq,dq,_q,Eq,fq,Sq,Tq,iNe,aNe,cNe,uNe,lNe,pNe,dNe,_Ne,ENe,fNe,SNe,TNe,mq,hq,gq,Aq,Rq,Oq,Nq,Iq,Cq,Pq,mNe,hNe,gNe,ANe,RNe,ONe,NNe,INe,CNe,PNe,MNe,Mq=U(()=>{Kg();o$="cloud.provider",s$="cloud.account.id",i$="cloud.region",a$="cloud.availability_zone",c$="cloud.platform",u$="aws.ecs.container.arn",l$="aws.ecs.cluster.arn",p$="aws.ecs.launchtype",d$="aws.ecs.task.arn",_$="aws.ecs.task.family",E$="aws.ecs.task.revision",f$="aws.eks.cluster.arn",S$="aws.log.group.names",T$="aws.log.group.arns",m$="aws.log.stream.names",h$="aws.log.stream.arns",g$="container.name",A$="container.id",R$="container.runtime",O$="container.image.name",N$="container.image.tag",I$="deployment.environment",C$="device.id",P$="device.model.identifier",M$="device.model.name",y$="faas.name",v$="faas.id",b$="faas.version",L$="faas.instance",D$="faas.max_memory",x$="host.id",U$="host.name",w$="host.type",V$="host.arch",B$="host.image.name",G$="host.image.id",H$="host.image.version",k$="k8s.cluster.name",F$="k8s.node.name",j$="k8s.node.uid",$$="k8s.namespace.name",Y$="k8s.pod.uid",q$="k8s.pod.name",K$="k8s.container.name",W$="k8s.replicaset.uid",X$="k8s.replicaset.name",z$="k8s.deployment.uid",J$="k8s.deployment.name",Q$="k8s.statefulset.uid",Z$="k8s.statefulset.name",eY="k8s.daemonset.uid",tY="k8s.daemonset.name",nY="k8s.job.uid",rY="k8s.job.name",oY="k8s.cronjob.uid",sY="k8s.cronjob.name",iY="os.type",aY="os.description",cY="os.name",uY="os.version",lY="process.pid",pY="process.executable.name",dY="process.executable.path",_Y="process.command",EY="process.command_line",fY="process.command_args",SY="process.owner",TY="process.runtime.name",mY="process.runtime.version",hY="process.runtime.description",gY="service.name",AY="service.namespace",RY="service.instance.id",OY="service.version",NY="telemetry.sdk.name",IY="telemetry.sdk.language",CY="telemetry.sdk.version",PY="telemetry.auto.version",MY="webengine.name",yY="webengine.version",vY="webengine.description",ZAe=o$,eRe=s$,tRe=i$,nRe=a$,rRe=c$,oRe=u$,sRe=l$,iRe=p$,aRe=d$,cRe=_$,uRe=E$,lRe=f$,pRe=S$,dRe=T$,_Re=m$,ERe=h$,fRe=g$,SRe=A$,TRe=R$,mRe=O$,hRe=N$,gRe=I$,ARe=C$,RRe=P$,ORe=M$,NRe=y$,IRe=v$,CRe=b$,PRe=L$,MRe=D$,yRe=x$,vRe=U$,bRe=w$,LRe=V$,DRe=B$,xRe=G$,URe=H$,wRe=k$,VRe=F$,BRe=j$,GRe=$$,HRe=Y$,kRe=q$,FRe=K$,jRe=W$,$Re=X$,YRe=z$,qRe=J$,KRe=Q$,WRe=Z$,XRe=eY,zRe=tY,JRe=nY,QRe=rY,ZRe=oY,eOe=sY,tOe=iY,nOe=aY,rOe=cY,oOe=uY,sOe=lY,iOe=pY,aOe=dY,cOe=_Y,uOe=EY,lOe=fY,pOe=SY,dOe=TY,_Oe=mY,EOe=hY,fOe=gY,tA=AY,SOe=RY,TOe=OY,mOe=NY,hOe=IY,gOe=CY,AOe=PY,ROe=MY,OOe=yY,NOe=vY,IOe=Fe([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,yY,vY]),bY="alibaba_cloud",LY="aws",DY="azure",xY="gcp",COe=bY,POe=LY,MOe=DY,yOe=xY,vOe=Fe([bY,LY,DY,xY]),UY="alibaba_cloud_ecs",wY="alibaba_cloud_fc",VY="aws_ec2",BY="aws_ecs",GY="aws_eks",HY="aws_lambda",kY="aws_elastic_beanstalk",FY="azure_vm",jY="azure_container_instances",$Y="azure_aks",YY="azure_functions",qY="azure_app_service",KY="gcp_compute_engine",WY="gcp_cloud_run",XY="gcp_kubernetes_engine",zY="gcp_cloud_functions",JY="gcp_app_engine",bOe=UY,LOe=wY,DOe=VY,xOe=BY,UOe=GY,wOe=HY,VOe=kY,BOe=FY,GOe=jY,HOe=$Y,kOe=YY,FOe=qY,jOe=KY,$Oe=WY,YOe=XY,qOe=zY,KOe=JY,WOe=Fe([UY,wY,VY,BY,GY,HY,kY,FY,jY,$Y,YY,qY,KY,WY,XY,zY,JY]),QY="ec2",ZY="fargate",XOe=QY,zOe=ZY,JOe=Fe([QY,ZY]),eq="amd64",tq="arm32",nq="arm64",rq="ia64",oq="ppc32",sq="ppc64",iq="x86",QOe=eq,ZOe=tq,eNe=nq,tNe=rq,nNe=oq,rNe=sq,oNe=iq,sNe=Fe([eq,tq,nq,rq,oq,sq,iq]),aq="windows",cq="linux",uq="darwin",lq="freebsd",pq="netbsd",dq="openbsd",_q="dragonflybsd",Eq="hpux",fq="aix",Sq="solaris",Tq="z_os",iNe=aq,aNe=cq,cNe=uq,uNe=lq,lNe=pq,pNe=dq,dNe=_q,_Ne=Eq,ENe=fq,fNe=Sq,SNe=Tq,TNe=Fe([aq,cq,uq,lq,pq,dq,_q,Eq,fq,Sq,Tq]),mq="cpp",hq="dotnet",gq="erlang",Aq="go",Rq="java",Oq="nodejs",Nq="php",Iq="python",Cq="ruby",Pq="webjs",mNe=mq,hNe=hq,gNe=gq,ANe=Aq,RNe=Rq,ONe=Oq,NNe=Nq,INe=Iq,CNe=Cq,PNe=Pq,MNe=Fe([mq,hq,gq,Aq,Rq,Oq,Nq,Iq,Cq,Pq])});var yq=U(()=>{Mq()});var 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,eIe,nA,tIe,rA,nIe,oA,sA,rIe,iA,oIe,sIe,iIe,aIe,cIe,uIe,lIe,pIe,XWe,zWe,aA,dIe,_Ie,EIe,fIe,SIe,TIe,ks,mIe,hIe,gIe,JWe,AIe,RIe,OIe,NIe,QWe,IIe,CIe,PIe,MIe,Bo,Ar,yIe,vIe,bIe,LIe,DIe,xIe,UIe,wIe,VIe,ZWe,BIe,GIe,HIe,kIe,FIe,jIe,$Ie,YIe,qIe,KIe,WIe,XIe,zIe,e2e,t2e,JIe,QIe,ZIe,eCe,tCe,nCe,rCe,oCe,n2e,sCe,cA,uA,iCe,dn,aCe,lA,cCe,uCe,lCe,pCe,dCe,_Ce,ECe,fCe,SCe,r2e,TCe,mCe,o2e,hCe,gCe,s2e,ACe,RCe,OCe,NCe,ICe,CCe,PCe,MCe,aa,yCe,vCe,bCe,LCe,vq=U(()=>{yNe="aspnetcore.diagnostics.exception.result",vNe="aborted",bNe="handled",LNe="skipped",DNe="unhandled",xNe="aspnetcore.diagnostics.handler.type",UNe="aspnetcore.rate_limiting.policy",wNe="aspnetcore.rate_limiting.result",VNe="acquired",BNe="endpoint_limiter",GNe="global_limiter",HNe="request_canceled",kNe="aspnetcore.request.is_unhandled",FNe="aspnetcore.routing.is_fallback",jNe="aspnetcore.routing.match_status",$Ne="failure",YNe="success",qNe="aspnetcore.user.is_authenticated",KNe="client.address",WNe="client.port",XNe="code.column.number",zNe="code.file.path",JNe="code.function.name",QNe="code.line.number",ZNe="code.stacktrace",eIe="db.collection.name",nA="db.namespace",tIe="db.operation.batch.size",rA="db.operation.name",nIe="db.query.summary",oA="db.query.text",sA="db.response.status_code",rIe="db.stored_procedure.name",iA="db.system.name",oIe="mariadb",sIe="microsoft.sql_server",iIe="mysql",aIe="postgresql",cIe="dotnet.gc.heap.generation",uIe="gen0",lIe="gen1",pIe="gen2",XWe="loh",zWe="poh",aA="error.type",dIe="_OTHER",_Ie="exception.escaped",EIe="exception.message",fIe="exception.stacktrace",SIe="exception.type",TIe=t=>`http.request.header.${t}`,ks="http.request.method",mIe="_OTHER",hIe="CONNECT",gIe="DELETE",JWe="GET",AIe="HEAD",RIe="OPTIONS",OIe="PATCH",NIe="POST",QWe="PUT",IIe="TRACE",CIe="http.request.method_original",PIe="http.request.resend_count",MIe=t=>`http.response.header.${t}`,Bo="http.response.status_code",Ar="http.route",yIe="jvm.gc.action",vIe="jvm.gc.name",bIe="jvm.memory.pool.name",LIe="jvm.memory.type",DIe="heap",xIe="non_heap",UIe="jvm.thread.daemon",wIe="jvm.thread.state",VIe="blocked",ZWe="new",BIe="runnable",GIe="terminated",HIe="timed_waiting",kIe="waiting",FIe="network.local.address",jIe="network.local.port",$Ie="network.peer.address",YIe="network.peer.port",qIe="network.protocol.name",KIe="network.protocol.version",WIe="network.transport",XIe="pipe",zIe="quic",e2e="tcp",t2e="udp",JIe="unix",QIe="network.type",ZIe="ipv4",eCe="ipv6",tCe="otel.scope.name",nCe="otel.scope.version",rCe="otel.status_code",oCe="ERROR",n2e="OK",sCe="otel.status_description",cA="server.address",uA="server.port",iCe="service.instance.id",dn="service.name",aCe="service.namespace",lA="service.version",cCe="signalr.connection.status",uCe="app_shutdown",lCe="normal_closure",pCe="timeout",dCe="signalr.transport",_Ce="long_polling",ECe="server_sent_events",fCe="web_sockets",SCe="telemetry.sdk.language",r2e="cpp",TCe="dotnet",mCe="erlang",o2e="go",hCe="java",gCe="nodejs",s2e="php",ACe="python",RCe="ruby",OCe="rust",NCe="swift",ICe="webjs",CCe="telemetry.sdk.name",PCe="telemetry.sdk.version",MCe="url.fragment",aa="url.full",yCe="url.path",vCe="url.query",bCe="url.scheme",LCe="user_agent.original"});var 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,CPe,PPe,MPe,yPe,bq=U(()=>{DCe="aspnetcore.diagnostics.exceptions",xCe="aspnetcore.rate_limiting.active_request_leases",UCe="aspnetcore.rate_limiting.queued_requests",wCe="aspnetcore.rate_limiting.request.time_in_queue",VCe="aspnetcore.rate_limiting.request_lease.duration",BCe="aspnetcore.rate_limiting.requests",GCe="aspnetcore.routing.match_attempts",HCe="db.client.operation.duration",kCe="dotnet.assembly.count",FCe="dotnet.exceptions",jCe="dotnet.gc.collections",$Ce="dotnet.gc.heap.total_allocated",YCe="dotnet.gc.last_collection.heap.fragmentation.size",qCe="dotnet.gc.last_collection.heap.size",KCe="dotnet.gc.last_collection.memory.committed_size",WCe="dotnet.gc.pause.time",XCe="dotnet.jit.compilation.time",zCe="dotnet.jit.compiled_il.size",JCe="dotnet.jit.compiled_methods",QCe="dotnet.monitor.lock_contentions",ZCe="dotnet.process.cpu.count",ePe="dotnet.process.cpu.time",tPe="dotnet.process.memory.working_set",nPe="dotnet.thread_pool.queue.length",rPe="dotnet.thread_pool.thread.count",oPe="dotnet.thread_pool.work_item.count",sPe="dotnet.timer.count",iPe="http.client.request.duration",aPe="http.server.request.duration",cPe="jvm.class.count",uPe="jvm.class.loaded",lPe="jvm.class.unloaded",pPe="jvm.cpu.count",dPe="jvm.cpu.recent_utilization",_Pe="jvm.cpu.time",EPe="jvm.gc.duration",fPe="jvm.memory.committed",SPe="jvm.memory.limit",TPe="jvm.memory.used",mPe="jvm.memory.used_after_last_gc",hPe="jvm.thread.count",gPe="kestrel.active_connections",APe="kestrel.active_tls_handshakes",RPe="kestrel.connection.duration",OPe="kestrel.queued_connections",NPe="kestrel.queued_requests",IPe="kestrel.rejected_connections",CPe="kestrel.tls_handshake.duration",PPe="kestrel.upgraded_connections",MPe="signalr.server.active_connections",yPe="signalr.server.connection.duration"});var vPe,Lq=U(()=>{vPe="exception"});var je={};mS(je,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>vNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>bNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>LNe,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>DNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>VNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>BNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>GNe,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>HNe,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>$Ne,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>YNe,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>yNe,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>xNe,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>UNe,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>wNe,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>kNe,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>FNe,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>jNe,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>qNe,ATTR_CLIENT_ADDRESS:()=>KNe,ATTR_CLIENT_PORT:()=>WNe,ATTR_CODE_COLUMN_NUMBER:()=>XNe,ATTR_CODE_FILE_PATH:()=>zNe,ATTR_CODE_FUNCTION_NAME:()=>JNe,ATTR_CODE_LINE_NUMBER:()=>QNe,ATTR_CODE_STACKTRACE:()=>ZNe,ATTR_DB_COLLECTION_NAME:()=>eIe,ATTR_DB_NAMESPACE:()=>nA,ATTR_DB_OPERATION_BATCH_SIZE:()=>tIe,ATTR_DB_OPERATION_NAME:()=>rA,ATTR_DB_QUERY_SUMMARY:()=>nIe,ATTR_DB_QUERY_TEXT:()=>oA,ATTR_DB_RESPONSE_STATUS_CODE:()=>sA,ATTR_DB_STORED_PROCEDURE_NAME:()=>rIe,ATTR_DB_SYSTEM_NAME:()=>iA,ATTR_DOTNET_GC_HEAP_GENERATION:()=>cIe,ATTR_ERROR_TYPE:()=>aA,ATTR_EXCEPTION_ESCAPED:()=>_Ie,ATTR_EXCEPTION_MESSAGE:()=>EIe,ATTR_EXCEPTION_STACKTRACE:()=>fIe,ATTR_EXCEPTION_TYPE:()=>SIe,ATTR_HTTP_REQUEST_HEADER:()=>TIe,ATTR_HTTP_REQUEST_METHOD:()=>ks,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>CIe,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>PIe,ATTR_HTTP_RESPONSE_HEADER:()=>MIe,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>Bo,ATTR_HTTP_ROUTE:()=>Ar,ATTR_JVM_GC_ACTION:()=>yIe,ATTR_JVM_GC_NAME:()=>vIe,ATTR_JVM_MEMORY_POOL_NAME:()=>bIe,ATTR_JVM_MEMORY_TYPE:()=>LIe,ATTR_JVM_THREAD_DAEMON:()=>UIe,ATTR_JVM_THREAD_STATE:()=>wIe,ATTR_NETWORK_LOCAL_ADDRESS:()=>FIe,ATTR_NETWORK_LOCAL_PORT:()=>jIe,ATTR_NETWORK_PEER_ADDRESS:()=>$Ie,ATTR_NETWORK_PEER_PORT:()=>YIe,ATTR_NETWORK_PROTOCOL_NAME:()=>qIe,ATTR_NETWORK_PROTOCOL_VERSION:()=>KIe,ATTR_NETWORK_TRANSPORT:()=>WIe,ATTR_NETWORK_TYPE:()=>QIe,ATTR_OTEL_SCOPE_NAME:()=>tCe,ATTR_OTEL_SCOPE_VERSION:()=>nCe,ATTR_OTEL_STATUS_CODE:()=>rCe,ATTR_OTEL_STATUS_DESCRIPTION:()=>sCe,ATTR_SERVER_ADDRESS:()=>cA,ATTR_SERVER_PORT:()=>uA,ATTR_SERVICE_INSTANCE_ID:()=>iCe,ATTR_SERVICE_NAME:()=>dn,ATTR_SERVICE_NAMESPACE:()=>aCe,ATTR_SERVICE_VERSION:()=>lA,ATTR_SIGNALR_CONNECTION_STATUS:()=>cCe,ATTR_SIGNALR_TRANSPORT:()=>dCe,ATTR_TELEMETRY_SDK_LANGUAGE:()=>SCe,ATTR_TELEMETRY_SDK_NAME:()=>CCe,ATTR_TELEMETRY_SDK_VERSION:()=>PCe,ATTR_URL_FRAGMENT:()=>MCe,ATTR_URL_FULL:()=>aa,ATTR_URL_PATH:()=>yCe,ATTR_URL_QUERY:()=>vCe,ATTR_URL_SCHEME:()=>bCe,ATTR_USER_AGENT_ORIGINAL:()=>LCe,AWSECSLAUNCHTYPEVALUES_EC2:()=>XOe,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>zOe,AwsEcsLaunchtypeValues:()=>JOe,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>bOe,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>LOe,CLOUDPLATFORMVALUES_AWS_EC2:()=>DOe,CLOUDPLATFORMVALUES_AWS_ECS:()=>xOe,CLOUDPLATFORMVALUES_AWS_EKS:()=>UOe,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>VOe,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>wOe,CLOUDPLATFORMVALUES_AZURE_AKS:()=>HOe,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>FOe,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>GOe,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>kOe,CLOUDPLATFORMVALUES_AZURE_VM:()=>BOe,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>KOe,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>qOe,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>$Oe,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>jOe,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>YOe,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>COe,CLOUDPROVIDERVALUES_AWS:()=>POe,CLOUDPROVIDERVALUES_AZURE:()=>MOe,CLOUDPROVIDERVALUES_GCP:()=>yOe,CloudPlatformValues:()=>WOe,CloudProviderValues:()=>vOe,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>pge,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>hge,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>dge,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>mge,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>Ege,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>Age,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>fge,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>_ge,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>gge,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>Tge,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>Sge,DBSYSTEMVALUES_ADABAS:()=>xhe,DBSYSTEMVALUES_CACHE:()=>Dhe,DBSYSTEMVALUES_CASSANDRA:()=>Jhe,DBSYSTEMVALUES_CLOUDSCAPE:()=>Ihe,DBSYSTEMVALUES_COCKROACHDB:()=>uge,DBSYSTEMVALUES_COLDFUSION:()=>zhe,DBSYSTEMVALUES_COSMOSDB:()=>rge,DBSYSTEMVALUES_COUCHBASE:()=>tge,DBSYSTEMVALUES_COUCHDB:()=>nge,DBSYSTEMVALUES_DB2:()=>Ahe,DBSYSTEMVALUES_DERBY:()=>whe,DBSYSTEMVALUES_DYNAMODB:()=>oge,DBSYSTEMVALUES_EDB:()=>Lhe,DBSYSTEMVALUES_ELASTICSEARCH:()=>age,DBSYSTEMVALUES_FILEMAKER:()=>Vhe,DBSYSTEMVALUES_FIREBIRD:()=>Uhe,DBSYSTEMVALUES_FIRSTSQL:()=>bhe,DBSYSTEMVALUES_GEODE:()=>ige,DBSYSTEMVALUES_H2:()=>Xhe,DBSYSTEMVALUES_HANADB:()=>yhe,DBSYSTEMVALUES_HBASE:()=>Qhe,DBSYSTEMVALUES_HIVE:()=>Nhe,DBSYSTEMVALUES_HSQLDB:()=>Che,DBSYSTEMVALUES_INFORMIX:()=>Bhe,DBSYSTEMVALUES_INGRES:()=>vhe,DBSYSTEMVALUES_INSTANTDB:()=>Ghe,DBSYSTEMVALUES_INTERBASE:()=>Hhe,DBSYSTEMVALUES_MARIADB:()=>khe,DBSYSTEMVALUES_MAXDB:()=>Mhe,DBSYSTEMVALUES_MEMCACHED:()=>cge,DBSYSTEMVALUES_MONGODB:()=>Zhe,DBSYSTEMVALUES_MSSQL:()=>mhe,DBSYSTEMVALUES_MYSQL:()=>hhe,DBSYSTEMVALUES_NEO4J:()=>sge,DBSYSTEMVALUES_NETEZZA:()=>Fhe,DBSYSTEMVALUES_ORACLE:()=>ghe,DBSYSTEMVALUES_OTHER_SQL:()=>The,DBSYSTEMVALUES_PERVASIVE:()=>jhe,DBSYSTEMVALUES_POINTBASE:()=>$he,DBSYSTEMVALUES_POSTGRESQL:()=>Rhe,DBSYSTEMVALUES_PROGRESS:()=>Phe,DBSYSTEMVALUES_REDIS:()=>ege,DBSYSTEMVALUES_REDSHIFT:()=>Ohe,DBSYSTEMVALUES_SQLITE:()=>Yhe,DBSYSTEMVALUES_SYBASE:()=>qhe,DBSYSTEMVALUES_TERADATA:()=>Khe,DBSYSTEMVALUES_VERTICA:()=>Whe,DB_SYSTEM_NAME_VALUE_MARIADB:()=>oIe,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>sIe,DB_SYSTEM_NAME_VALUE_MYSQL:()=>iIe,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>aIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>uIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>lIe,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>pIe,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>XWe,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>zWe,DbCassandraConsistencyLevelValues:()=>Rge,DbSystemValues:()=>lge,ERROR_TYPE_VALUE_OTHER:()=>dIe,EVENT_EXCEPTION:()=>vPe,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>bge,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>vge,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>yge,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>Dge,FAASINVOKEDPROVIDERVALUES_AWS:()=>xge,FAASINVOKEDPROVIDERVALUES_AZURE:()=>Uge,FAASINVOKEDPROVIDERVALUES_GCP:()=>wge,FAASTRIGGERVALUES_DATASOURCE:()=>Oge,FAASTRIGGERVALUES_HTTP:()=>Nge,FAASTRIGGERVALUES_OTHER:()=>Pge,FAASTRIGGERVALUES_PUBSUB:()=>Ige,FAASTRIGGERVALUES_TIMER:()=>Cge,FaasDocumentOperationValues:()=>Lge,FaasInvokedProviderValues:()=>Vge,FaasTriggerValues:()=>Mge,HOSTARCHVALUES_AMD64:()=>QOe,HOSTARCHVALUES_ARM32:()=>ZOe,HOSTARCHVALUES_ARM64:()=>eNe,HOSTARCHVALUES_IA64:()=>tNe,HOSTARCHVALUES_PPC32:()=>nNe,HOSTARCHVALUES_PPC64:()=>rNe,HOSTARCHVALUES_X86:()=>oNe,HTTPFLAVORVALUES_HTTP_1_0:()=>gAe,HTTPFLAVORVALUES_HTTP_1_1:()=>AAe,HTTPFLAVORVALUES_HTTP_2_0:()=>RAe,HTTPFLAVORVALUES_QUIC:()=>NAe,HTTPFLAVORVALUES_SPDY:()=>OAe,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>hIe,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>gIe,HTTP_REQUEST_METHOD_VALUE_GET:()=>JWe,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>AIe,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>RIe,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>mIe,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>OIe,HTTP_REQUEST_METHOD_VALUE_POST:()=>NIe,HTTP_REQUEST_METHOD_VALUE_PUT:()=>QWe,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>IIe,HostArchValues:()=>sNe,HttpFlavorValues:()=>IAe,JVM_MEMORY_TYPE_VALUE_HEAP:()=>DIe,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>xIe,JVM_THREAD_STATE_VALUE_BLOCKED:()=>VIe,JVM_THREAD_STATE_VALUE_NEW:()=>ZWe,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>BIe,JVM_THREAD_STATE_VALUE_TERMINATED:()=>GIe,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>HIe,JVM_THREAD_STATE_VALUE_WAITING:()=>kIe,MESSAGETYPEVALUES_RECEIVED:()=>JAe,MESSAGETYPEVALUES_SENT:()=>zAe,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>CAe,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>PAe,MESSAGINGOPERATIONVALUES_PROCESS:()=>vAe,MESSAGINGOPERATIONVALUES_RECEIVE:()=>yAe,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>DCe,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>xCe,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>UCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>BCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>VCe,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>wCe,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>GCe,METRIC_DB_CLIENT_OPERATION_DURATION:()=>HCe,METRIC_DOTNET_ASSEMBLY_COUNT:()=>kCe,METRIC_DOTNET_EXCEPTIONS:()=>FCe,METRIC_DOTNET_GC_COLLECTIONS:()=>jCe,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>$Ce,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>YCe,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>qCe,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>KCe,METRIC_DOTNET_GC_PAUSE_TIME:()=>WCe,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>XCe,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>zCe,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>JCe,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>QCe,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>ZCe,METRIC_DOTNET_PROCESS_CPU_TIME:()=>ePe,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>tPe,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>nPe,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>rPe,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>oPe,METRIC_DOTNET_TIMER_COUNT:()=>sPe,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>iPe,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>aPe,METRIC_JVM_CLASS_COUNT:()=>cPe,METRIC_JVM_CLASS_LOADED:()=>uPe,METRIC_JVM_CLASS_UNLOADED:()=>lPe,METRIC_JVM_CPU_COUNT:()=>pPe,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>dPe,METRIC_JVM_CPU_TIME:()=>_Pe,METRIC_JVM_GC_DURATION:()=>EPe,METRIC_JVM_MEMORY_COMMITTED:()=>fPe,METRIC_JVM_MEMORY_LIMIT:()=>SPe,METRIC_JVM_MEMORY_USED:()=>TPe,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>mPe,METRIC_JVM_THREAD_COUNT:()=>hPe,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>gPe,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>APe,METRIC_KESTREL_CONNECTION_DURATION:()=>RPe,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>OPe,METRIC_KESTREL_QUEUED_REQUESTS:()=>NPe,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>IPe,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>CPe,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>PPe,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>MPe,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>yPe,MessageTypeValues:()=>QAe,MessagingDestinationKindValues:()=>MAe,MessagingOperationValues:()=>bAe,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>tAe,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>oAe,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>Zge,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>pAe,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>nAe,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>rAe,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>uAe,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>Qge,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>_Ae,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>sAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>aAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>dAe,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>iAe,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>cAe,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>fAe,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>lAe,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>mAe,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>SAe,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>TAe,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>EAe,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>eAe,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>Wge,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>Xge,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>zge,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>qge,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>Kge,NETTRANSPORTVALUES_INPROC:()=>jge,NETTRANSPORTVALUES_IP:()=>Hge,NETTRANSPORTVALUES_IP_TCP:()=>Bge,NETTRANSPORTVALUES_IP_UDP:()=>Gge,NETTRANSPORTVALUES_OTHER:()=>$ge,NETTRANSPORTVALUES_PIPE:()=>Fge,NETTRANSPORTVALUES_UNIX:()=>kge,NETWORK_TRANSPORT_VALUE_PIPE:()=>XIe,NETWORK_TRANSPORT_VALUE_QUIC:()=>zIe,NETWORK_TRANSPORT_VALUE_TCP:()=>e2e,NETWORK_TRANSPORT_VALUE_UDP:()=>t2e,NETWORK_TRANSPORT_VALUE_UNIX:()=>JIe,NETWORK_TYPE_VALUE_IPV4:()=>ZIe,NETWORK_TYPE_VALUE_IPV6:()=>eCe,NetHostConnectionSubtypeValues:()=>hAe,NetHostConnectionTypeValues:()=>Jge,NetTransportValues:()=>Yge,OSTYPEVALUES_AIX:()=>ENe,OSTYPEVALUES_DARWIN:()=>cNe,OSTYPEVALUES_DRAGONFLYBSD:()=>dNe,OSTYPEVALUES_FREEBSD:()=>uNe,OSTYPEVALUES_HPUX:()=>_Ne,OSTYPEVALUES_LINUX:()=>aNe,OSTYPEVALUES_NETBSD:()=>lNe,OSTYPEVALUES_OPENBSD:()=>pNe,OSTYPEVALUES_SOLARIS:()=>fNe,OSTYPEVALUES_WINDOWS:()=>iNe,OSTYPEVALUES_Z_OS:()=>SNe,OTEL_STATUS_CODE_VALUE_ERROR:()=>oCe,OTEL_STATUS_CODE_VALUE_OK:()=>n2e,OsTypeValues:()=>TNe,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>FAe,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>BAe,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>DAe,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>KAe,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>wAe,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>kAe,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>YAe,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>UAe,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>VAe,RPCGRPCSTATUSCODEVALUES_OK:()=>LAe,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>jAe,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>GAe,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>HAe,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>WAe,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>qAe,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>$Ae,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>xAe,RpcGrpcStatusCodeValues:()=>XAe,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>Mme,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>Hme,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>Ime,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>Ame,SEMATTRS_AWS_DYNAMODB_COUNT:()=>Bme,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>Dme,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>bme,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>kme,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>yme,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>Rme,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>Pme,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>Lme,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>Cme,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>Ome,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>Nme,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>Gme,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>Ume,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>wme,SEMATTRS_AWS_DYNAMODB_SELECT:()=>vme,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>xme,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>gme,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>Vme,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>aTe,SEMATTRS_CODE_FILEPATH:()=>cme,SEMATTRS_CODE_FUNCTION:()=>ime,SEMATTRS_CODE_LINENO:()=>ume,SEMATTRS_CODE_NAMESPACE:()=>ame,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>STe,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>ATe,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>gTe,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>mTe,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>ETe,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>fTe,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>hTe,SEMATTRS_DB_CASSANDRA_TABLE:()=>TTe,SEMATTRS_DB_CONNECTION_STRING:()=>cTe,SEMATTRS_DB_HBASE_NAMESPACE:()=>RTe,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>lTe,SEMATTRS_DB_MONGODB_COLLECTION:()=>NTe,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>_Te,SEMATTRS_DB_NAME:()=>pTe,SEMATTRS_DB_OPERATION:()=>dTe,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>OTe,SEMATTRS_DB_SQL_TABLE:()=>ITe,SEMATTRS_DB_STATEMENT:()=>Xg,SEMATTRS_DB_SYSTEM:()=>Wg,SEMATTRS_DB_USER:()=>uTe,SEMATTRS_ENDUSER_ID:()=>tme,SEMATTRS_ENDUSER_ROLE:()=>nme,SEMATTRS_ENDUSER_SCOPE:()=>rme,SEMATTRS_EXCEPTION_ESCAPED:()=>yTe,SEMATTRS_EXCEPTION_MESSAGE:()=>PTe,SEMATTRS_EXCEPTION_STACKTRACE:()=>MTe,SEMATTRS_EXCEPTION_TYPE:()=>CTe,SEMATTRS_FAAS_COLDSTART:()=>VTe,SEMATTRS_FAAS_CRON:()=>wTe,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>bTe,SEMATTRS_FAAS_DOCUMENT_NAME:()=>xTe,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>LTe,SEMATTRS_FAAS_DOCUMENT_TIME:()=>DTe,SEMATTRS_FAAS_EXECUTION:()=>vTe,SEMATTRS_FAAS_INVOKED_NAME:()=>BTe,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>GTe,SEMATTRS_FAAS_INVOKED_REGION:()=>HTe,SEMATTRS_FAAS_TIME:()=>UTe,SEMATTRS_FAAS_TRIGGER:()=>zg,SEMATTRS_HTTP_CLIENT_IP:()=>hme,SEMATTRS_HTTP_FLAVOR:()=>dme,SEMATTRS_HTTP_HOST:()=>lme,SEMATTRS_HTTP_METHOD:()=>Iu,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>Eme,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>fme,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>Sme,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>Tme,SEMATTRS_HTTP_ROUTE:()=>Cu,SEMATTRS_HTTP_SCHEME:()=>pme,SEMATTRS_HTTP_SERVER_NAME:()=>mme,SEMATTRS_HTTP_STATUS_CODE:()=>Y_,SEMATTRS_HTTP_TARGET:()=>Jg,SEMATTRS_HTTP_URL:()=>ia,SEMATTRS_HTTP_USER_AGENT:()=>_me,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>Ehe,SEMATTRS_MESSAGE_ID:()=>_he,SEMATTRS_MESSAGE_TYPE:()=>dhe,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>fhe,SEMATTRS_MESSAGING_CONSUMER_ID:()=>Zme,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>Xme,SEMATTRS_MESSAGING_DESTINATION:()=>Fme,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>jme,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>rhe,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>nhe,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>the,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>ohe,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>she,SEMATTRS_MESSAGING_MESSAGE_ID:()=>Wme,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>Jme,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>zme,SEMATTRS_MESSAGING_OPERATION:()=>Qme,SEMATTRS_MESSAGING_PROTOCOL:()=>Yme,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>qme,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>ehe,SEMATTRS_MESSAGING_SYSTEM:()=>Qg,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>$me,SEMATTRS_MESSAGING_URL:()=>Kme,SEMATTRS_NET_HOST_CARRIER_ICC:()=>ZTe,SEMATTRS_NET_HOST_CARRIER_MCC:()=>JTe,SEMATTRS_NET_HOST_CARRIER_MNC:()=>QTe,SEMATTRS_NET_HOST_CARRIER_NAME:()=>zTe,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>XTe,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>WTe,SEMATTRS_NET_HOST_IP:()=>YTe,SEMATTRS_NET_HOST_NAME:()=>KTe,SEMATTRS_NET_HOST_PORT:()=>qTe,SEMATTRS_NET_PEER_IP:()=>FTe,SEMATTRS_NET_PEER_NAME:()=>$Te,SEMATTRS_NET_PEER_PORT:()=>jTe,SEMATTRS_NET_TRANSPORT:()=>kTe,SEMATTRS_PEER_SERVICE:()=>eme,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>eA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>lhe,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>phe,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>uhe,SEMATTRS_RPC_JSONRPC_VERSION:()=>che,SEMATTRS_RPC_METHOD:()=>ahe,SEMATTRS_RPC_SERVICE:()=>Zg,SEMATTRS_RPC_SYSTEM:()=>ihe,SEMATTRS_THREAD_ID:()=>ome,SEMATTRS_THREAD_NAME:()=>sme,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>sRe,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>oRe,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>iRe,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>aRe,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>cRe,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>uRe,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>lRe,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>dRe,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>pRe,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>ERe,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>_Re,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>eRe,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>nRe,SEMRESATTRS_CLOUD_PLATFORM:()=>rRe,SEMRESATTRS_CLOUD_PROVIDER:()=>ZAe,SEMRESATTRS_CLOUD_REGION:()=>tRe,SEMRESATTRS_CONTAINER_ID:()=>SRe,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>mRe,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>hRe,SEMRESATTRS_CONTAINER_NAME:()=>fRe,SEMRESATTRS_CONTAINER_RUNTIME:()=>TRe,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>gRe,SEMRESATTRS_DEVICE_ID:()=>ARe,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>RRe,SEMRESATTRS_DEVICE_MODEL_NAME:()=>ORe,SEMRESATTRS_FAAS_ID:()=>IRe,SEMRESATTRS_FAAS_INSTANCE:()=>PRe,SEMRESATTRS_FAAS_MAX_MEMORY:()=>MRe,SEMRESATTRS_FAAS_NAME:()=>NRe,SEMRESATTRS_FAAS_VERSION:()=>CRe,SEMRESATTRS_HOST_ARCH:()=>LRe,SEMRESATTRS_HOST_ID:()=>yRe,SEMRESATTRS_HOST_IMAGE_ID:()=>xRe,SEMRESATTRS_HOST_IMAGE_NAME:()=>DRe,SEMRESATTRS_HOST_IMAGE_VERSION:()=>URe,SEMRESATTRS_HOST_NAME:()=>vRe,SEMRESATTRS_HOST_TYPE:()=>bRe,SEMRESATTRS_K8S_CLUSTER_NAME:()=>wRe,SEMRESATTRS_K8S_CONTAINER_NAME:()=>FRe,SEMRESATTRS_K8S_CRONJOB_NAME:()=>eOe,SEMRESATTRS_K8S_CRONJOB_UID:()=>ZRe,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>zRe,SEMRESATTRS_K8S_DAEMONSET_UID:()=>XRe,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>qRe,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>YRe,SEMRESATTRS_K8S_JOB_NAME:()=>QRe,SEMRESATTRS_K8S_JOB_UID:()=>JRe,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>GRe,SEMRESATTRS_K8S_NODE_NAME:()=>VRe,SEMRESATTRS_K8S_NODE_UID:()=>BRe,SEMRESATTRS_K8S_POD_NAME:()=>kRe,SEMRESATTRS_K8S_POD_UID:()=>HRe,SEMRESATTRS_K8S_REPLICASET_NAME:()=>$Re,SEMRESATTRS_K8S_REPLICASET_UID:()=>jRe,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>WRe,SEMRESATTRS_K8S_STATEFULSET_UID:()=>KRe,SEMRESATTRS_OS_DESCRIPTION:()=>nOe,SEMRESATTRS_OS_NAME:()=>rOe,SEMRESATTRS_OS_TYPE:()=>tOe,SEMRESATTRS_OS_VERSION:()=>oOe,SEMRESATTRS_PROCESS_COMMAND:()=>cOe,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>lOe,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>uOe,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>iOe,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>aOe,SEMRESATTRS_PROCESS_OWNER:()=>pOe,SEMRESATTRS_PROCESS_PID:()=>sOe,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>EOe,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>dOe,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>_Oe,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>SOe,SEMRESATTRS_SERVICE_NAME:()=>fOe,SEMRESATTRS_SERVICE_NAMESPACE:()=>tA,SEMRESATTRS_SERVICE_VERSION:()=>TOe,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>AOe,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>hOe,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>mOe,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>gOe,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>NOe,SEMRESATTRS_WEBENGINE_NAME:()=>ROe,SEMRESATTRS_WEBENGINE_VERSION:()=>OOe,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>uCe,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>lCe,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>pCe,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>_Ce,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>ECe,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>fCe,SemanticAttributes:()=>She,SemanticResourceAttributes:()=>IOe,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>mNe,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>hNe,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>gNe,TELEMETRYSDKLANGUAGEVALUES_GO:()=>ANe,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>RNe,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>ONe,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>NNe,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>INe,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>CNe,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>PNe,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>r2e,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>TCe,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>mCe,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>o2e,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>hCe,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>gCe,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>s2e,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>ACe,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>RCe,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>OCe,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>NCe,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>ICe,TelemetrySdkLanguageValues:()=>MNe});var de=U(()=>{r$();yq();vq();bq();Lq()});var Dq=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(),C(x)),It=oe(),Fs=(hn(),C(mn)),bPe=Dq(),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(bPe.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 LPe;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(LPe=Pu.SamplingDecision||(Pu.SamplingDecision={}))});var X_=f(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.AlwaysOffSampler=void 0;var DPe=Mu(),_A=class{shouldSample(){return{decision:DPe.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 xPe=Mu(),EA=class{shouldSample(){return{decision:xPe.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(),C(x)),UPe=oe(),xq=X_(),fA=J_(),SA=class{constructor(e){var n,r,o,s;this._root=e.root,this._root||((0,UPe.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 xq.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 xq.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 wPe=(y(),C(x)),Uq=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,wPe.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?Uq.SamplingDecision.RECORD_AND_SAMPLED:Uq.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(),C(x)),qr=oe(),wq=X_(),gA=J_(),AA=TA(),Vq=hA(),VPe=qr.TracesSamplerValues.AlwaysOn,ca=1;function BPe(){let t=(0,qr.getEnv)();return{sampler:Gq(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=BPe;function Gq(t=(0,qr.getEnv)()){switch(t.OTEL_TRACES_SAMPLER){case qr.TracesSamplerValues.AlwaysOn:return new gA.AlwaysOnSampler;case qr.TracesSamplerValues.AlwaysOff:return new wq.AlwaysOffSampler;case qr.TracesSamplerValues.ParentBasedAlwaysOn:return new AA.ParentBasedSampler({root:new gA.AlwaysOnSampler});case qr.TracesSamplerValues.ParentBasedAlwaysOff:return new AA.ParentBasedSampler({root:new wq.AlwaysOffSampler});case qr.TracesSamplerValues.TraceIdRatio:return new Vq.TraceIdRatioBasedSampler(Bq(t));case qr.TracesSamplerValues.ParentBasedTraceIdRatio:return new AA.ParentBasedSampler({root:new Vq.TraceIdRatioBasedSampler(Bq(t))});default:return tE.diag.error(`OTEL_TRACES_SAMPLER value "${t.OTEL_TRACES_SAMPLER} invalid, defaulting to ${VPe}".`),new gA.AlwaysOnSampler}}ua.buildSamplerFromEnv=Gq;function Bq(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 Hq=RA(),OA=oe();function GPe(t){let e={sampler:(0,Hq.buildSamplerFromEnv)()},n=(0,Hq.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=GPe;function HPe(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=HPe});var kq=f(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.BatchSpanProcessorBase=void 0;var pa=(y(),C(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 Fq=f(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.BatchSpanProcessor=void 0;var kPe=kq(),CA=class extends kPe.BatchSpanProcessorBase{onShutdown(){}};rE.BatchSpanProcessor=CA});var Yq=f(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.RandomIdGenerator=void 0;var FPe=8,$q=16,PA=class{constructor(){this.generateTraceId=jq($q),this.generateSpanId=jq(FPe)}};sE.RandomIdGenerator=PA;var oE=Buffer.allocUnsafe($q);function jq(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 qq=f(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.RandomIdGenerator=da.BatchSpanProcessor=void 0;var jPe=Fq();Object.defineProperty(da,"BatchSpanProcessor",{enumerable:!0,get:function(){return jPe.BatchSpanProcessor}});var $Pe=Yq();Object.defineProperty(da,"RandomIdGenerator",{enumerable:!0,get:function(){return $Pe.RandomIdGenerator}})});var iE=f(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.RandomIdGenerator=_a.BatchSpanProcessor=void 0;var Kq=qq();Object.defineProperty(_a,"BatchSpanProcessor",{enumerable:!0,get:function(){return Kq.BatchSpanProcessor}});Object.defineProperty(_a,"RandomIdGenerator",{enumerable:!0,get:function(){return Kq.RandomIdGenerator}})});var yA=f(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.Tracer=void 0;var _t=(y(),C(x)),aE=oe(),YPe=dA(),qPe=NA(),KPe=iE(),MA=class{constructor(e,n,r){this._tracerProvider=r;let o=(0,qPe.mergeConfig)(n);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=n.idGenerator||new KPe.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 YPe.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 Wq=f(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.defaultServiceName=void 0;function WPe(){return`unknown_service:${process.argv0}`}uE.defaultServiceName=WPe});var Xq=f(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.defaultServiceName=void 0;var XPe=Wq();Object.defineProperty(lE,"defaultServiceName",{enumerable:!0,get:function(){return XPe.defaultServiceName}})});var vA=f(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.defaultServiceName=void 0;var zPe=Xq();Object.defineProperty(pE,"defaultServiceName",{enumerable:!0,get:function(){return zPe.defaultServiceName}})});var Kr=f(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0});dE.Resource=void 0;var zq=(y(),C(x)),$s=(hn(),C(mn)),bA=oe(),JPe=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=>(zq.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,JPe.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&&zq.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 QPe=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Ea.normalizeArch=QPe;var ZPe=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Ea.normalizeType=ZPe});var EE=f(_E=>{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.execAsync=void 0;var eMe=require("child_process"),tMe=require("util");_E.execAsync=tMe.promisify(eMe.exec)});var Jq=f(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.getMachineId=void 0;var nMe=EE(),rMe=(y(),C(x));async function oMe(){try{let e=(await(0,nMe.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){rMe.diag.debug(`error reading machine id: ${t}`)}return""}fE.getMachineId=oMe});var Qq=f(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.getMachineId=void 0;var sMe=require("fs"),iMe=(y(),C(x));async function aMe(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await sMe.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){iMe.diag.debug(`error reading machine id: ${n}`)}return""}SE.getMachineId=aMe});var eK=f(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.getMachineId=void 0;var cMe=require("fs"),uMe=EE(),Zq=(y(),C(x));async function lMe(){try{return(await cMe.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){Zq.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,uMe.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){Zq.diag.debug(`error reading machine id: ${t}`)}return""}TE.getMachineId=lMe});var nK=f(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.getMachineId=void 0;var tK=require("process"),pMe=EE(),dMe=(y(),C(x));async function _Me(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";tK.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in tK.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,pMe.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){dMe.diag.debug(`error reading machine id: ${n}`)}return""}mE.getMachineId=_Me});var rK=f(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.getMachineId=void 0;var EMe=(y(),C(x));async function fMe(){return EMe.diag.debug("could not read machine-id: unsupported platform"),""}hE.getMachineId=fMe});var oK=f(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.getMachineId=void 0;var SMe=require("process"),fa;Wr.getMachineId=fa;switch(SMe.platform){case"darwin":Wr.getMachineId=fa=Jq().getMachineId;break;case"linux":Wr.getMachineId=fa=Qq().getMachineId;break;case"freebsd":Wr.getMachineId=fa=eK().getMachineId;break;case"win32":Wr.getMachineId=fa=nK().getMachineId;break;default:Wr.getMachineId=fa=rK().getMachineId}});var UA=f(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.hostDetectorSync=void 0;var DA=(hn(),C(mn)),TMe=Kr(),sK=require("os"),mMe=LA(),hMe=oK(),xA=class{detect(e){let n={[DA.SEMRESATTRS_HOST_NAME]:(0,sK.hostname)(),[DA.SEMRESATTRS_HOST_ARCH]:(0,mMe.normalizeArch)((0,sK.arch)())};return new TMe.Resource(n,this._getAsyncAttributes())}_getAsyncAttributes(){return(0,hMe.getMachineId)().then(e=>{let n={};return e&&(n[DA.SEMRESATTRS_HOST_ID]=e),n})}};gE.hostDetectorSync=new xA});var iK=f(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.hostDetector=void 0;var gMe=UA(),wA=class{detect(e){return Promise.resolve(gMe.hostDetectorSync.detect(e))}};AE.hostDetector=new wA});var BA=f(RE=>{"use strict";Object.defineProperty(RE,"__esModule",{value:!0});RE.osDetectorSync=void 0;var aK=(hn(),C(mn)),AMe=Kr(),cK=require("os"),RMe=LA(),VA=class{detect(e){let n={[aK.SEMRESATTRS_OS_TYPE]:(0,RMe.normalizeType)((0,cK.platform)()),[aK.SEMRESATTRS_OS_VERSION]:(0,cK.release)()};return new AMe.Resource(n)}};RE.osDetectorSync=new VA});var uK=f(OE=>{"use strict";Object.defineProperty(OE,"__esModule",{value:!0});OE.osDetector=void 0;var OMe=BA(),GA=class{detect(e){return Promise.resolve(OMe.osDetectorSync.detect(e))}};OE.osDetector=new GA});var kA=f(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.processDetectorSync=void 0;var NMe=(y(),C(x)),Xr=(hn(),C(mn)),IMe=Kr(),CMe=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=CMe.userInfo();n[Xr.SEMRESATTRS_PROCESS_OWNER]=r.username}catch(r){NMe.diag.debug(`error obtaining process owner: ${r}`)}return new IMe.Resource(n)}};NE.processDetectorSync=new HA});var lK=f(IE=>{"use strict";Object.defineProperty(IE,"__esModule",{value:!0});IE.processDetector=void 0;var PMe=kA(),FA=class{detect(e){return Promise.resolve(PMe.processDetectorSync.detect(e))}};IE.processDetector=new FA});var pK=f(CE=>{"use strict";Object.defineProperty(CE,"__esModule",{value:!0});CE.serviceInstanceIdDetectorSync=void 0;var MMe=(hn(),C(mn)),yMe=Kr(),vMe=require("crypto"),jA=class{detect(e){let n={[MMe.SEMRESATTRS_SERVICE_INSTANCE_ID]:(0,vMe.randomUUID)()};return new yMe.Resource(n)}};CE.serviceInstanceIdDetectorSync=new jA});var dK=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 bMe=iK();Object.defineProperty(Ct,"hostDetector",{enumerable:!0,get:function(){return bMe.hostDetector}});var LMe=UA();Object.defineProperty(Ct,"hostDetectorSync",{enumerable:!0,get:function(){return LMe.hostDetectorSync}});var DMe=uK();Object.defineProperty(Ct,"osDetector",{enumerable:!0,get:function(){return DMe.osDetector}});var xMe=BA();Object.defineProperty(Ct,"osDetectorSync",{enumerable:!0,get:function(){return xMe.osDetectorSync}});var UMe=lK();Object.defineProperty(Ct,"processDetector",{enumerable:!0,get:function(){return UMe.processDetector}});var wMe=kA();Object.defineProperty(Ct,"processDetectorSync",{enumerable:!0,get:function(){return wMe.processDetectorSync}});var VMe=pK();Object.defineProperty(Ct,"serviceInstanceIdDetectorSync",{enumerable:!0,get:function(){return VMe.serviceInstanceIdDetectorSync}})});var _K=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=dK();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(),C(mn)),BMe=(y(),C(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]===""?(BMe.diag.debug("BrowserDetector failed: Unable to find required browser resources. "),$A.Resource.empty()):new $A.Resource(Object.assign({},e))}};ME.browserDetectorSync=new YA});var EK=f(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.browserDetector=void 0;var GMe=qA(),KA=class{detect(e){return Promise.resolve(GMe.browserDetectorSync.detect(e))}};yE.browserDetector=new KA});var XA=f(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE.envDetectorSync=void 0;var HMe=(y(),C(x)),kMe=oe(),FMe=(hn(),C(mn)),jMe=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,kMe.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){HMe.diag.debug(`EnvDetector failed: ${i.message}`)}return s&&(n[FMe.SEMRESATTRS_SERVICE_NAME]=s),new jMe.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 fK=f(bE=>{"use strict";Object.defineProperty(bE,"__esModule",{value:!0});bE.envDetector=void 0;var $Me=XA(),zA=class{detect(e){return Promise.resolve($Me.envDetectorSync.detect(e))}};bE.envDetector=new zA});var SK=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=_K();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 YMe=EK();Object.defineProperty(Ae,"browserDetector",{enumerable:!0,get:function(){return YMe.browserDetector}});var qMe=fK();Object.defineProperty(Ae,"envDetector",{enumerable:!0,get:function(){return qMe.envDetector}});var KMe=qA();Object.defineProperty(Ae,"browserDetectorSync",{enumerable:!0,get:function(){return KMe.browserDetectorSync}});var WMe=XA();Object.defineProperty(Ae,"envDetectorSync",{enumerable:!0,get:function(){return WMe.envDetectorSync}})});var TK=f(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.isPromiseLike=void 0;var XMe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";LE.isPromiseLike=XMe});var hK=f(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.detectResourcesSync=Ta.detectResources=void 0;var vu=Kr(),Sa=(y(),C(x)),zMe=TK(),JMe=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 mK(e),e.reduce((n,r)=>n.merge(r),vu.Resource.empty())};Ta.detectResources=JMe;var QMe=(t={})=>{var e;let n=((e=t.detectors)!==null&&e!==void 0?e:[]).map(o=>{try{let s=o.detect(t),i;if((0,zMe.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(()=>{mK(n)}),r};Ta.detectResourcesSync=QMe;var mK=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 ZMe=Kr();Object.defineProperty(se,"Resource",{enumerable:!0,get:function(){return ZMe.Resource}});var eye=vA();Object.defineProperty(se,"defaultServiceName",{enumerable:!0,get:function(){return eye.defaultServiceName}});var Jn=SK();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 gK=hK();Object.defineProperty(se,"detectResourcesSync",{enumerable:!0,get:function(){return gK.detectResourcesSync}});Object.defineProperty(se,"detectResources",{enumerable:!0,get:function(){return gK.detectResources}})});var AK=f(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.MultiSpanProcessor=void 0;var tye=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,tye.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 NK=f(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.BasicTracerProvider=Ks.ForceFlushState=void 0;var ma=(y(),C(x)),ga=oe(),RK=JA(),nye=yA(),rye=RA(),OK=AK(),oye=eR(),sye=iE(),iye=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,rye.loadDefaultConfig)(),(0,iye.reconfigureLimits)(e));if(this.resource=(n=o.resource)!==null&&n!==void 0?n:RK.Resource.empty(),o.mergeResourceWithDefaults&&(this.resource=RK.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 OK.MultiSpanProcessor(this._registeredSpanProcessors);else{let s=this._buildExporterFromEnv();if(s!==void 0){let i=new sye.BatchSpanProcessor(s);this.activeSpanProcessor=i}else this.activeSpanProcessor=new oye.NoopSpanProcessor}}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new nye.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 OK.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 IK=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 PK=f(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.InMemorySpanExporter=void 0;var CK=oe(),rR=class{constructor(){this._finishedSpans=[],this._stopped=!1}export(e,n){if(this._stopped)return n({code:CK.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:CK.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 MK=f(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.SimpleSpanProcessor=void 0;var aye=(y(),C(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&aye.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 cye=yA();Object.defineProperty(ie,"Tracer",{enumerable:!0,get:function(){return cye.Tracer}});var yK=NK();Object.defineProperty(ie,"BasicTracerProvider",{enumerable:!0,get:function(){return yK.BasicTracerProvider}});Object.defineProperty(ie,"ForceFlushState",{enumerable:!0,get:function(){return yK.ForceFlushState}});var vK=iE();Object.defineProperty(ie,"BatchSpanProcessor",{enumerable:!0,get:function(){return vK.BatchSpanProcessor}});Object.defineProperty(ie,"RandomIdGenerator",{enumerable:!0,get:function(){return vK.RandomIdGenerator}});var uye=IK();Object.defineProperty(ie,"ConsoleSpanExporter",{enumerable:!0,get:function(){return uye.ConsoleSpanExporter}});var lye=PK();Object.defineProperty(ie,"InMemorySpanExporter",{enumerable:!0,get:function(){return lye.InMemorySpanExporter}});var pye=MK();Object.defineProperty(ie,"SimpleSpanProcessor",{enumerable:!0,get:function(){return pye.SimpleSpanProcessor}});var dye=eR();Object.defineProperty(ie,"NoopSpanProcessor",{enumerable:!0,get:function(){return dye.NoopSpanProcessor}});var _ye=X_();Object.defineProperty(ie,"AlwaysOffSampler",{enumerable:!0,get:function(){return _ye.AlwaysOffSampler}});var Eye=J_();Object.defineProperty(ie,"AlwaysOnSampler",{enumerable:!0,get:function(){return Eye.AlwaysOnSampler}});var fye=TA();Object.defineProperty(ie,"ParentBasedSampler",{enumerable:!0,get:function(){return fye.ParentBasedSampler}});var Sye=hA();Object.defineProperty(ie,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return Sye.TraceIdRatioBasedSampler}});var Tye=Mu();Object.defineProperty(ie,"SamplingDecision",{enumerable:!0,get:function(){return Tye.SamplingDecision}});var mye=dA();Object.defineProperty(ie,"Span",{enumerable:!0,get:function(){return mye.Span}})});var DR=f(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.AbstractAsyncHooksContextManager=void 0;var Ebe=require("events"),fbe=["addListener","on","once","prependListener","prependOnceListener"],LR=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,n){return n instanceof Ebe.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),fbe.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 $W=f(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});WE.AsyncHooksContextManager=void 0;var Sbe=(y(),C(x)),Tbe=require("async_hooks"),mbe=DR(),xR=class extends mbe.AbstractAsyncHooksContextManager{constructor(){super(),this._contexts=new Map,this._stack=[],this._asyncHook=Tbe.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:Sbe.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 YW=f(XE=>{"use strict";Object.defineProperty(XE,"__esModule",{value:!0});XE.AsyncLocalStorageContextManager=void 0;var hbe=(y(),C(x)),gbe=require("async_hooks"),Abe=DR(),UR=class extends Abe.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new gbe.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:hbe.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 qW=f(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.AsyncLocalStorageContextManager=ya.AsyncHooksContextManager=void 0;var Rbe=$W();Object.defineProperty(ya,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Rbe.AsyncHooksContextManager}});var Obe=YW();Object.defineProperty(ya,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return Obe.AsyncLocalStorageContextManager}})});var d2=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 _2=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 f2=f(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.UndiciInstrumentation=void 0;var $u=require("diagnostics_channel"),Kbe=require("url"),Yu=te(),_n=(y(),C(x)),E2=d2(),Ze=_2(),of=oe(),jR=class extends Yu.InstrumentationBase{constructor(e={}){super(E2.PACKAGE_NAME,E2.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 Kbe.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 T2=f(S2=>{"use strict";Object.defineProperty(S2,"__esModule",{value:!0})});var h2=f(Ho=>{"use strict";var Wbe=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]})),m2=Ho&&Ho.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Wbe(e,t,n)};Object.defineProperty(Ho,"__esModule",{value:!0});m2(f2(),Ho);m2(T2(),Ho)});var af=f(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.ExpressLayerType=void 0;var tLe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(tLe=qu.ExpressLayerType||(qu.ExpressLayerType={}))});var cf=f(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AttributeNames=void 0;var nLe;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(nLe=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 N2=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(),rLe=(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=rLe;var oLe=(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=oLe;var sLe=(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=sLe;var iLe=(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")},aLe=(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(iLe(t,o))return!0}catch{}return!1};Mt.isLayerIgnored=aLe;var cLe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];Mt.asErrorAndMessage=cLe;var uLe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>O2(n)||"").join(","):O2(e)};Mt.getLayerPath=uLe;var O2=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()}});var I2=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 v2=f(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.ExpressInstrumentation=void 0;var C2=oe(),Js=(y(),C(x)),P2=af(),M2=cf(),ko=N2(),y2=I2(),xa=te(),lLe=(de(),C(je)),Wu=$R(),KR=class extends xa.InstrumentationBase{constructor(e={}){super(y2.PACKAGE_NAME,y2.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={[lLe.SEMATTRS_HTTP_ROUTE]:c.length>0?c:"/"},l=(0,ko.getLayerMetadata)(c,e,n),p=l.attributes[M2.AttributeNames.EXPRESS_TYPE],d=(0,C2.getRPCMetadata)(Js.context.active());if(d?.type===C2.RPCType.HTTP&&(d.route=c||"/"),(0,ko.isLayerIgnored)(l.name,p,r.getConfig()))return p===P2.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[M2.AttributeNames.EXPRESS_TYPE]!==P2.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 L2=f(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0})});var D2=f(Cr=>{"use strict";var pLe=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)&&pLe(e,t,n)};Object.defineProperty(Cr,"__esModule",{value:!0});lf(v2(),Cr);lf(af(),Cr);lf(cf(),Cr);lf(L2(),Cr)});var X2=f((I3e,W2)=>{"use strict";W2.exports=q2;function q2(t,e,n){t instanceof RegExp&&(t=Y2(t,n)),e instanceof RegExp&&(e=Y2(e,n));var r=K2(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 Y2(t,e){var n=e.match(t);return n?n[0]:null}q2.range=K2;function K2(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 r4=f((C3e,n4)=>{var z2=X2();n4.exports=hLe;var J2="\0SLASH"+Math.random()+"\0",Q2="\0OPEN"+Math.random()+"\0",ZR="\0CLOSE"+Math.random()+"\0",Z2="\0COMMA"+Math.random()+"\0",e4="\0PERIOD"+Math.random()+"\0";function QR(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function TLe(t){return t.split("\\\\").join(J2).split("\\{").join(Q2).split("\\}").join(ZR).split("\\,").join(Z2).split("\\.").join(e4)}function mLe(t){return t.split(J2).join("\\").split(Q2).join("{").split(ZR).join("}").split(Z2).join(",").split(e4).join(".")}function t4(t){if(!t)return[""];var e=[],n=z2("{","}",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=t4(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function hLe(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(TLe(t),n,!0).map(mLe)}function gLe(t){return"{"+t+"}"}function ALe(t){return/^-?0\d/.test(t)}function RLe(t,e){return t<=e}function OLe(t,e){return t>=e}function Xu(t,e,n){var r=[],o=z2("{","}",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(_=t4(o.body),_.length===1&&(_=Xu(_[0],e,!1).map(gLe),_.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=RLe,N=T<S;N&&(R*=-1,O=OLe);var A=_.some(ALe);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 RDe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(RDe=Qn.AllowedOperationTypes||(Qn.AllowedOperationTypes={}));var ODe;(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"})(ODe=Qn.TokenKind||(Qn.TokenKind={}));var NDe;(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"})(NDe=Qn.SpanNames||(Qn.SpanNames={}))});var aO=f(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.AttributeNames=void 0;var IDe;(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"})(IDe=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 D4=f(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.OPERATION_NOT_SUPPORTED=void 0;var dze=Af();Rf.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var Y4=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(),C(x)),qo=iO(),Va=aO(),eo=Af(),x4=Object.values(qo.AllowedOperationTypes),CDe=t=>typeof t?.then=="function";et.isPromise=CDe;var PDe=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 MDe(t,e){Object.entries(e).forEach(([n,r])=>{cO(t,n,r)})}et.addInputVariableAttributes=MDe;function B4(t,e,n,r,o){let s=F4(e,n,r,o);t.setAttribute(Va.AttributeNames.SOURCE,s)}et.addSpanSource=B4;function yDe(t,e,n,r,o){let s=G4(n,o),i=!1;if(!s){i=!0;let a=H4(n,o);s={parent:a,span:vDe(t,e,n,r,o,a.span),error:null},DDe(n,o,s)}return{spanAdded:i,field:s}}function vDe(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&&B4(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 bDe(t,e){e&&t.recordException(e),t.end()}et.endSpan=bDe;function LDe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>{var r;return x4.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 x4.indexOf((r=n)===null||r===void 0?void 0:r.operation)!==-1})}et.getOperation=LDe;function DDe(t,e,n){return t[eo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function G4(t,e){return t[eo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function H4(t,e){for(let n=e.length-1;n>0;n--){let r=G4(t,e.slice(0,n));if(r)return r}return{span:t[eo.OTEL_GRAPHQL_DATA_SYMBOL].span}}function xDe(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 UDe(t){return k4(`
10
- `,t)}function U4(t){return k4(" ",t)}function k4(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var wDe=[qo.TokenKind.FLOAT,qo.TokenKind.STRING,qo.TokenKind.INT,qo.TokenKind.BLOCK_STRING];function F4(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&&wDe.indexOf(u.kind)>=0&&(p="*"),u.kind===qo.TokenKind.STRING&&(p=`"${p}"`),u.kind===qo.TokenKind.EOF&&(p=""),u.line>l?(i+=UDe(u.line-l),l=u.line,d=U4(u.column-1)):u.line===((o=u.prev)===null||o===void 0?void 0:o.line)&&(d=U4(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=F4;function j4(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=$4(e,n,s.resolve)),s.type)){let i=s.type;for(;i.ofType;)i=i.ofType;j4(i,e,n)}})}et.wrapFields=j4;var w4=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Ba.SpanStatusCode.ERROR,message:e.message}),t.end())},V4=(t,e)=>{e&&t.end()};function $4(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&&(PDe(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=xDe(u.mergeItems,c&&c.path),p=l.filter(E=>typeof E=="string").length,d,_=!1;if(u.depth>=0&&u.depth<p)d=H4(a,l);else{let E=yDe(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=>(V4(d.span,_),S),S=>{throw w4(d.span,S,_),S}):(V4(d.span,_),E)}catch(E){throw w4(d.span,E,_),E}})}return o[eo.OTEL_PATCHED_SYMBOL]=!0,o}et.wrapFieldResolver=$4});var q4=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 X4=f(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.GraphQLInstrumentation=void 0;var to=(y(),C(x)),bn=te(),rl=iO(),Of=aO(),uO=Af(),VDe=D4(),vt=Y4(),K4=q4(),W4={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},Nf=[">=14.0.0 <17"],lO=class extends bn.InstrumentationBase{constructor(e={}){super(K4.PACKAGE_NAME,K4.PACKAGE_VERSION,Object.assign(Object.assign({},W4),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},W4),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=VDe.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 J4=f(z4=>{"use strict";Object.defineProperty(z4,"__esModule",{value:!0})});var Z4=f(Ko=>{"use strict";var BDe=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]})),Q4=Ko&&Ko.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&BDe(e,t,n)};Object.defineProperty(Ko,"__esModule",{value:!0});Q4(X4(),Ko);Q4(J4(),Ko)});var s5=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 i5=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 u5=f(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.KafkaJsInstrumentation=void 0;var ft=(y(),C(x)),Wo=(de(),C(je)),a5=s5(),c5=i5(),Zn=te(),pO=class extends Zn.InstrumentationBase{constructor(e={}){super(a5.PACKAGE_NAME,a5.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,c5.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,c5.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 p5=f(l5=>{"use strict";Object.defineProperty(l5,"__esModule",{value:!0})});var _5=f(Xo=>{"use strict";var kDe=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]})),d5=Xo&&Xo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&kDe(e,t,n)};Object.defineProperty(Xo,"__esModule",{value:!0});d5(u5(),Xo);d5(p5(),Xo)});var m5=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 R5=f(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.LruMemoizerInstrumentation=void 0;var h5=(y(),C(x)),g5=te(),A5=m5(),dO=class extends g5.InstrumentationBase{constructor(e={}){super(A5.PACKAGE_NAME,A5.PACKAGE_VERSION,e)}init(){return[new g5.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"?h5.context.bind(h5.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};Mf.LruMemoizerInstrumentation=dO});var O5=f(ei=>{"use strict";var jDe=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]})),$De=ei&&ei.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jDe(e,t,n)};Object.defineProperty(ei,"__esModule",{value:!0});$De(R5(),ei)});var M5=f(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.MongodbCommandType=void 0;var qDe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(qDe=ol.MongodbCommandType||(ol.MongodbCommandType={}))});var y5=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 L5=f(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.MongoDBInstrumentation=void 0;var Ce=(y(),C(x)),ge=te(),no=(de(),C(je)),zo=M5(),v5=y5(),b5={requireParentSpan:!0},_O=class t extends ge.InstrumentationBase{constructor(e={}){super(v5.PACKAGE_NAME,v5.PACKAGE_VERSION,Object.assign(Object.assign({},b5),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},b5),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 D5=f(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.MongodbCommandType=void 0;var KDe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(KDe=sl.MongodbCommandType||(sl.MongodbCommandType={}))});var U5=f(Jo=>{"use strict";var WDe=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]})),x5=Jo&&Jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WDe(e,t,n)};Object.defineProperty(Jo,"__esModule",{value:!0});x5(L5(),Jo);x5(D5(),Jo)});var F5=f(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.handleCallbackResponse=Qo.handlePromiseResponse=Qo.getAttributesFromCollection=void 0;var H5=(y(),C(x)),exe=te(),il=(de(),C(je));function txe(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=txe;function k5(t,e={}){t.recordException(e),t.setStatus({code:H5.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
11
- Mongoose Error Code: ${e.code}`:""}`})}function fO(t,e,n,r=void 0){n&&(0,exe.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&H5.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function nxe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(fO(e,o,n,r),o)).catch(o=>{throw k5(e,o),o}).finally(()=>e.end()):(fO(e,t,n,r),e.end(),t)}Qo.handlePromiseResponse=nxe;function rxe(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2&&(a=1),o[a]=(c,u)=>(c?k5(r,c):fO(r,u,s,i),r.end(),t(c,u)),e.apply(n,o)}Qo.handleCallbackResponse=rxe});var j5=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 W5=f(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.MongooseInstrumentation=yr._STORED_PARENT_SPAN=void 0;var kt=(y(),C(x)),oxe=oe(),SO=F5(),$5=te(),Y5=j5(),al=(de(),C(je)),vf=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],sxe=["remove","count","findOneAndRemove",...vf],ixe=["count","findOneAndRemove",...vf],axe=[...vf];function q5(t){return t?t.startsWith("6.")||t.startsWith("5.")?sxe:t.startsWith("7.")?ixe:axe:vf}function K5(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}yr._STORED_PARENT_SPAN=Symbol("stored-parent-span");var TO=class extends $5.InstrumentationBase{constructor(e={}){super(Y5.PACKAGE_NAME,Y5.PACKAGE_VERSION,e)}init(){return new $5.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,K5(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)),q5(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=q5(n);this._unwrap(e.Model.prototype,"save"),e.Model.prototype.$save=e.Model.prototype.save,K5(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,oxe.suppressTracing)(kt.context.active()),e):e()}};yr.MongooseInstrumentation=TO});var z5=f(X5=>{"use strict";Object.defineProperty(X5,"__esModule",{value:!0})});var Q5=f(Zo=>{"use strict";var cxe=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]})),J5=Zo&&Zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&cxe(e,t,n)};Object.defineProperty(Zo,"__esModule",{value:!0});J5(W5(),Zo);J5(z5(),Zo)});var rX=f(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.AttributeNames=void 0;var lxe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(lxe=cl.AttributeNames||(cl.AttributeNames={}))});var sX=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(),C(je));function pxe(t){let{host:e,port:n,database:r,user:o}=dxe(t),s=parseInt(n,10);return isNaN(s)?{[ro.SEMATTRS_NET_PEER_NAME]:e,[ro.SEMATTRS_DB_CONNECTION_STRING]:oX(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]:oX(e,n,r),[ro.SEMATTRS_DB_NAME]:r,[ro.SEMATTRS_DB_USER]:o}}tn.getConnectionAttributes=pxe;function dxe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function oX(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function _xe(t){return typeof t=="string"?t:t.sql}tn.getDbStatement=_xe;function Exe(t,e){return mO(typeof t=="string"?e:e||t.values)}tn.getDbValues=Exe;function fxe(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=fxe;function mO(t){return t?`[${t.toString()}]`:""}tn.arrayStringifyHelper=mO;function Sxe(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=Sxe});var iX=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 cX=f(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.MySQLInstrumentation=void 0;var nn=(y(),C(x)),Ya=te(),hO=(de(),C(je)),Txe=rX(),qa=sX(),aX=iX(),bf=class t extends Ya.InstrumentationBase{constructor(e={}){super(aX.PACKAGE_NAME,aX.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(Txe.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 lX=f(uX=>{"use strict";Object.defineProperty(uX,"__esModule",{value:!0})});var dX=f(es=>{"use strict";var mxe=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]})),pX=es&&es.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mxe(e,t,n)};Object.defineProperty(es,"__esModule",{value:!0});pX(cX(),es);pX(lX(),es)});var AO=f(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.addSqlCommenterComment=void 0;var gO=(y(),C(x)),gxe=oe();function Axe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function Rxe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Oxe(t,e){if(typeof e!="string"||e.length===0||Axe(e))return e;let n=new gxe.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=Rxe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}Df.addSqlCommenterComment=Oxe});var mX=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(),C(je));function Nxe(t){let{host:e,port:n,database:r,user:o}=Ixe(t),s=parseInt(n,10);return isNaN(s)?{[oo.SEMATTRS_NET_PEER_NAME]:e,[oo.SEMATTRS_DB_CONNECTION_STRING]:TX(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]:TX(e,n,r),[oo.SEMATTRS_DB_NAME]:r,[oo.SEMATTRS_DB_USER]:o}}Ln.getConnectionAttributes=Nxe;function Ixe(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 Cxe(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=Cxe;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}Ln.getSpanName=Pxe;var Mxe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Ln.once=Mxe;function yxe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}Ln.getConnectionPrototypeToInstrument=yxe});var hX=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 OX=f(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.MySQL2Instrumentation=void 0;var gX=(y(),C(x)),ti=te(),OO=(de(),C(je)),AX=AO(),Wa=mX(),RX=hX(),RO=[">=1.4.2 <4"],xf=class t extends ti.InstrumentationBase{constructor(e={}){super(RX.PACKAGE_NAME,RX.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:gX.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,AX.addSqlCommenterComment)(u,s):Object.assign(s,{sql:(0,AX.addSqlCommenterComment)(u,s.sql)}));let l=(0,Wa.once)((p,d)=>{if(p)u.setStatus({code:gX.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 IX=f(NX=>{"use strict";Object.defineProperty(NX,"__esModule",{value:!0})});var PX=f(ts=>{"use strict";var vxe=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]})),CX=ts&&ts.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&vxe(e,t,n)};Object.defineProperty(ts,"__esModule",{value:!0});CX(OX(),ts);CX(IX(),ts)});var LX=f(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.endSpan=void 0;var Lxe=(y(),C(x)),Dxe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:Lxe.SpanStatusCode.ERROR,message:e.message})),t.end()};wf.endSpan=Dxe});var NO=f(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.defaultDbStatementSerializer=void 0;var xxe=[{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}],Uxe=(t,e)=>{var n,r;if(Array.isArray(e)&&e.length){let o=(r=(n=xxe.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=Uxe});var DX=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 VX=f(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.IORedisInstrumentation=void 0;var ns=(y(),C(x)),Bf=te(),Dn=(de(),C(je)),xX=te(),ul=LX(),wxe=NO(),UX=DX(),wX={requireParentSpan:!0},IO=class extends Bf.InstrumentationBase{constructor(e={}){super(UX.PACKAGE_NAME,UX.PACKAGE_VERSION,Object.assign(Object.assign({},wX),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},wX),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||wxe.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,xX.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,xX.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 GX=f(BX=>{"use strict";Object.defineProperty(BX,"__esModule",{value:!0})});var kX=f(rs=>{"use strict";var Vxe=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]})),HX=rs&&rs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Vxe(e,t,n)};Object.defineProperty(rs,"__esModule",{value:!0});HX(VX(),rs);HX(GX(),rs)});var FX=f(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.getClientAttributes=void 0;var ll=(de(),C(je));function Bxe(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]:Gxe(t,e?.url)}}Hf.getClientAttributes=Bxe;function Gxe(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 jX=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 WX=f(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});Ff.RedisInstrumentation=void 0;var xn=(y(),C(x)),lt=te(),$X=FX(),Hxe=NO(),YX=jX(),kxe=(de(),C(je)),pl=Symbol("opentelemetry.instrumentation.redis.open_spans"),qX=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),KX={requireParentSpan:!1},kf=class t extends lt.InstrumentationBase{constructor(e={}){super(YX.PACKAGE_NAME,YX.PACKAGE_VERSION,Object.assign(Object.assign({},KX),e))}setConfig(e={}){super.setConfig(Object.assign(Object.assign({},KX),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[qX]=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,$X.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[qX],a=o[0],c=o.slice(1),u=this.getConfig().dbStatementSerializer||Hxe.defaultDbStatementSerializer,l=(0,$X.getClientAttributes)(this._diag,i);try{let _=u(a,c);_!=null&&(l[kxe.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 zX=f(XX=>{"use strict";Object.defineProperty(XX,"__esModule",{value:!0})});var QX=f(os=>{"use strict";var Fxe=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]})),JX=os&&os.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Fxe(e,t,n)};Object.defineProperty(os,"__esModule",{value:!0});JX(WX(),os);JX(zX(),os)});var u3=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 Xxe;(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"})(Xxe=_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 zxe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(zxe=El.SpanNames||(El.SpanNames={}))});var S3=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(),C(x)),$f=yO(),bt=(de(),C(je)),ni=vO(),Jxe=te(),l3=bO();function p3(t,e){if(!e)return l3.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:d3(e.text);return`${l3.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}ae.getQuerySpanName=p3;function d3(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=d3;function LO(t){let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}ae.getConnectionString=LO;function _3(t){if(Number.isInteger(t))return t}function E3(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]:_3(t.port),[bt.SEMATTRS_DB_USER]:t.user}}ae.getSemanticAttributesFromConnection=E3;function Qxe(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]:_3(t.port),[bt.SEMATTRS_DB_USER]:t.user,[$f.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[$f.AttributeNames.MAX_CLIENT]:t.maxClient}}ae.getSemanticAttributesFromPool=Qxe;function Zxe(t){return t.requireParentSpan===!0&&ss.trace.getSpan(ss.context.active())===void 0}ae.shouldSkipInstrumentation=Zxe;function eUe(t,e,n){let{connectionParameters:r}=this,o=r.database,s=p3(o,n),i=t.startSpan(s,{kind:ss.SpanKind.CLIENT,attributes:E3(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=eUe;function f3(t,e,n){typeof t.responseHook=="function"&&(0,Jxe.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&ss.diag.error("Error running response hook",r)},!0)}ae.handleExecutionResult=f3;function tUe(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})):f3(t,e,a),o(),e.end(),n.call(this,i,a)}}ae.patchCallback=tUe;function nUe(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=nUe;function rUe(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=rUe;function oUe(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=oUe;function sUe(t,e){return function(r){r&&t.setStatus({code:ss.SpanStatusCode.ERROR,message:r.message}),t.end(),e.apply(this,arguments)}}ae.patchClientConnectCallback=sUe;function iUe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}ae.getErrorMessage=iUe;function aUe(t){var e;return typeof t=="object"&&typeof((e=t)===null||e===void 0?void 0:e.text)=="string"}ae.isObjectWithTextString=aUe});var T3=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 O3=f(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.PgInstrumentation=void 0;var Un=te(),_e=(y(),C(x)),m3=u3(),We=S3(),h3=AO(),g3=T3(),A3=bO(),Yf=oe(),is=(de(),C(je)),ri=vO();function qf(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var DO=class extends Un.InstrumentationBase{constructor(e={}){super(g3.PACKAGE_NAME,g3.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(A3.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 R3(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,h3.addSqlCommenterComment)(_,i):c&&!("name"in i)&&(o[0]=Object.assign(Object.assign({},i),{text:(0,h3.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[m3.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[m3.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(A3.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 R3(s,i)}}};Kf.PgInstrumentation=DO;function R3(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 I3=f(N3=>{"use strict";Object.defineProperty(N3,"__esModule",{value:!0})});var C3=f(so=>{"use strict";var cUe=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)&&cUe(e,t,n)};Object.defineProperty(so,"__esModule",{value:!0});xO(O3(),so);xO(I3(),so);xO(yO(),so)});var j3=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 AUe;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(AUe=fl.AttributeNames||(fl.AttributeNames={}))});var $3=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(),C(je)),Sl=HO(),as=kO();function RUe(t){return t.name?t.name:t.pkg.name}Xe.getPluginName=RUe;var OUe=t=>typeof t=="string"&&Sl.HapiLifecycleMethodNames.has(t);Xe.isLifecycleExtType=OUe;var NUe=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=NUe;var IUe=t=>Array.isArray(t)&&t.length<=3&&(0,Xe.isLifecycleExtType)(t[0])&&typeof t[1]=="function";Xe.isDirectExtInput=IUe;var CUe=t=>!Array.isArray(t);Xe.isPatchableExtMethod=CUe;var PUe=(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=PUe;var MUe=(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=MUe;var yUe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;Xe.getPluginFromInput=yUe});var K3=f(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});Jf.HapiInstrumentation=void 0;var En=(y(),C(x)),Y3=oe(),zf=te(),q3=j3(),Tl=HO(),ao=$3(),FO=class extends zf.InstrumentationBase{constructor(e={}){super(q3.PACKAGE_NAME,q3.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,Y3.getRPCMetadata)(En.context.active());c?.type===Y3.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 X3=f(cs=>{"use strict";var vUe=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]})),W3=cs&&cs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&vUe(e,t,n)};Object.defineProperty(cs,"__esModule",{value:!0});W3(K3(),cs);W3(kO(),cs)});var Qf=f(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.KoaLayerType=void 0;var LUe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(LUe=ml.KoaLayerType||(ml.KoaLayerType={}))});var ez=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 DUe;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(DUe=hl.AttributeNames||(hl.AttributeNames={}))});var nz=f(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.isLayerIgnored=ec.getMiddlewareMetadata=void 0;var tz=Qf(),Zf=jO(),xUe=(de(),C(je)),UUe=(t,e,n,r)=>{var o;return n?{attributes:{[Zf.AttributeNames.KOA_NAME]:r?.toString(),[Zf.AttributeNames.KOA_TYPE]:tz.KoaLayerType.ROUTER,[xUe.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]:tz.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};ec.getMiddlewareMetadata=UUe;var wUe=(t,e)=>{var n;return!!(Array.isArray(e?.ignoreLayersType)&&(!((n=e?.ignoreLayersType)===null||n===void 0)&&n.includes(t)))};ec.isLayerIgnored=wUe});var rz=f(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.kLayerPatched=void 0;eS.kLayerPatched=Symbol("koa-layer-patched")});var uz=f(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.KoaInstrumentation=void 0;var br=(y(),C(x)),gl=te(),oz=Qf(),sz=ez(),iz=nz(),az=oe(),cz=rz(),$O=class extends gl.InstrumentationBase{constructor(e={}){super(sz.PACKAGE_NAME,sz.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?oz.KoaLayerType.ROUTER:oz.KoaLayerType.MIDDLEWARE;return e[cz.kLayerPatched]===!0||(0,iz.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(br.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[cz.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,iz.getMiddlewareMetadata)(s,e,n,r),u=this.tracer.startSpan(c.name,{attributes:c.attributes}),l=(0,az.getRPCMetadata)(br.context.active());l?.type===az.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 lz=f(co=>{"use strict";var VUe=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)&&VUe(e,t,n)};Object.defineProperty(co,"__esModule",{value:!0});YO(uz(),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 GUe;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(GUe=er.AttributeNames||(er.AttributeNames={}));var HUe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(HUe=er.ConnectTypes||(er.ConnectTypes={}));var kUe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(kUe=er.ConnectNames||(er.ConnectNames={}))});var fz=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 Sz=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 Tz=f(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.generateRoute=ls.replaceCurrentStackRoute=ls.addNewStackLayer=void 0;var FUe=(y(),C(x)),us=Sz(),jUe=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():FUe.diag.warn("Connect: Trying to pop the stack multiple time")}};ls.addNewStackLayer=jUe;var $Ue=(t,e)=>{e&&t[us._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ls.replaceCurrentStackRoute=$Ue;var YUe=t=>t[us._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ls.generateRoute=YUe});var gz=f(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.ConnectInstrumentation=ps.ANONYMOUS_NAME=void 0;var qUe=(y(),C(x)),mz=oe(),nc=qO(),hz=fz(),rS=te(),KUe=(de(),C(je)),KO=Tz();ps.ANONYMOUS_NAME="anonymous";var WO=class extends rS.InstrumentationBase{constructor(e={}){super(hz.PACKAGE_NAME,hz.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:{[KUe.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,mz.getRPCMetadata)(qUe.context.active());e&&d?.type===mz.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 Rz=f(ds=>{"use strict";var WUe=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]})),Az=ds&&ds.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WUe(e,t,n)};Object.defineProperty(ds,"__esModule",{value:!0});Az(qO(),ds);Az(gz(),ds)});var Pz=f(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.once=rc.getSpanName=void 0;function zUe(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=zUe;var JUe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};rc.once=JUe});var Mz=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 Dz=f(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.TediousInstrumentation=void 0;var Al=(y(),C(x)),QUe=require("events"),oS=te(),_s=(de(),C(je)),yz=Pz(),vz=Mz(),Lz=Symbol("opentelemetry.instrumentation-tedious.current-database"),bz=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function sS(t){Object.defineProperty(this,Lz,{value:t,writable:!0})}var iS=class t extends oS.InstrumentationBase{constructor(e={}){super(vz.PACKAGE_NAME,vz.PACKAGE_VERSION,e)}init(){return[new oS.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of bz)(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 bz)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 QUe.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[Lz],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,yz.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,yz.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 Uz=f(xz=>{"use strict";Object.defineProperty(xz,"__esModule",{value:!0})});var Vz=f(Es=>{"use strict";var ZUe=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]})),wz=Es&&Es.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&ZUe(e,t,n)};Object.defineProperty(Es,"__esModule",{value:!0});wz(Dz(),Es);wz(Uz(),Es)});var Fz=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 $z=f(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.GenericPoolInstrumentation=void 0;var ic=(y(),C(x)),oi=te(),jz=Fz(),XO="generic-pool",zO=class extends oi.InstrumentationBase{constructor(e={}){super(jz.PACKAGE_NAME,jz.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 Yz=f(si=>{"use strict";var n0e=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]})),r0e=si&&si.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&n0e(e,t,n)};Object.defineProperty(si,"__esModule",{value:!0});r0e($z(),si)});var JO=f(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.DEFAULT_CONFIG=ii.EndOperation=void 0;var s0e;(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"})(s0e=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(),C(x)),uo=(de(),C(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"),i0e=t=>t!==""?t:"<default>";De.normalizeExchange=i0e;var a0e=t=>t.replace(/:[^:@/]*@/,":***@"),zz=(t,e)=>t||(e==="AMQP"?5672:5671),Jz=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},Qz=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}),{}),c0e=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=c0e;var u0e=t=>{let e={[uo.SEMATTRS_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let n=t,r=Jz(n?.protocol);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_MESSAGING_PROTOCOL,r,"protocol")));let o=Qz(n?.hostname);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_NET_PEER_NAME,o,"hostname")));let s=zz(n.port,r);Object.assign(e,Object.assign({},ac(t,uo.SEMATTRS_NET_PEER_PORT,s,"port")))}else{let n=a0e(t);e[uo.SEMATTRS_MESSAGING_URL]=n;try{let r=new URL(n),o=Jz(r.protocol);Object.assign(e,Object.assign({},ac(n,uo.SEMATTRS_MESSAGING_PROTOCOL,o,"protocol")));let s=Qz(r.hostname);Object.assign(e,Object.assign({},ac(n,uo.SEMATTRS_NET_PEER_NAME,s,"hostname")));let i=zz(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=u0e;var l0e=t=>t.setValue(ZO,!0);De.markConfirmChannelTracing=l0e;var p0e=t=>t.deleteValue(ZO);De.unmarkConfirmChannelTracing=p0e;var d0e=t=>t.getValue(ZO)===!0;De.isConfirmChannelTracing=d0e});var e8=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 n8=f(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.AmqplibInstrumentation=void 0;var Pe=(y(),C(x)),uS=oe(),le=te(),rn=(de(),C(je)),Ft=JO(),xe=Zz(),t8=e8(),lS=[">=0.5.5 <1"],eN=class extends le.InstrumentationBase{constructor(e={}){super(t8.PACKAGE_NAME,t8.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 o8=f(fs=>{"use strict";var _0e=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]})),r8=fs&&fs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_0e(e,t,n)};Object.defineProperty(fs,"__esModule",{value:!0});r8(n8(),fs);r8(JO(),fs)});var I8=require("commander"),Nl=I(require("crypto")),C8=I(require("fs")),Lt=I(require("os")),ai=I(require("path")),P8=require("child_process"),M8=require("util");var bl=require("child_process"),uN=require("util"),_o=I(require("fs")),Ll=I(require("os")),RS=I(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",H8=5e3,vl=class extends Error{constructor(e){super(e),this.name="CredentialAccessError"}};function k8(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=k8(t).toLowerCase();return n.includes("operation not permitted")||n.includes("permission denied")}async function F8(){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 j8(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 $8(){try{await nr("security",["delete-generic-password","-s",Sn,"-a",po],{timeout:5e3})}catch{}}async function Y8(){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 q8(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"))},H8))]),!0):!1}catch{return!1}}async function K8(){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 W8(){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 X8(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 z8(){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"&&J8(lc)}function AS(){try{_o.unlinkSync(lc)}catch{}}function J8(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:F8,store:j8,delete:$8};case"linux":return{get:Y8,store:q8,delete:K8};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:W8()}static async saveRcAccessToken(e){process.env.VISA_MOCK_KEYCHAIN!=="true"&&await X8(e)}static async deleteSessionToken(){if(process.env.VISA_MOCK_KEYCHAIN==="true")return;await hS().delete(),AS()}static async clearAll(){await this.deleteSessionToken(),await z8()}};var Dl=I(require("crypto")),xl=I(require("tty")),Ul=I(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 e6(){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 t6(t){return new Promise((e,n)=>{let r;try{r=e6()}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 n6=`
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,41 +11,37 @@ Mongoose Error Code: ${e.code}`:""}`})}function fO(t,e,n,r=void 0){n&&(0,exe.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 _N(t={}){let e=t.version??IS().version;if(!Z8(e))return;let n=process.env.VISA_RC_CODE;if(n&&dN(n)){await Oe.saveRcAccessToken(CS(n));return}if(t.isMcp??!1){let i=await Oe.getRcAccessToken();if(i&&(xr==="SKIP"||i===xr))return;process.stderr.write(`[visa-cli] RC build requires access. Run: visa-cli setup
25
- `),process.exit(1)}let o=await Oe.getRcAccessToken();if(o&&(xr==="SKIP"||o===xr))return;console.log(n6);let s=3;for(let i=1;i<=s;i++){let a;try{a=await t6(" Enter RC access code: ")}catch{process.exit(1)}if(dN(a)){await Oe.saveRcAccessToken(CS(a)),console.log(`
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<s&&console.log(`
28
- Invalid code. ${s-i} attempt(s) remaining.
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 EN=require("child_process");function r6(t=process.env,e=process.platform){return t.VISA_CLI_NO_BROWSER==="1"||t.VISA_CLI_NO_BROWSER==="true"?{headless:!0,reason:"VISA_CLI_NO_BROWSER is set"}:t.CI==="true"||t.CI==="1"?{headless:!0,reason:"CI environment detected"}:t.SSH_CONNECTION||t.SSH_TTY?{headless:!0,reason:"SSH session detected"}:e==="linux"&&!t.DISPLAY&&!t.WAYLAND_DISPLAY?{headless:!0,reason:"Linux with no $DISPLAY or $WAYLAND_DISPLAY"}:{headless:!1}}function o6(t){let n=t.length+4;return[`\u250C${"\u2500".repeat(n)}\u2510`,`\u2502${" ".repeat(2)}${t}${" ".repeat(2)}\u2502`,`\u2514${"\u2500".repeat(n)}\u2518`].join(`
32
- `)}function s6(t,e=process.platform){return e==="darwin"?{cmd:"open",args:[t]}:e==="win32"?{cmd:"cmd",args:["/c","start","",t]}:e==="linux"?{cmd:"xdg-open",args:[t]}:null}async function fN(t,e={}){let n=e.log??(c=>console.log(c)),r=e.env??process.env,o=e.platform??process.platform,s=e.spawn??((c,u,l)=>{(0,EN.execFile)(c,u,p=>l(p))});n(""),n(" Sign in to Visa CLI by opening this URL in your browser:"),n("");for(let c of o6(t).split(`
33
- `))n(` ${c}`);n("");let i=r6(r,o);if(i.headless){n(` (${i.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 a=s6(t,o);if(!a){n(` No known browser-open command for platform "${o}".`),n(" Open the URL above manually to continue."),n("");return}await new Promise(c=>{s(a.cmd,a.args,u=>{u?(n(` Could not open browser automatically (${u.message}).`),n(" Open the URL above manually to continue."),n("")):(n(" Opened browser. Waiting for you to sign in..."),n("")),c()})})}var TN=I(require("crypto")),$t=I(require("fs")),wl=I(require("path"));function mN(t,e){$t.mkdirSync(wl.dirname(t),{recursive:!0});let n=`${t}.${process.pid}.${TN.randomBytes(8).toString("hex")}.tmp`;try{$t.writeFileSync(n,JSON.stringify(e,null,2)+`
34
- `),$t.renameSync(n,t)}catch(r){try{$t.unlinkSync(n)}catch{}throw r}}function SN(t){return`'${t.replace(/'/g,"'\\''")}'`}var hN="# visa-cli-hud-v1";function i6(t,e){let n=t??process.execPath,r=e??process.argv[1]??"",o=r?wl.resolve(r):"";return`${o?`${SN(n)} ${SN(o)} statusline`:"visa-cli statusline"} ${hN}`}function gN(t){return typeof t!="string"?!1:t.includes(hN)?!0:t.includes("visa-cli")&&t.includes("statusline")}function Vl(t,e=i6){let n={},r=!1;if($t.existsSync(t)){r=!0;try{n=JSON.parse($t.readFileSync(t,"utf-8"))}catch(o){return{installed:"malformed-json",message:`~/.claude/settings.json is not valid JSON (${o.message}). Fix the file manually, then run: visa-cli hud enable`}}}if(n.statusLine){let o=typeof n.statusLine=="object"?n.statusLine.command:"";return gN(o)?{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:e()},mN(t,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(o){return{installed:"error",message:`Failed to write settings: ${o.message}. Enable manually later with: visa-cli hud enable`}}}function PS(t){if(!$t.existsSync(t))return{removed:!1,message:"No ~/.claude/settings.json found."};let e;try{e=JSON.parse($t.readFileSync(t,"utf-8"))}catch(r){return{removed:!1,message:`~/.claude/settings.json is not valid JSON: ${r.message}`}}if(!e.statusLine)return{removed:!1,message:"No statusLine configured."};let n=typeof e.statusLine=="object"?e.statusLine.command:"";return gN(n)?(delete e.statusLine,mN(t,e),{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 Ur=I(require("fs")),wr=I(require("path")),a6=1,Ts={CLAUDE_CODE:"claude-code",CODEX:"codex",UNKNOWN:"unknown"},c6=["claude","claude-code","codex","all"];function LS(t){let e=t.toLowerCase();return c6.includes(e)?e:null}var u6=50,l6=64*1024,AN=10,MS=80;function p6(){let t=(process.env.COLORTERM??"").toLowerCase();if(t==="truecolor"||t==="24bit")return!0;let e=(process.env.TERM??"").toLowerCase();return e.includes("truecolor")||e.includes("24bit")}var yS=p6(),$={reset:"\x1B[0m",visaBlue:yS?"\x1B[38;2;20;52;203m":"\x1B[38;5;27m",visaBlueSoft:yS?"\x1B[38;2;97;126;229m":"\x1B[38;5;111m",visaGold:yS?"\x1B[38;2;247;182;0m":"\x1B[38;5;220m",green:"\x1B[38;5;48m",dim:"\x1B[2m"};function Z(t,e){return t.length===0||process.env.NO_COLOR?t:`${e}${t}${$.reset}`}function RN(t){return t.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u001F\u007F]/g,"").length}async function CN(t=process.stdin){return t.isTTY?null:new Promise(e=>{let n=[],r=!1,o=()=>{t.removeListener("data",i),t.removeListener("end",a),t.removeListener("error",c),clearTimeout(u)},s=l=>{r||(r=!0,o(),e(l))},i=l=>{n.push(typeof l=="string"?Buffer.from(l):l)},a=()=>{let l=Buffer.concat(n).toString("utf-8").trim();if(!l)return s(null);try{let p=JSON.parse(l);s(p&&typeof p=="object"?p:null)}catch{s(null)}},c=()=>s(null),u=setTimeout(()=>{n.length>0?a():s(null)},u6);t.on("data",i),t.on("end",a),t.on("error",c)})}function Bl(t){let n=Math.round(Math.max(0,Math.min(1,t))*10),r="\u2588".repeat(n),o="\u2591".repeat(10-n);return`${Z(r||"",$.visaBlueSoft)}${Z(o||"",$.dim)}`}function vS(t){return!Number.isFinite(t)||t<0?"0":t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}k`:String(Math.round(t))}function d6(t){if(O6(t))return _6(t);let e=` ${Z("\u2502",$.dim)} `,n=bS(t)||"claude",r=t.cwd?pt(wr.basename(t.cwd)):"",o=DS(t.workspace),s=r||o,i=o&&o!==s?` ${Z(`@${o}`,$.visaBlueSoft)}`:"",a=[Z(`[${n}]`,$.visaBlueSoft)];s&&a.push(`${Z(s,$.visaGold)}${i}`);let c=a.join(e),u=Number(t.context_window?.context_window_size??0),l=typeof t.context_window?.used_percentage=="number"?t.context_window.used_percentage:typeof t.context_window?.remaining_percentage=="number"?100-t.context_window.remaining_percentage:null,p=t.context_window?.current_usage,d=[p?.input_tokens,p?.output_tokens,p?.cache_creation_input_tokens,p?.cache_read_input_tokens].filter(A=>typeof A=="number"&&Number.isFinite(A)),_=d.length>0?d.reduce((A,M)=>A+M,0):null,E=Number(t.context_window?.total_input_tokens??_??p?.input_tokens??0),S=l!==null?Math.max(0,Math.min(1,l/100)):u>0?Math.max(0,Math.min(1,E/u)):0,T=l!==null&&u>0?Math.round(S*u):E,h;if(u>0||l!==null){let A=`${String(Math.round(S*100)).padStart(2," ")}%`,M=u>0?` ${Z(`(${vS(T)}/${vS(u)})`,$.dim)}`:"";h=`${Z("Context",$.dim)} ${Bl(S)} ${Z(A,$.green)}${M}`}else h=`${Z("Context",$.dim)} ${Z("-",$.dim)}`;let R=f6(t.rate_limits),O=[h];R&&O.push(R);let N=O.join(e);return`${c}
35
- ${N}`}function _6(t){let e=` ${Z("\u2502",$.dim)} `,n=DN(t),r=n.model||"codex",o=[Z(`[${r}]`,$.visaBlueSoft)];n.project&&o.push(Z(n.project,$.visaGold)),n.gitBranch&&o.push(`${Z("git",$.dim)} ${Z(n.gitBranch,$.visaGold)}`);let s=o.join(e),i=[];if(typeof n.contextUsedPercent=="number"){let c=Math.max(0,Math.min(1,n.contextUsedPercent/100));i.push(`${Z("Context",$.dim)} ${Bl(c)} ${Z(`${Math.round(n.contextUsedPercent)}%`,$.green)}`)}else if(typeof n.contextRemainingPercent=="number"){let c=100-n.contextRemainingPercent,u=Math.max(0,Math.min(1,c/100));i.push(`${Z("Context",$.dim)} ${Bl(u)} ${Z(`${Math.round(c)}%`,$.green)}`)}typeof n.usedTokens=="number"&&i.push(`${Z("Tokens",$.dim)} ${vS(n.usedTokens)}`),n.status&&i.push(`${Z("Status",$.dim)} ${Z(n.status,$.visaBlueSoft)}`),n.threadTitle&&i.push(`${Z("Thread",$.dim)} ${Z(n.threadTitle,$.visaBlueSoft)}`);let a=i.length>0?i.join(e):`${Z("Context",$.dim)} ${Z("-",$.dim)}`;return`${s}
36
- ${a}`}function E6(t){if(typeof t!="number"||t<=0)return"";let n=(t>1e12?t:t*1e3)-Date.now();if(n<=0||n>=10080*60*1e3)return"";let r=Math.floor(n/6e4),o=Math.floor(r/60),s=r%60;return o>0?`${o}h ${s}m`:`${s}m`}function ON(t,e){if(!t||typeof t.used_percentage!="number")return null;let n=Math.max(0,Math.min(100,t.used_percentage)),r=n/100,o=Bl(r),s=n>=90?"\x1B[38;5;196m":n>=70?$.visaGold:$.green,i=`${String(Math.round(n)).padStart(2," ")}%`,a=E6(t.resets_at),c=a?` ${Z(`(${a} / ${e})`,$.dim)}`:` ${Z(`(${e})`,$.dim)}`;return`${o} ${Z(i,s)}${c}`}function f6(t){if(!t)return null;let e=ON(t.five_hour,"5h"),n=typeof t.seven_day?.used_percentage=="number"?t.seven_day.used_percentage:null,r=n!==null&&n>=90?ON(t.seven_day,"7d"):null;if(!e&&!r)return null;let o=` ${Z("\u2502",$.dim)} `,s=[e,r].filter(Boolean);return`${Z("Usage",$.dim)} ${s.join(o)}`}function S6(t){let e;try{let n=Ur.statSync(t);if(!n.isFile())return null;let r=n.size;if(r===0)return null;let o=Math.min(r,l6),s=r-o;e=Ur.openSync(t,"r");let i=Buffer.alloc(o);Ur.readSync(e,i,0,o,s);let a=i.toString("utf-8");if(s>0){let c=Buffer.alloc(1);if(Ur.readSync(e,c,0,1,s-1),c[0]!==10){let u=a.indexOf(`
37
- `);u>=0&&(a=a.slice(u+1))}}return a}catch{return null}finally{if(e!==void 0)try{Ur.closeSync(e)}catch{}}}function T6(t){if(!t||typeof t!="object")return;let e=t,n=["file_path","path","notebook_path","pattern","command","url"];for(let r of n){let o=e[r];if(typeof o=="string"&&o.length>0){if(r.endsWith("_path")||r==="path"){let s=wr.basename(wr.dirname(o)),i=wr.basename(o);return s&&s!=="."&&s!=="/"?`${s}/${i}`:i}return o}}}function m6(t){let e=t.split(`
38
- `),n=[],r=new Set;for(let o=e.length-1;o>=0&&n.length<AN*3;o-=1){let s=e[o].trim();if(!s)continue;let i;try{i=JSON.parse(s)}catch{continue}if(!i||typeof i!="object")continue;let c=i.message;if(!c||typeof c!="object")continue;let u=c.content;if(Array.isArray(u))for(let l of u){if(!l||typeof l!="object")continue;let p=l;if(p.type==="tool_result"&&typeof p.tool_use_id=="string")r.add(p.tool_use_id);else if(p.type==="tool_use"&&typeof p.name=="string"){let d=typeof p.id=="string"?p.id:"",_=d.length>0?!r.has(d):!1;n.push({name:p.name,target:T6(p.input),running:_})}}}return n.reverse(),n.slice(Math.max(0,n.length-AN))}function h6(t){let e=[];for(let n of t){let r=e[e.length-1];r&&!r.running&&!n.running&&r.name===n.name&&r.target===void 0&&n.target===void 0?r.count+=1:e.push({...n,count:1})}return e}function g6(t){let e=t.running?Z("\u25D0",$.visaGold):Z("\u2713",$.green),n=t.running?$.visaGold:$.visaBlueSoft,r=Z(pt(t.name),n),o=t.target?pt(t.target):"",s=o?`${Z(":",$.dim)} ${Z(o,$.dim)}`:"",i=t.count>1?` ${Z(`\xD7${t.count}`,$.dim)}`:"";return s?`${e} ${r}${s}${i}`:`${e} ${r}${i}`}function A6(t){let e=` ${Z("\u2502",$.dim)} `,n=RN(e),r=t.slice();for(;r.length>0;){let c=r.join(e);if(RN(c)<=MS)return c;r=r.slice(1)}if(t.length===0)return"";let o="\u2026",i=t[t.length-1].replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,""),a=i.length>MS-n-1?i.slice(0,MS-n-1)+o:i;return`${Z(o,$.dim)}${e}${a}`}async function R6(t){if(!t||typeof t!="string")return null;let e=S6(t);if(!e)return null;let n;try{n=m6(e)}catch{return null}if(n.length===0)return null;let o=h6(n).map(g6);return A6(o)||null}async function PN(t,e){return(await MN(t,e)).join(`
39
- `)}async function MN(t,e){let n=[t];if(e){let r=d6(e);if(r&&n.push(...r.split(`
40
- `)),e.transcript_path){let o=await R6(e.transcript_path);o&&n.push(...o.split(`
41
- `))}}return n}async function yN(t,e){let n=await MN(t,e),r=n.join(`
42
- `);return{schemaVersion:a6,client:e?LN(e):Ts.UNKNOWN,rendered:r,lines:n.map(IN),visa:{spendLine:IN(t)},context:e?DN(e):{}}}function pt(t){return t?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," ").trim():""}function DS(t){if(typeof t=="string")return pt(wr.basename(t));if(!t||typeof t!="object")return"";let e=typeof t.current_dir=="string"?t.current_dir:typeof t.path=="string"?t.path:"";return pt(e?wr.basename(e):t.name)}function vN(t){return pt(t.app_name??t.appName??t.app??t.client)}function bS(t){return pt(t.model?.display_name??t.model?.id??t.model_name??t.modelName)}function bN(t){return pt(t.cwd??t.current_dir??t.project_root)}function NN(t){let e=pt(t.project);if(e)return e;let n=bN(t);if(n)return pt(wr.basename(n));let r=DS(t.workspace);return r||""}function wn(t){if(!(typeof t!="number"||!Number.isFinite(t)))return t}function LN(t){let e=vN(t).toLowerCase();return e.includes("codex")?Ts.CODEX:e.includes("claude")||t.model?.display_name||t.transcript_path||t.rate_limits?Ts.CLAUDE_CODE:t.run_state||t.runState||t.thread_title||t.threadTitle||t.git_branch||wn(t.context_used)!==void 0?Ts.CODEX:Ts.UNKNOWN}function O6(t){return LN(t)===Ts.CODEX}function DN(t){let e=vN(t),n=bN(t),r=DS(t.workspace),o=wn(t.context_used)??wn(t.context_window?.used_percentage??void 0),s=wn(t.context_remaining)??wn(t.context_window?.remaining_percentage??void 0);return{...e?{app:e}:{},...bS(t)?{model:bS(t)}:{},...NN(t)?{project:NN(t)}:{},...r?{workspace:r}:{},...n?{cwd:n}:{},...pt(t.git_branch??t.branch)?{gitBranch:pt(t.git_branch??t.branch)}:{},...pt(t.status??t.run_state??t.runState)?{status:pt(t.status??t.run_state??t.runState)}:{},...pt(t.thread_title??t.threadTitle)?{threadTitle:pt(t.thread_title??t.threadTitle)}:{},...o!==void 0?{contextUsedPercent:o}:{},...s!==void 0?{contextRemainingPercent:s}:{},...wn(t.used_tokens)!==void 0?{usedTokens:wn(t.used_tokens)}:{},...wn(t.total_input_tokens)!==void 0?{totalInputTokens:wn(t.total_input_tokens)}:{},...wn(t.total_output_tokens)!==void 0?{totalOutputTokens:wn(t.total_output_tokens)}:{}}}function IN(t){return t.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g,"")}var KN=I(require("fs")),WN=I(require("os")),XN=I(require("path"));async function xN(t,e){let n=e?.timeoutMs??3e4,r=new AbortController,o=setTimeout(()=>r.abort(),n);try{let{timeoutMs:s,...i}=e??{};return await fetch(t,{...i,signal:r.signal})}finally{clearTimeout(o)}}var Gl=class extends Error{retryable;code;reason;constructor(e,n,r,o){super(e),this.name="CardDeclinedError",this.retryable=n,this.code=r,this.reason=o}};var N6=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function wN(t,e){let n=UN(t),r=UN(e);if(!n||!r)return!1;for(let o=0;o<3;o++)if(n.main[o]!==r.main[o])return n.main[o]>r.main[o];return n.pre&&!r.pre?!1:!n.pre&&r.pre?!0:!n.pre&&!r.pre?!1:I6(n.pre,r.pre)>0}function UN(t){if(typeof t!="string")return null;let n=t.trim().replace(/^v/,"").match(N6);return n?{main:[Number(n[1]),Number(n[2]),Number(n[3])],pre:n[4]??null}:null}function I6(t,e){let n=t.split("."),r=e.split("."),o=Math.max(n.length,r.length);for(let s=0;s<o;s++){if(s>=n.length)return-1;if(s>=r.length)return 1;let i=n[s],a=r[s],c=/^\d+$/.test(i),u=/^\d+$/.test(a);if(c&&u){let l=Number(i)-Number(a);if(l!==0)return l}else{if(c)return-1;if(u)return 1;if(i<a)return-1;if(i>a)return 1}}return 0}function rr(){return!!(VN(process.env.VISA_CLI_NO_UPDATE_CHECK)||VN(process.env.CI)||process.env.NODE_ENV==="test")}function VN(t){if(t===void 0)return!1;let e=t.trim().toLowerCase();return!(e===""||e==="0"||e==="false"||e==="no"||e==="off")}var Eo=I(require("fs")),HN=I(require("path"));var Hl=I(require("fs")),BN=I(require("path")),GN=I(require("os"));var xS=BN.join(GN.homedir(),".visa-mcp"),pc=class{static ensureConfigDir(){Hl.existsSync(xS)||Hl.mkdirSync(xS,{recursive:!0,mode:448})}static getConfigDir(){return xS}static TOOL_STATES={login:!0,get_status:!0,get_cards:!0,add_card:!0,pay:!0,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};static loadToolStates(){return{...this.TOOL_STATES}}static getDisabledTools(){let e=new Set;for(let[n,r]of Object.entries(this.TOOL_STATES))r||e.add(n);return e}static isToolDisabled(e){return this.TOOL_STATES[e]===!1}};var C6="settings.json";function kl(){return HN.join(pc.getConfigDir(),C6)}var dc={"auth.serverUrl":{type:"string",description:"Auth server base URL. Override for staging / self-hosted backends.",requiresRestart:!0,validate:t=>{if(typeof t!="string")throw new Error("auth.serverUrl must be a string");let e;try{e=new URL(t)}catch{throw new Error(`auth.serverUrl must be a valid URL (got: ${JSON.stringify(t)})`)}if(e.protocol!=="https:"&&e.protocol!=="http:")throw new Error(`auth.serverUrl must use http or https (got: ${e.protocol})`)}},"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_music, ...). Restart required.",requiresRestart:!0},"tools.specific":{type:"boolean",description:"Show legacy per-merchant compatibility tools (generate_image_card, query_onchain_prices_card, ...). Restart required.",requiresRestart:!0},"tools.discover":{type:"boolean",description:"Show the dynamic-catalog tools (discover_tools, execute_tool). Restart required.",requiresRestart:!0}};function Fl(){let t=kl();if(!Eo.existsSync(t))return{};try{let e=Eo.readFileSync(t,"utf-8"),n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?{}:n}catch{return{}}}function kN(t){pc.ensureConfigDir();let e=kl(),n=`${e}.tmp`,r=JSON.stringify(t,null,2)+`
43
- `;Eo.writeFileSync(n,r,{mode:384}),Eo.renameSync(n,e)}function US(t){let e=Fl()[t];return typeof e=="string"?e:void 0}function FN(t){let e=Fl()[t];if(typeof e=="boolean")return e;if(e==="true")return!0;if(e==="false")return!1}var li=class extends Error{constructor(e){let n=Object.keys(dc).sort().join(", ");super(`Unknown setting "${e}". Settable keys: ${n}. For server-controlled values (biometric.*, spending.*) use the dedicated tools (biometric_on/off, update_spending_controls).`),this.name="UnknownSettingKeyError"}},pi=class extends Error{constructor(e){let n="";e.startsWith("biometric.")?n="biometric_on / biometric_off":e.startsWith("spending.")?n="update_spending_controls":e.startsWith("cards.")?n="add_card / remove_card / set_default_card":e.startsWith("account.")&&(n="login / reset"),super(`"${e}" 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"}},jN=["biometric.","spending.","account.","cards.","biometric"];function $N(t,e){if(jN.some(s=>t.startsWith(s)))throw new pi(t);let n=dc[t];if(!n)throw new li(t);let r;if(n.type==="boolean")if(typeof e=="boolean")r=e;else if(typeof e=="string"){let s=e.toLowerCase();if(s==="true")r=!0;else if(s==="false")r=!1;else throw new Error(`${t} expects true or false (got: ${JSON.stringify(e)})`)}else throw new Error(`${t} expects a boolean (got: ${typeof e})`);else{if(typeof e!="string"||e.length===0)throw new Error(`${t} expects a non-empty string`);r=e}n.validate&&n.validate(r);let o=Fl();return o[t]=r,kN(o),{key:t,value:r,requiresRestart:!!n.requiresRestart,path:kl()}}function YN(t){if(jN.some(o=>t.startsWith(o)))throw new pi(t);let e=dc[t];if(!e)throw new li(t);let n=Fl(),r=t in n;return r&&(delete n[t],kN(n)),{key:t,removed:r,requiresRestart:r&&!!e.requiresRestart,path:kl()}}var P6="https://auth.visacli.sh";function qN(){let t=process.env.VISA_AUTH_URL;if(t!==void 0&&t!=="")return t;let e=US("auth.serverUrl");return e!==void 0?e:P6}var jl="2.0.0-rc.9";function M6(){let t=process.env.VISA_CLI_API_KEY;if(t!==void 0)return!t.startsWith("vk_")||t.length<35?`VISA_CLI_API_KEY has invalid format (expected vk_<32+ chars>).
44
- Create a new key: visa-cli api-key create`:["VISA_CLI_API_KEY detected but API key auth is not yet supported for the MCP server.","Options:"," 1. Run `visa-cli setup` in an interactive terminal to authenticate, then restart the MCP server"," 2. API key auth for headless agents is coming soon"].join(`
45
- `);let e=!1;try{e=KN.default.existsSync(XN.default.join(WN.default.homedir(),".visa-mcp"))}catch{}return e?"Not logged in. Sign up at https://visacli.sh or run: visa-cli setup":["No local credentials found (~/.visa-mcp/).","Run `visa-cli setup` in an interactive terminal to authenticate, then restart the MCP server."].join(`
46
- `)}var Vr=class{constructor(e){this.getSessionToken=e;this.baseUrl=qN()}getSessionToken;baseUrl;lastSignals={};parseServerSignals(e){if(this.lastSignals={},!rr()){let r=e.headers.get("X-Latest-Version");r&&wN(r,jl)&&(this.lastSignals.updateAvailable={currentVersion:jl,latestVersion:r})}let n=e.headers.get("X-Feedback-Prompt");if(n)try{this.lastSignals.feedbackPrompt=JSON.parse(n)}catch{}}getClientVersion(){return jl}async request(e,n,r,o,s,i){let a=await this.getSessionToken();if(!a)throw new Error(M6());let c={Authorization:`Bearer ${a}`};s&&(e==="GET"?c["X-User-Context"]=s.replace(/[\r\n\0]/g," ").slice(0,1e3):r={...r||{},user_context:s}),i&&(c["X-Visa-Meta-Tool"]=i),r&&(c["Content-Type"]="application/json");let u;try{u=await xN(`${this.baseUrl}${n}`,{method:e,headers:{...c,"X-Visa-CLI-Version":jl,"X-Source":"cli"},body:r?JSON.stringify(r):void 0,timeoutMs:o})}catch(p){throw p.name==="AbortError"||p.message?.includes("aborted")?new Error("The request timed out. The server may be under heavy load. Please try again."):new Error("Cannot reach the Visa CLI server. Check your internet connection and try again.")}if(this.parseServerSignals(u),u.status===401)throw new Error("Your session has expired. Run: visa-cli setup");if(u.status===429){let p=u.headers.get("Retry-After")||"3";throw new Error(`Rate limited \u2014 wait ${p}s. Tip: use the batch tool to combine multiple requests into one.`)}if(u.status===503)throw new Error("Visa CLI is temporarily unavailable. Check https://visacli.sh for status.");let l;try{l=await u.json()}catch{throw u.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(!u.ok){if(u.status===500)throw new Error(`Server error on ${n}. Try again or check https://visacli.sh for status.`);if(u.status===402){let p=l?.error||"Gateway returned 402";throw new Error(`${p}. This usually means your daily or per-transaction spending limit has been reached. Check your limits with get_status or run: visa-cli update-spending-controls`)}if(l?.declined)throw new Gl(l.error||"Your card was declined.",!!l.retryable,l.code,l.reason);if(u.status===402){let p=l?.error||"Gateway returned 402";throw new Error(`${p}. This usually means your daily or per-transaction spending limit has been reached. Check your limits with get_status or run: visa-cli update-spending-controls`)}throw new Error(l?.error||`Request failed (${u.status}). Try again.`)}return l}async pay(e,n){return this.request("POST","/v1/pay",e,void 0,n)}async shortcut(e,n,r,o,s){return this.request("POST",`/v1/shortcuts/${encodeURIComponent(e)}`,n,r,o,s)}async batch(e,n,r){return this.request("POST","/v1/batch",e,n,r)}async emitTelemetry(e){return this.request("POST","/v1/telemetry",{rows:e})}async catalogSearch(e,n,r){let o=r??"discover_tools",s=new URLSearchParams;e&&s.set("q",e),n&&s.set("category",n);let i=s.toString();return this.request("GET",`/v1/catalog${i?`?${i}`:""}`,void 0,void 0,void 0,o)}async catalogTool(e,n){let r=n??"discover_tools";try{return await this.request("GET",`/v1/catalog/${encodeURIComponent(e)}`,void 0,void 0,void 0,r)}catch{return null}}async discoverMerchantRoutes(e){try{return await this.request("GET",`/v1/platform/discover/${encodeURIComponent(e)}`)}catch{return null}}async paymentPreview(e,n){return this.request("POST","/v1/payment-preview",e,void 0,n)}async getBalance(){return this.request("GET","/v1/balance")}async topupBalance(e){return this.request("POST","/v1/balance/topup",e)}async getSessionBudget(e){return this.request("GET",`/v1/session-budget/${encodeURIComponent(e)}`)}async getSessionLedger(e){return this.request("GET",`/v1/session/${encodeURIComponent(e)}/ledger`)}async getStatus(e){return this.request("GET","/v1/status",void 0,void 0,e)}async getTransactions(e){return this.request("GET","/v1/transactions",void 0,void 0,e)}async updateSpendingControls(e,n){return this.request("POST","/v1/spending-controls",e,void 0,n)}async removeCard(e,n,r){return this.request("DELETE",`/v1/cards/${encodeURIComponent(String(e))}`,n,void 0,r)}async setDefaultCard(e,n,r){return this.request("POST",`/v1/cards/${encodeURIComponent(String(e))}/default`,n,void 0,r)}async getAttestationChallenge(){return this.request("GET","/v1/attestation-challenge")}async registerAttestationKey(e){return this.request("POST","/v1/attestation-key",{publicKey:e})}async setBiometricPreference(e,n){return this.request("POST","/v1/biometric-preference",{...e,confirm:!0},void 0,n)}async logout(e,n){return this.request("POST","/v1/logout",e,void 0,n)}async feedback(e,n,r){return this.request("POST","/v1/feedback",{message:e,...n&&{transaction_id:n}},void 0,r)}async createAppApiKey(e){return this.request("POST","/v1/api/keys",e)}async listAppApiKeys(){return this.request("GET","/v1/api/keys")}async revokeAppApiKey(e){return this.request("DELETE",`/v1/api/keys/${encodeURIComponent(String(e))}`)}async feedSubmit(e){return this.request("POST","/v1/feed",e)}async feedList(e){let n=new URLSearchParams;e?.tab&&n.set("tab",e.tab),e?.limit&&n.set("limit",String(e.limit)),e?.offset&&n.set("offset",String(e.offset));let r=n.toString();return this.request("GET",`/v1/feed${r?"?"+r:""}`)}async feedVote(e,n){return this.request("POST",`/v1/feed/${encodeURIComponent(e)}/vote`,{direction:n})}async feedApprove(e){return this.request("POST",`/v1/feed/${encodeURIComponent(e)}/approve`)}async feedDelete(e){return this.request("DELETE",`/v1/feed/${encodeURIComponent(e)}`)}async feedPending(){return this.request("GET","/v1/feed/pending")}async submitFeedback(e,n,r){return this.request("POST","/v1/feedback",{message:e,...n&&{transaction_id:n}},void 0,r)}async getFeedback(e,n){let r=new URLSearchParams;e&&r.set("limit",String(e));let o=r.toString();return this.request("GET",`/v1/feedback${o?"?"+o:""}`,void 0,void 0,n)}async submitRatedFeedback(e){return this.request("POST","/v1/feedback",e)}};var HS=require("child_process"),tI=require("util"),nI=I(require("crypto")),Tt=I(require("fs")),rI=I(require("os")),or=I(require("path"));var Yt=I(require("fs")),BS=I(require("path")),zN=I(require("os")),VS=BS.join(zN.homedir(),".visa-mcp"),_c=BS.join(VS,"mcp-server.log"),y6=5*1024*1024,wS=null;function v6(){Yt.existsSync(VS)||Yt.mkdirSync(VS,{recursive:!0,mode:448})}function b6(){if(!wS){if(v6(),Yt.existsSync(_c)&&Yt.statSync(_c).size>y6){let e=_c+".1";Yt.existsSync(e)&&Yt.unlinkSync(e),Yt.renameSync(_c,e)}wS=Yt.createWriteStream(_c,{flags:"a"})}return wS}function L6(t){return t==="WARN"||t==="ERROR"?!0:process.env.VISA_CLI_DEBUG==="1"||process.env.VISA_VERBOSE==="1"}function $l(t,...e){let n=new Date().toISOString(),r=e.map(s=>typeof s=="string"?s:JSON.stringify(s,null,2)).join(" "),o=`[${n}] [${t}] ${r}
47
- `;L6(t)&&process.stderr.write(o),b6().write(o)}var di={debug:(...t)=>$l("DEBUG",...t),info:(...t)=>$l("INFO",...t),warn:(...t)=>$l("WARN",...t),error:(...t)=>$l("ERROR",...t)};var _i=(0,tI.promisify)(HS.execFile),Kl=or.join(rI.homedir(),".visa-mcp","bin"),ms=or.join(Kl,"Visa CLI"),D6=or.join(__dirname,"..","native"),JN="5",QN=or.join(Kl,"visa-keychain.version"),ZN=or.join(Kl,"visa-keychain.sha256");function eI(t){let e=Tt.readFileSync(t);return nI.createHash("sha256").update(e).digest("hex")}async function oI(){try{if(Tt.readFileSync(QN,"utf-8").trim()===JN&&Tt.existsSync(ms)){let r=Tt.readFileSync(ZN,"utf-8").trim();if(eI(ms)!==r)di.warn("binary:hash-mismatch",{message:"Binary hash mismatch \u2014 possible tampering detected. Recompiling from source."}),Tt.unlinkSync(ms);else return ms}}catch{}let t=or.join(D6,"visa-keychain.m");if(Tt.existsSync(t)||(t=or.resolve(__dirname,"..","..","native","visa-keychain.m")),Tt.existsSync(t)||(t=or.resolve(__dirname,"..","native","visa-keychain.m")),!Tt.existsSync(t))throw new Error("visa-keychain.m source not found. Reinstall Visa CLI.");Tt.mkdirSync(Kl,{recursive:!0,mode:448});try{await _i("clang",["-framework","Security","-framework","LocalAuthentication","-framework","Foundation","-framework","AppKit","-o",ms,t],{timeout:3e4})}catch(n){throw n.code==="ENOENT"?new Error("Xcode Command Line Tools required. Install: xcode-select --install"):n}let e=eI(ms);return Tt.writeFileSync(ZN,e,{mode:384}),Tt.writeFileSync(QN,JN,{mode:384}),ms}async function sI(t){let e=await oI(),n;try{n=(await _i(e,t,{timeout:6e4})).stdout}catch(s){n=s.stdout||"";let i=n.trim();throw i.startsWith("ERROR:")?new Error(i.slice(6)):new Error(s.stderr?.trim()||s.message||"Unknown error")}let r=n.trim();if(r.startsWith("OK:"))return r.slice(3);if(r==="OK")return;let o=r.startsWith("ERROR:")?r.slice(6):"Unknown error";throw new Error(o)}var GS=null;function mt(){return process.env.VISA_MOCK_TOUCHID==="true"?!0:process.platform!=="darwin"?!1:GS!==null?GS:(GS=!0,!0)}var Yl="visa-cli",ql="attestation-key";async function x6(t){try{await _i("security",["delete-generic-password","-s",Yl,"-a",ql],{timeout:5e3})}catch{}await _i("security",["add-generic-password","-s",Yl,"-a",ql,"-w",t],{timeout:5e3})}async function U6(){try{let{stdout:t}=await _i("security",["find-generic-password","-s",Yl,"-a",ql,"-w"],{timeout:5e3});return t.trim()||null}catch{return null}}async function Wl(){let t=await sI(["generate-key"]);if(!t)throw new Error("Key generation returned no output");let e=t.indexOf(":");if(e<0)throw new Error("Unexpected generate-key output format");let n=t.slice(0,e),r=t.slice(e+1);return await x6(n),r}async function Xl(t,e){if(process.env.VISA_MOCK_TOUCHID==="true")return Promise.resolve("mock-ecdsa-signature-for-testing");let n=await U6();if(!n)throw new Error("Attestation key not found. Run setup to generate a new key.");let r=await oI(),o=["sign",t];return e&&o.push(e),new Promise((s,i)=>{let a=(0,HS.execFile)(r,o,{timeout:6e4},(c,u)=>{let l=(u||"").trim();if(c){l.startsWith("ERROR:")?i(new Error(l.slice(6))):i(new Error(c.stderr?.trim()||c.message||"Unknown error"));return}l.startsWith("OK:")?s(l.slice(3)):i(new Error(l.startsWith("ERROR:")?l.slice(6):"Unknown error"))});a.stdin.write(n),a.stdin.end()})}async function iI(){try{await _i("security",["delete-generic-password","-s",Yl,"-a",ql],{timeout:5e3})}catch{}try{await sI(["delete-key"])}catch{}}var w6=["npm","pnpm","yarn","bun"],V6=/\s+/;function B6(){let t=process.env.npm_config_user_agent;if(!t)return;let e=t.trim();if(e==="")return;let n=e.split(V6)[0]??"",r=n.indexOf("/"),o=r===-1?n:n.slice(0,r);return w6.includes(o)?o:void 0}function Ei(t,e){let n=e??B6()??"npm",o=`@visa/cli@${t??"latest"}`;switch(n){case"npm":return`npm install -g ${o}`;case"pnpm":return`pnpm add -g ${o}`;case"yarn":return`yarn global add ${o}`;case"bun":return`bun add -g ${o}`}}function aI(t,e=process.stderr){if(rr()||!t?.updateAvailable)return!1;let{latestVersion:n}=t.updateAvailable;if(!n)return!1;let r=`Update available: v${n}. Run: ${Ei()}`;return e.write(`
48
- \x1B[33m\u2191 ${r}\x1B[0m
49
- `),!0}var G6=20;function uI(t,e,n,r){let o=r.currentVersion==="0.0.0"&&t.version?t.version:r.currentVersion,i=q6(t.spendingControls).dailyLimit,a=Math.max(0,fc(t.dailySpent)),c=i>0?Math.min(i,Math.max(0,fc(t.dailyRemaining??i-a))):0,u=i>0?Math.min(1,a/i):0,p=(Array.isArray(e)?e:[]).filter(F6),d=p.slice(0,3),_=j6(p,3),E=(t.cards??[]).slice(0,3),S=r.latestVersion?Ec(r.latestVersion):"",T=r.updateCheckDisabled?"update checks disabled":S?`update ready: v${S}`:"up to date",h=Math.round(u*100),R=fo(t.status,t.enrolled?"approved":"not enrolled"),N=["VISA CLI",`Status: ${t.enrolled?"Visa ready":"Visa setup needed"} | account: ${R} | touch id: ${n?"ready":"unavailable"}`,`Version: v${o} | ${T}`,`Spend meter: ${cI(u)} ${String(h).padStart(3," ")}% | remaining ${fi(c)}/day | daily cap ${fi(i)}`,"","Spend",` Remaining ${fi(c)} / ${fi(i)}`,` Usage ${cI(u)} ${h}%`,` Spent today ${fi(a)}`,` Attestation key ${t.hasAttestationKey?"registered":"missing"}`,"","Cards",...E.length>0?E.map(A=>` ${Y6(A)}`):[" No cards enrolled"],"","Last 3 services",..._.length>0?_.map((A,M)=>` ${M+1}. ${A}`):[" No paid services yet"],"","Recent receipts",...d.length>0?d.map(A=>` ${$6(A)}`):[" No receipts yet"]];if(S&&!r.updateCheckDisabled){let A=Ec(Ei(S));N.push("",`Update: v${S} ready \u2014 run \`${A}\``),r.updateMessage&&N.push(` ${Ec(r.updateMessage)}`)}else r.updateMessage&&N.push("",`Update: ${Ec(r.updateMessage)}`);return`${N.join(`
50
- `)}
51
- `}function H6(t){return t.tool_name!=null}function k6(t){return fc(t.amount)===0&&t.status==="failed"}function F6(t){return H6(t)&&!k6(t)}function j6(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 $6(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=K6(t.created_at);return`${r} ${o.padEnd(9)} ${e} [${n}] ${s}`}function Y6(t){let e=fo(t.brand?.toUpperCase(),"CARD"),n=t.isDefault?" default":"";return`${Number.isInteger(t.id)?`#${t.id} `:""}${e} ****${t.last4}${n}`}function q6(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 cI(t,e=G6){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 K6(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=I(require("fs")),Zl=I(require("os")),$e=I(require("path")),pI=require("child_process");var W6=2,zl="# >>> visa-cli shell hud v2 >>>",Jl="# <<< visa-cli shell hud v2 <<<",X6="# >>> visa-cli shell hud >>>",z6="# <<< visa-cli shell hud <<<",dI=3e4,J6={currentVersion:"0.0.0"},Q6=3e4;function YS(){try{return $e.join(mI(),".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 _I(){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=mI();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 Z6(t){let e="$HOME/.visa-cli/shell-hud.line",n=cJ(t),r=uJ(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}
52
38
  _visa_cli_shell_hud_precmd() {
53
39
  setopt localoptions no_bg_nice
54
- if [[ -f "${e}" ]]; then
55
- print -r -- "$(cat "${e}")"
40
+ if [[ -f "${t}" ]]; then
41
+ print -r -- "$(cat "${t}")"
56
42
  fi
57
43
  if ${r}; then
58
- 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 ' ')
59
45
  if [[ "\${_vhud_count:-0}" -lt 3 ]]; then
60
46
  ${n} &>/dev/null &!
61
47
  fi
@@ -65,13 +51,13 @@ autoload -Uz add-zsh-hook
65
51
  if [[ -z "\${precmd_functions[(r)_visa_cli_shell_hud_precmd]}" ]]; then
66
52
  add-zsh-hook precmd _visa_cli_shell_hud_precmd
67
53
  fi
68
- ${Jl}`;if(t==="powershell"){let o="(Join-Path $HOME '.visa-cli/shell-hud.line')";return`${zl}
54
+ ${Pr}`;if(e==="powershell"){let s="(Join-Path $HOME '.visa-cli/shell-hud.line')";return`${Vn}
69
55
  if (-not (Test-Path Function:\\global:__visa_cli_original_prompt)) {
70
56
  $function:global:__visa_cli_original_prompt = if (Test-Path Function:\\prompt) { $function:prompt } else { { '' } }
71
57
  }
72
58
  function global:prompt {
73
- if (Test-Path ${o}) {
74
- Write-Host (Get-Content ${o} -Raw)
59
+ if (Test-Path ${s}) {
60
+ Write-Host (Get-Content ${s} -Raw)
75
61
  }
76
62
  if (${r}) {
77
63
  # Reap any completed visa-hud jobs before starting a new one so the session
@@ -84,14 +70,14 @@ function global:prompt {
84
70
  }
85
71
  & $function:global:__visa_cli_original_prompt
86
72
  }
87
- ${Jl}`}return`${zl}
73
+ ${Pr}`}return`${Vn}
88
74
  __visa_cli_shell_hud_precmd() {
89
- if [ -f "${e}" ]; then
90
- cat "${e}"
75
+ if [ -f "${t}" ]; then
76
+ cat "${t}"
91
77
  fi
92
78
  if ${r}; then
93
79
  local _vhud_count
94
- _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 ' ')
95
81
  if [ "\${_vhud_count:-0}" -lt 3 ]; then
96
82
  ${n} &>/dev/null &
97
83
  fi
@@ -101,64 +87,94 @@ case ";$PROMPT_COMMAND;" in
101
87
  *";__visa_cli_shell_hud_precmd;"*) ;;
102
88
  *) PROMPT_COMMAND="__visa_cli_shell_hud_precmd\${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
103
89
  esac
104
- ${Jl}`}function EI(t){let e=t;for(let[n,r]of[[zl,Jl],[X6,z6]])e=e.replace(new RegExp(`\\n?${lI(n)}[\\s\\S]*?${lI(r)}\\n?`,"g"),"");return e.trimEnd()}function eJ(t,e){let n=EI(t).trimEnd(),r=Z6(e);return n.length>0?`${n}
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}
105
91
 
106
92
  ${r}
107
93
  `:`${r}
108
- `}function qS(t=tp()){if(!t)return{installed:!1,changed:!1,shell:null,message:"Shell HUD auto-install skipped: supported shells are zsh, bash, and PowerShell."};let e;try{e=np(t);let n=pe.existsSync(e)?pe.readFileSync(e,"utf-8"):"",r=eJ(n,t),o=r!==n;return o&&Ql(e,r),{installed:!0,changed:o,shell:t,rcPath:e,message:o?`Persistent shell HUD installed in ${e}. Open a new terminal to start seeing it. Disable it any time with: visa-cli shell-hud disable`:`Persistent shell HUD already installed in ${e}. Disable it any time with: visa-cli shell-hud disable`}}catch(n){return{installed:!1,changed:!1,shell:t,rcPath:e,message:`Failed to install persistent shell HUD in ${e}: ${hI(n)}`}}}function KS(t=tp()){if(!t)return{removed:!1,shell:null,message:"Shell HUD uninstall skipped: supported shells are zsh, bash, and PowerShell."};let e;try{if(e=np(t),!pe.existsSync(e))return{removed:!1,shell:t,rcPath:e,message:`No ${t} rc file found at ${e}.`};let n=pe.readFileSync(e,"utf-8"),r=EI(n);return r===n.trimEnd()?{removed:!1,shell:t,rcPath:e,message:`Persistent shell HUD was not installed in ${e}.`}:(Ql(e,r.length>0?`${r}
109
- `:""),{removed:!0,shell:t,rcPath:e,message:`Removed persistent shell HUD from ${e}.`})}catch(n){return{removed:!1,shell:t,rcPath:e,message:`Failed to remove persistent shell HUD from ${e}: ${hI(n)}`}}}function WS(t,e){let n=e??J6,r=n.currentVersion==="0.0.0"&&t.version?t.version:n.currentVersion,o=Si(r),s=` ${qt("\u2502",Dt.dim)} `,i=fI(n),a=nJ(n,i),c=a||n.updateCheckDisabled?"":i,u=tJ(o,c);if(!t.enrolled)return[u,qt("setup needed",Dt.visaGold),a].filter(Boolean).join(s);let l=FS(t.spendingControls?.daily_limit??t.spendingControls?.dailyLimit),p=Math.max(0,FS(t.dailySpent)),d=l>0?Math.min(l,Math.max(0,FS(t.dailyRemaining??l-p))):0,_=l>0?Math.max(0,Math.min(1,p/l)):0,E=iJ(t),S=l>0?`${sJ(_)} ${qt(`${jS(d)} left today`,Dt.green)} ${qt(`(${jS(p)}/${jS(l)}/day)`,Dt.dim)}`:qt("no spend limit",Dt.dim);return[u,qt(E,Dt.visaGold),S,a].filter(Boolean).join(s)}function tJ(t,e){let n=`${qt("VISA CLI",Dt.visaBlue)} ${qt(`v${t}`,Dt.visaBlueSoft)}`;return e?`${n} ${qt("\u2B06 update",Dt.visaGold)} ${qt(`v${e}`,Dt.visaGold)}`:n}function nJ(t,e){if(e&&!t.updateCheckDisabled){let n=Si(Ei(e));return qt(`run: ${n}`,Dt.visaGold)}return e?null:rJ(t)}function fI(t){return t.latestVersion?Si(t.latestVersion):""}function rJ(t){let e=fI(t);return e?qt(`update ready v${e}`,Dt.visaGold):null}function SI(){let t=TI();return!(!t||Date.now()-t.renderedAt>dI||t.cwd&&t.cwd!==process.cwd())}function XS(){let t=TI();if(t&&Date.now()-t.renderedAt<=dI||(oJ(),t?.line))return t.line;try{let e=ep();if(pe.existsSync(e))return pe.readFileSync(e,"utf-8").trimEnd()}catch{}return"VISA | loading spend HUD\u2026"}function zS(t){try{let e=$e.dirname(Tc());pe.mkdirSync(e,{recursive:!0});let n=Si(t),r={hudVersion:W6,renderedAt:Date.now(),line:n,cwd:process.cwd()};Ql(Tc(),JSON.stringify(r)+`
110
- `),Ql(ep(),n+`
111
- `)}catch{}}function Sc(){try{pe.unlinkSync(_I())}catch{}}function TI(){let t=Tc();if(!pe.existsSync(t))return null;try{return JSON.parse(pe.readFileSync(t,"utf-8"))}catch{return null}}function oJ(){if(process.env.JEST_WORKER_ID)return;let t=_I();try{if(pe.mkdirSync($e.dirname(t),{recursive:!0}),!lJ(t))return;let e=process.argv[1]?$e.resolve(process.argv[1]):"";if(!e){Sc();return}let n=(0,pI.spawn)(process.execPath,[e,"shell-hud","refresh"],{detached:!0,stdio:"ignore",env:{...process.env,VISA_CLI_SHELL_HUD_BACKGROUND:"1"}});n.once("error",Sc),n.unref()}catch{Sc()}}function FS(t){let e=Number(typeof t=="string"?t:t??0);return Number.isFinite(e)?e:0}function Si(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," ").trim()}function sJ(t){let n=Math.round(Math.max(0,Math.min(1,t))*10),r="\u2588".repeat(n),o="\u2591".repeat(10-n);return`${qt(r||"",Dt.green)}${qt(o||"",Dt.dim)}`}function jS(t){return`$${t.toFixed(2)}`}function iJ(t){let e=t.cards?.find(a=>a.isDefault)??t.cards?.[0];if(!e)return"card none";let n=typeof e.brand=="string"?e.brand:"card",r=typeof e.last4=="string"?e.last4:"????",o=Si(n.toUpperCase()),s=Si(r);return`${e.isDefault?"default":"active"} ${o} ****${s}`}function aJ(){let t=(process.env.COLORTERM??"").toLowerCase();if(t==="truecolor"||t==="24bit")return!0;let e=(process.env.TERM??"").toLowerCase();return e.includes("truecolor")||e.includes("24bit")}var $S=aJ(),Dt={reset:"\x1B[0m",visaBlue:$S?"\x1B[38;2;20;52;203m":"\x1B[38;5;27m",visaBlueSoft:$S?"\x1B[38;2;97;126;229m":"\x1B[38;5;111m",visaGold:$S?"\x1B[38;2;247;182;0m":"\x1B[38;5;220m",green:"\x1B[38;5;48m",dim:"\x1B[2m"};function qt(t,e){return t.length===0||process.env.NO_COLOR?t:`${e}${t}${Dt.reset}`}function lI(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mI(){let t=Zl.homedir();if(!t||!$e.isAbsolute(t))throw new Error("unable to determine a valid home directory");return $e.resolve(t)}function cJ(t){return t==="powershell"?"& visa-cli shell-hud refresh":"visa-cli shell-hud refresh"}function uJ(t){return t==="powershell"?"Get-Command visa-cli -ErrorAction SilentlyContinue -CommandType Application":"command -v visa-cli >/dev/null 2>&1"}function lJ(t){for(let e=0;e<2;e+=1){let n;try{return n=pe.openSync(t,"wx"),pe.writeFileSync(n,String(Date.now())),!0}catch(r){if(r?.code!=="EEXIST")return!1;try{let o=pe.statSync(t);if(Date.now()-o.mtimeMs<=Q6)return!1;pe.unlinkSync(t)}catch{}}finally{n!==void 0&&pe.closeSync(n)}}return!1}function hI(t){return t instanceof Error?t.message:"unknown file system error"}function Ql(t,e){pe.mkdirSync($e.dirname(t),{recursive:!0});let n=`${t}.${process.pid}.${Date.now()}.tmp`;pe.writeFileSync(n,e),pe.renameSync(n,t)}async function rp(t,e){try{return await e()}catch(n){if(n.message==="Invalid signature"&&mt()){di.warn("attestation:key-mismatch",{action:"reregistering"});try{let r=await Wl();await t.registerAttestationKey(r),di.info("attestation:key-reregistered")}catch(r){throw di.error("attestation:reregister-failure",{error:r.message}),n}return await e()}throw n}}function pJ(t=process.env){let e=t.VISA_DRY_RUN;return e==="true"||e==="1"||e==="mock"?"mock":e==="preflight"?"preflight":null}function gI(t=process.env){return pJ(t)!==null}var AI="2.0.0-rc.9";function JS(t,e){return e?{kind:"env",var:t}:{kind:"default"}}function dJ(t,e,n){let r=process.env[t];if(r!==void 0&&r!=="")return{value:r,source:{kind:"env",var:t}};let o=US(e);return o!==void 0?{value:o,source:{kind:"settings"}}:{value:n,source:{kind:"default"}}}function mc(t,e,n){let r=process.env[t];if(r!==void 0)return{value:n==="opt-in"?r==="true":r!=="false",source:{kind:"env",var:t}};let o=FN(e);return o!==void 0?{value:o,source:{kind:"settings"}}:{value:n!=="opt-in",source:{kind:"default"}}}function Kt(t){return t==null?"\u2014":t?"yes":"no"}function op(t){return t==null?"\u2014":`$${t.toFixed(2)}`}async function RI(t){let e=null,n=null;try{e=await t.api.getStatus()}catch(O){n=O?.message||"unknown error"}let r=[],o=dJ("VISA_AUTH_URL","auth.serverUrl","https://auth.visacli.sh");r.push({key:"auth.serverUrl",value:o.value,formatted:o.value,source:o.source,hint:o.source.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:e?.enrolled??null,formatted:Kt(e?.enrolled),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),e?.githubUser&&r.push({key:"account.githubUser",value:e.githubUser,formatted:e.githubUser,source:{kind:"server"}});let s=e?e.attestationRequired!==!1:void 0;r.push({key:"biometric.required",value:s,formatted:Kt(s),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"},hint:s===!1?"Touch ID prompts are suppressed. Re-enable with `visa-cli biometric on`.":void 0}),r.push({key:"biometric.keyRegistered",value:e?.hasAttestationKey??null,formatted:Kt(e?.hasAttestationKey),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"biometric.deviceAvailable",value:mt(),formatted:Kt(mt()),source:{kind:"device"}});let i=e?.spendingControls,a=i?i.max_transaction_amount??i.maxTransactionAmount??null:null,c=i?i.daily_limit??i.dailyLimit??null:null;r.push({key:"spending.maxPerTxn",value:a,formatted:op(a),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailyLimit",value:c,formatted:op(c),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailySpent",value:e?.dailySpent??null,formatted:op(e?.dailySpent),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"spending.dailyRemaining",value:e?.dailyRemaining??null,formatted:op(e?.dailyRemaining),source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}}),r.push({key:"cards.count",value:e?.cardCount??null,formatted:e?.cardCount!=null?String(e.cardCount):"\u2014",source:e?{kind:"server"}:{kind:"unknown",reason:n||"offline"}});let u=e?.cards?.find(O=>O.isDefault)??e?.cards?.[0];u&&r.push({key:"cards.default",value:{brand:u.brand??null,last4:u.last4},formatted:`${u.brand||"card"} \u2022\u2022\u2022\u2022 ${u.last4}`,source:{kind:"server"}});let l=mc("VISA_SUPPRESS_BROWSER","ui.suppressBrowser","opt-in");r.push({key:"ui.suppressBrowser",value:l.value,formatted:Kt(l.value),source:l.source,hint:"Persist with `visa-cli config set ui.suppressBrowser true` to stop auto-opening result URLs."});let p=mc("VISA_SUPPRESS_FEED","ui.suppressFeed","opt-in");r.push({key:"ui.suppressFeed",value:p.value,formatted:Kt(p.value),source:p.source});let d=rr(),_;process.env.VISA_CLI_NO_UPDATE_CHECK?_={kind:"env",var:"VISA_CLI_NO_UPDATE_CHECK"}:process.env.CI?_={kind:"env",var:"CI"}:process.env.NODE_ENV==="test"?_={kind:"env",var:"NODE_ENV"}:_={kind:"default"},r.push({key:"ui.updateCheck",value:!d,formatted:Kt(!d),source:_});let E=mc("VISA_META_TOOLS","tools.meta","opt-out");r.push({key:"tools.meta",value:E.value,formatted:Kt(E.value),source:E.source,hint:"Persist with `visa-cli config set tools.meta false`. Restart Claude Code for changes to take effect."});let S=mc("VISA_SPECIFIC_TOOLS","tools.specific","opt-in");r.push({key:"tools.specific",value:S.value,formatted:Kt(S.value),source:S.source});let T=mc("VISA_DISCOVER_TOOLS","tools.discover","opt-out");r.push({key:"tools.discover",value:T.value,formatted:Kt(T.value),source:T.source});let h=process.env.VISA_DRY_RUN,R=gI();if(r.push({key:"tools.dryRun",value:R,formatted:Kt(R),source:h===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:AI,formatted:AI,source:{kind:"default"}}),t.includeDev){let O=process.env.VISA_MOCK_KEYCHAIN;r.push({key:"dev.mockKeychain",value:O==="true",formatted:Kt(O==="true"),source:JS("VISA_MOCK_KEYCHAIN",!!O)});let N=process.env.VISA_MOCK_TOUCHID;r.push({key:"dev.mockTouchid",value:N==="true",formatted:Kt(N==="true"),source:JS("VISA_MOCK_TOUCHID",!!N)});let A=process.env.VISA_CLI_DEBUG;r.push({key:"dev.debug",value:!!A,formatted:Kt(!!A),source:JS("VISA_CLI_DEBUG",!!A)})}return{entries:r,statusError:n}}function _J(t){switch(t.kind){case"default":return"default";case"env":return`env ${t.var}`;case"settings":return"settings.json";case"server":return"server";case"device":return"device";case"unset":return"unset";case"unknown":return`unknown (${t.reason})`}}function OI(t,e={}){if(t.length===0)return"";let n=Math.max(...t.map(s=>s.key.length)),r=Math.max(...t.map(s=>s.formatted.length)),o=[];for(let s of t){let i=s.key.padEnd(n+2),a=s.formatted.padEnd(r+2);o.push(`${i}${a}(${_J(s.source)})`),e.verbose&&s.hint&&o.push(` ${"\u21B3".padStart(n)} ${s.hint}`)}return o.join(`
112
- `)}function NI(t){return JSON.stringify({config:t.entries.map(e=>({key:e.key,value:e.value,source:e.source,hint:e.hint})),statusError:t.statusError},null,2)}var Wt=class extends Error{constructor(e){super(e),this.name="PayValidationError"}},II=["GET","POST"];function CI(t){let e;try{e=new URL(t)}catch{throw new Wt(`Invalid URL: ${t}. Expected a fully-qualified http(s) URL.`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Wt(`Unsupported URL scheme "${e.protocol}". Only http and https are allowed.`);return e}function PI(t){let e=(t??"GET").toUpperCase();if(!II.includes(e))throw new Wt(`Unsupported HTTP method "${t}". Supported: ${II.join(", ")}.`);return e}function MI(t){if(t!==void 0){try{JSON.parse(t)}catch(e){throw new Wt(`--body is not valid JSON: ${e?.message??"parse error"}`)}return t}}function yI(t){if(!t||typeof t!="object")throw new Wt("Merchant returned no payment preview.");let e=t;if(typeof e.amount!="number"||!Number.isFinite(e.amount)||e.amount<=0)throw new Wt("Could not determine payment amount from merchant.");if(typeof e.merchantName!="string"||e.merchantName.trim().length===0)throw new Wt("Merchant returned an empty merchant name.");if(e.merchantName.length>200)throw new Wt(`Merchant name too long (${e.merchantName.length} chars).`);if(typeof e.currency!="string"||e.currency.trim().length===0)throw new Wt("Merchant returned an empty currency.");if(e.currency.length>10)throw new Wt(`Currency code too long (${e.currency.length} chars).`);return{amount:e.amount,currency:e.currency,merchantName:e.merchantName}}var re=I(require("fs")),z=I(require("path")),vI=I(require("os")),Ve=vI.homedir(),EJ=["Claude_","Anthropic.ClaudeDesktop_"],Ti=class extends Error{constructor(n,r,o){super(SJ(n,r,o));this.client=n;this.configPath=r;this.name="McpConfigAccessError"}client;configPath};function bI(t){let e=t;return[e?.message,e?.stderr].filter(n=>typeof n=="string").join(`
113
- `)}function fJ(t){let e=t;if(e?.code==="EPERM"||e?.code==="EACCES")return!0;let n=bI(t).toLowerCase();return n.includes("operation not permitted")||n.includes("permission denied")}function SJ(t,e,n){let r=e.replace(Ve,"~"),o=bI(n).split(`
114
- `).find(Boolean),s=o?` (${o})`:"";return t.id==="codex"?`Could not update Codex MCP config at ${r}: filesystem access was denied${s}. In Codex, rerun with elevated filesystem access or run \`visa-cli install codex\` outside the sandbox.`:`Could not update ${t.displayName} MCP config at ${r}: filesystem access was denied${s}.`}function hc(){return process.env.APPDATA||z.join(Ve,"AppData","Roaming")}function TJ(){return process.env.LOCALAPPDATA||z.join(Ve,"AppData","Local")}function QS(t){return process.platform==="win32"?t.win32:t.posix}function LI(){if(process.platform!=="win32")return;let t=z.join(TJ(),"Packages");if(re.existsSync(t))try{let e=re.readdirSync(t,"utf-8");for(let n of EJ){let r=e.filter(o=>o.startsWith(n)).sort()[0];if(r)return z.join(t,r,"LocalCache","Roaming","Claude")}}catch{return}}function DI(){if(process.platform==="win32"){let t=LI();return t?z.join(t,"claude_desktop_config.json"):z.join(hc(),"Claude","claude_desktop_config.json")}return z.join(Ve,"Library","Application Support","Claude","claude_desktop_config.json")}function xI(){if(process.platform!=="win32")return[z.join(Ve,"Library","Application Support","Claude")];let t=[z.join(hc(),"Claude")],e=LI();return e&&t.push(e),t}function sp(t){return t.id==="claude-desktop"?DI():t.globalConfigPath}function mJ(t){return t.id==="claude-desktop"?xI():t.detectPaths}var Vn=[{id:"claude",displayName:"Claude Code",globalConfigPath:z.join(Ve,".claude.json"),configKey:"mcpServers",detectPaths:[z.join(Ve,".claude.json")],postInstallHint:"Restart Claude Code or run /mcp to connect."},{id:"claude-desktop",displayName:"Claude Desktop",globalConfigPath:DI(),configKey:"mcpServers",detectPaths:xI(),postInstallHint:"Restart the Claude desktop app to connect."},{id:"cursor",displayName:"Cursor",globalConfigPath:z.join(Ve,".cursor","mcp.json"),configKey:"mcpServers",detectPaths:[z.join(Ve,".cursor")],postInstallHint:"Restart Cursor to connect."},{id:"windsurf",displayName:"Windsurf",globalConfigPath:z.join(Ve,".codeium","windsurf","mcp_config.json"),configKey:"mcpServers",detectPaths:[z.join(Ve,".codeium","windsurf")],postInstallHint:"Restart Windsurf to connect."},{id:"cline",displayName:"Cline",globalConfigPath:z.join(Ve,".vscode","mcp.json"),configKey:"mcpServers",detectPaths:[z.join(Ve,".vscode","extensions","saoudrizwan.claude-dev-*")],postInstallHint:"Restart VS Code to connect."},{id:"roo-code",displayName:"Roo Code",globalConfigPath:QS({win32:z.join(hc(),"Roo","mcp_settings.json"),posix:z.join(Ve,".config","Roo","mcp_settings.json")}),configKey:"mcpServers",detectPaths:[z.join(Ve,".vscode","extensions","RooVeterinaryInc.roo-cline-*")],postInstallHint:"Restart VS Code to connect."},{id:"copilot",displayName:"VS Code Copilot",globalConfigPath:z.join(Ve,".vscode","mcp.json"),configKey:"servers",detectPaths:[z.join(Ve,".vscode")],postInstallHint:"Restart VS Code to connect."},{id:"zed",displayName:"Zed",globalConfigPath:QS({win32:z.join(hc(),"Zed","settings.json"),posix:z.join(Ve,".config","zed","settings.json")}),configKey:"context_servers",detectPaths:QS({win32:[z.join(hc(),"Zed")],posix:[z.join(Ve,".config","zed")]}),postInstallHint:"Restart Zed to connect.",buildEntry:t=>({source:"custom",...t})},{id:"codex",displayName:"Codex",globalConfigPath:z.join(Ve,".codex","config.toml"),configKey:"mcp_servers",configFormat:"toml",detectPaths:[z.join(Ve,".codex")],postInstallHint:"Restart Codex to connect. For the terminal HUD, run: visa-cli hud enable codex"}];function ZS(t){return Vn.find(e=>e.id===t)}function gc(t){return mJ(t).some(e=>{if(e.includes("*")){let n=z.dirname(e),r=z.basename(e).replaceAll("*","");if(!re.existsSync(n))return!1;try{return re.readdirSync(n).some(o=>o.startsWith(r))}catch{return!1}}return re.existsSync(e)})}function UI(){return{command:"node",args:[z.resolve(__dirname,"mcp-server/index.js")]}}function eT(t,e){return e==="project"?"json":t.configFormat??"json"}function hJ(t){if(t=t.trim(),t==="true")return!0;if(t==="false")return!1;if(t.startsWith('"')&&t.endsWith('"'))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]")){let n=t.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 e=Number(t);return isNaN(e)?t:e}function tT(t,e){let n=`[mcp_servers.${e}]`,r=t.findIndex(s=>s.trim()===n);if(r===-1)return;let o=r+1;for(;o<t.length&&!t[o].trim().startsWith("[");)o++;return{start:r,end:o}}function nT(t,e){let n=t.split(`
115
- `),r=tT(n,e);if(!r)return;let o={};for(let s=r.start+1;s<r.end;s++){let i=n[s].trim().match(/^(\w+)\s*=\s*(.+)$/);i&&(o[i[1]]=hJ(i[2]))}return Object.keys(o).length>0?o:void 0}function gJ(t,e,n){let r=`[${n.args.map(c=>`"${c}"`).join(", ")}]`,o=[`[mcp_servers.${e}]`,`command = "${n.command}"`,`args = ${r}`],s=t.split(`
116
- `),i=tT(s,e);if(i){s.splice(i.start,i.end-i.start,...o);let c=s.join(`
117
- `);return c.endsWith(`
118
- `)?c:c+`
119
- `}let a=t.trimEnd();return a+(a.length>0?`
120
-
121
- `:"")+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(`
122
143
  `)+`
123
- `}function AJ(t,e){let n=t.split(`
124
- `),r=tT(n,e);return r?(n.splice(r.start,r.end-r.start),n.join(`
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(`
125
146
  `).replace(/\n{3,}/g,`
126
147
 
127
- `)):t}function Ac(t,e="global"){let n=e==="project"?z.join(process.cwd(),".mcp.json"):sp(t);try{let r=z.dirname(n);re.existsSync(r)||re.mkdirSync(r,{recursive:!0});let o=eT(t,e),s=UI();if(o==="toml"){let i=re.existsSync(n)?re.readFileSync(n,"utf-8"):"",a=gJ(i,"visa-cli",s);re.writeFileSync(n,a)}else{let i={};if(re.existsSync(n))try{i=JSON.parse(re.readFileSync(n,"utf-8"))}catch{i={}}i[t.configKey]=i[t.configKey]||{},i[t.configKey]["visa-cli"]=t.buildEntry?t.buildEntry(s):s,re.writeFileSync(n,JSON.stringify(i,null,2)+`
128
- `)}}catch(r){throw fJ(r)?new Ti(t,n,r):r}return{installed:!0,configPath:n,message:t.postInstallHint}}function rT(t,e="global"){let n=e==="project"?z.join(process.cwd(),".mcp.json"):sp(t);if(!re.existsSync(n))return{removed:!1,configPath:n};if(eT(t,e)==="toml"){let i=re.readFileSync(n,"utf-8");return nT(i,"visa-cli")?(re.writeFileSync(n,AJ(i,"visa-cli")),{removed:!0,configPath:n}):{removed:!1,configPath:n}}let o;try{o=JSON.parse(re.readFileSync(n,"utf-8"))}catch{return{removed:!1,configPath:n}}let s=o[t.configKey];return!s||!s["visa-cli"]?{removed:!1,configPath:n}:(delete s["visa-cli"],re.writeFileSync(n,JSON.stringify(o,null,2)+`
129
- `),{removed:!0,configPath:n})}function wI(t,e="global"){let n=e==="project"?z.join(process.cwd(),".mcp.json"):sp(t);if(!re.existsSync(n))return!1;if(eT(t,e)==="toml")try{let o=re.readFileSync(n,"utf-8");return!!nT(o,"visa-cli")}catch{return!1}try{return!!JSON.parse(re.readFileSync(n,"utf-8"))?.[t.configKey]?.["visa-cli"]}catch{return!1}}function RJ(t){if(!t||typeof t!="object")return;let e=t;if(e.command!=="node"||!Array.isArray(e.args)||e.args.length===0)return;let n=e.args[e.args.length-1];if(!(typeof n!="string"||n.length===0))return n}function OJ(t,e){if(t===e)return!0;let n=z.resolve(t),r=z.resolve(e);if(n===r)return!0;try{let o=re.realpathSync(n),s=re.realpathSync(r);return o===s}catch{return!1}}function Rc(){let t=UI(),e=t.args[t.args.length-1],n=[];for(let r of Vn){let o=sp(r);if(!re.existsSync(o))continue;let s=r.configFormat??"json",i;if(s==="toml")try{let u=re.readFileSync(o,"utf-8");i=nT(u,"visa-cli")}catch{continue}else{let u;try{u=JSON.parse(re.readFileSync(o,"utf-8"))}catch{continue}i=u?.[r.configKey]?.["visa-cli"]}if(!i)continue;let a=RJ(i);if(!a||OJ(a,e))continue;let c=re.existsSync(a)?"mismatch":"missing";n.push({client:r,configPath:o,currentPath:a,expectedPath:e,staleReason:c})}return n}function oT(t){return{configPath:Ac(t.client,"global").configPath}}y();var l2=I(F1(),1);var D=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var j=globalThis;var Ee="9.47.1";function Bt(){return Io(j),j}function Io(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Ee,e[Ee]=e[Ee]||{}}function Hr(t,e,n=j){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[Ee]=r[Ee]||{};return o[t]||(o[t]=e())}var ou=["debug","info","warn","error","log","assert","trace"],CEe="Sentry Logger ",Fi={};function be(t){if(!("console"in j))return t();let e=j.console,n={},r=Object.keys(Fi);r.forEach(o=>{let s=Fi[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function PEe(){Hh().enabled=!0}function MEe(){Hh().enabled=!1}function j1(){return Hh().enabled}function yEe(...t){Gh("log",...t)}function vEe(...t){Gh("warn",...t)}function bEe(...t){Gh("error",...t)}function Gh(t,...e){D&&j1()&&be(()=>{j.console[t](`${CEe}[${t}]:`,...e)})}function Hh(){return D?Hr("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var m={enable:PEe,disable:MEe,isEnabled:j1,log:yEe,warn:vEe,error:bEe};var $1=/\(error: (.*)\)/,Y1=/captureMessage|captureException/;function e_(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
130
- `);for(let a=r;a<i.length;a++){let c=i[a];if(c.length>1024)continue;let u=$1.test(c)?c.replace($1,"$1"):c;if(!u.match(/\S*Error: /)){for(let l of e){let p=l(u);if(p){s.push(p);break}}if(s.length>=50+o)break}}return q1(s.slice(o))}}function Fh(t){return Array.isArray(t)?e_(...t):t}function q1(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(Zd(e).function||"")&&e.pop(),e.reverse(),Y1.test(Zd(e).function||"")&&(e.pop(),Y1.test(Zd(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||Zd(e).filename,function:n.function||"?"}))}function Zd(t){return t[t.length-1]||{}}var kh="<anonymous>";function su(t){try{return!t||typeof t!="function"?kh:t.name||kh}catch{return kh}}var t_={},K1={};function ji(t,e){t_[t]=t_[t]||[],t_[t].push(e)}function $i(t,e){if(!K1[t]){K1[t]=!0;try{e()}catch(n){D&&m.error(`Error while instrumenting ${t}`,n)}}}function Yi(t,e){let n=t&&t_[t];if(n)for(let r of n)try{r(e)}catch(o){D&&m.error(`Error while triggering instrumentation handler.
131
- Type: ${t}
132
- Name: ${su(r)}
133
- Error:`,o)}}var jh=null;function W1(t){let e="error";ji(e,t),$i(e,LEe)}function LEe(){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 X1(t){let e="unhandledrejection";ji(e,t),$i(e,DEe)}function DEe(){$h=j.onunhandledrejection,j.onunhandledrejection=function(t){return Yi("unhandledrejection",t),$h?$h.apply(this,arguments):!0},j.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var z1=Object.prototype.toString;function Co(t){switch(z1.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 z1.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 xEe=j,UEe=80;function J1(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||UEe;for(;n&&s++<r&&(u=wEe(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 wEe(t,e){let n=t,r=[];if(!n?.tagName)return"";if(xEe.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 Q1(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=>Q1(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"&&tV(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 tV(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,...eV(t)};if(qh(t)){let e={type:t.type,target:Z1(t.target),currentTarget:Z1(t.currentTarget),...eV(t)};return typeof CustomEvent<"u"&&dr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Z1(t){try{return Kh(t)?J1(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function eV(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 VEe(){let t=j;return t.crypto||t.msCrypto}function Je(t=VEe()){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 nV(t){return t.exception?.values?.[0]}function yo(t){let{message:e,event_id:n}=t;if(e)return e;let r=nV(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=nV(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 BEe=/^(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(BEe)||[],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(GEe(t))return!0;try{qe(t,"__sentry_captured__",!0)}catch{}return!1}function GEe(t){try{return t.__sentry_captured__}catch{}}var oV=1e3;function Fr(){return Date.now()/oV}function HEe(){let{performance:t}=j;if(!t?.now||!t.timeOrigin)return Fr;let e=t.timeOrigin;return()=>(e+t.now())/oV}var rV;function vo(){return(rV??(rV=HEe()))()}function sV(t){let e=vo(),n={sid:Je(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>kEe(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 iV(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),jr(t,n)}function kEe(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 FEe=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:FEe;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 jEe(t){return zi().withScope(t)}function $Ee(t,e){let n=zi();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function aV(t){return zi().withScope(()=>t(zi().getIsolationScope()))}function cV(){return{withIsolationScope:aV,withScope:jEe,withSetScope:$Ee,withSetIsolationScope:(t,e)=>aV(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:cV()}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 uV="_sentryScope",lV="_sentryIsolationScope";function cu(t,e,n){t&&(qe(t,lV,n),qe(t,uV,e))}function Yn(t){return{scope:t[uV],isolationScope:t[lV]}}var uu="sentry-",dV=/^sentry-/,_V=8192;function Lo(t){let e=xs(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.match(dV)){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=pV(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):pV(t)}function pV(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>_V?(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 EV(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=EV(t),r=Lo(e);if(!n?.traceId)return{traceId:Fn(),sampleRand:Math.random()};let o=YEe(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 YEe(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,fV=!1;function TV(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"?SV(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?SV(t.getTime()):vo()}function SV(t){return t>9999999999?t/1e3:t}function H(t){if(WEe(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(KEe(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 KEe(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function WEe(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(){fV||(be(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),fV=!0)}var mV=!1;function hV(){if(mV)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",mV=!0,W1(t),X1(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 XEe=/^o(\d+)\./,zEe=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function JEe(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 QEe(t){let e=zEe.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 gV({host:s,pass:o,path:c,projectId:u,port:i,protocol:n,publicKey:r})}function gV(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function ZEe(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+$/)?JEe(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 AV(t){return t.match(XEe)?.[1]}function RV(t){let e=typeof t=="string"?QEe(t):gV(t);if(!(!e||!ZEe(e)))return e}var OV="_frozenDsc";function E_(t,e){qe(t,OV,e)}function Eg(t,e){let n=e.getOptions(),{publicKey:r,host:o}=e.getDsn()||{},s;n.orgId?s=String(n.orgId):o&&(s=AV(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[OV];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 rfe(r)>n?Sg(t,e-1,n):r}function fg(t,e,n=1/0,r=1/0,o=ofe()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=efe(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 efe(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=tfe(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function tfe(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function nfe(t){return~-encodeURI(t).split(/%..|./).length}function rfe(t){return nfe(JSON.stringify(t))}function ofe(){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(`
134
- ${JSON.stringify(i)}
135
- `),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Wn(a))}o(c)}}return typeof r=="string"?r:sfe(r)}function sfe(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function hg(t){return[{type:"span"},t]}function gg(t){let e=typeof t.data=="string"?Tg(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var ife={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function S_(t){return ife[t]}function T_(t){if(!t?.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function Ag(t,e,n,r){let o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Kn(r)},...o&&{trace:o}}}function afe(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function NV(t,e,n,r){let o=T_(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:Kn(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ln(s,[i])}function IV(t,e,n,r){let o=T_(n),s=t.type&&t.type!=="replay_event"?t.type:"event";afe(t,n?.sdk);let i=Ag(t,o,r,e);return delete t.sdkProcessingMetadata,ln(i,[[{type:s},t]])}function CV(t,e){function n(l){return!!l.trace_id&&!!l.public_key}let r=He(t[0]),o=e?.getDsn(),s=e?.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&o&&{dsn:Kn(o)}},a=e?.getOptions().beforeSendSpan,c=a?l=>{let p=H(l),d=a(p);return d||(du(),p)}:H,u=[];for(let l of t){let p=c(l);p&&u.push(hg(p))}return ln(i,u)}function Eu(t){if(!D)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=H(t),{spanId:o}=t.spanContext(),s=Tr(t),i=Le(t),a=i===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&u.push(`parent ID: ${r}`),!a){let{op:l,description:p}=H(i);u.push(`root ID: ${i.spanContext().spanId}`),l&&u.push(`root op: ${l}`),p&&u.push(`root description: ${p}`)}m.log(`${c}
136
- ${u.join(`
137
- `)}`)}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 PV=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=MV(n)?n:r||vo(),s=MV(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?ufe(CV([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(!yV(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&&!cfe(l)).map(l=>H(l)).filter(yV),i=this._attributes[Qe];delete this._attributes[Sr],s.forEach(l=>{delete l.data[Sr]});let a={contexts:{trace:TV(this)},spans:s.length>PV?s.sort((l,p)=>l.start_timestamp-p.start_timestamp).slice(0,PV):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 MV(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function yV(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function cfe(t){return t instanceof na&&t.isStandaloneSpan()}function ufe(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 lfe(r,e,n)}function lfe(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=LV(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return fr(a,()=>xV(s)(()=>{let u=J(),l=DV(u,s),d=t.onlyIfParent&&!l?new Vs:bV({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=LV(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return fr(a,()=>xV(s)(()=>{let u=J(),l=DV(u,s),d=t.onlyIfParent&&!l?new Vs:bV({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 bV({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=pfe(t,r,e),ea(t,s);else if(t){let i=He(t),{traceId:a,spanId:c}=t.spanContext(),u=Tr(t);s=vV({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=vV({traceId:i,parentSpanId:c,...e},r,u),a&&E_(s,a)}return Eu(s),cu(s,r,o),s}function LV(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 vV(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 pfe(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 DV(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 xV(t){return t!==void 0?e=>mu(t,e):e=>e()}var Rg=0,UV=1,wV=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===UV&&n[1](this._value),this._state===wV&&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(UV,s)},o=s=>{n(wV,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 VV(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;dfe(t,e),r&&ffe(t,r),Sfe(t,n),_fe(t,o),Efe(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 dfe(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 _fe(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Efe(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function ffe(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 Sfe(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_,BV,I_;function GV(t){let e=j._sentryDebugIds;if(!e)return{};let n=Object.keys(e);return I_&&n.length===BV||(BV=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 HV(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);Tfe(c,t),gfe(c,u),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&mfe(c,t.stackParser);let l=Rfe(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=_),VV(c,d);let E=[...p,...d.eventProcessors];return R_(E,c,n).then(T=>(T&&hfe(T),typeof i=="number"&&i>0?Afe(T,i,a):T))}function Tfe(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 mfe(t,e){let n=GV(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function hfe(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 gfe(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Afe(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 Rfe(t,e){if(!e)return t;let n=t?t.clone():new zt;return n.update(e),n}function kV(t){if(t)return Ofe(t)?{captureContext:t}:Ife(t)?{captureContext:t}:t}function Ofe(t){return t instanceof zt||typeof t=="function"}var Nfe=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Ife(t){return Object.keys(t).some(e=>Nfe.includes(e))}function Gt(t,e){return J().captureException(t,kV(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=sV({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&&iV(n),Cfe(),t.setSession()}function Cfe(){let t=ce(),e=G(),n=t.getSession();n&&e&&e.captureSession(n)}var Pfe="7";function Mfe(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function yfe(t){return`${Mfe(t)}${t.projectId}/envelope/`}function vfe(t,e){let n={sentry_version:Pfe};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function FV(t,e,n){return e||`${yfe(t)}?${vfe(t,n)}`}var jV=[];function bfe(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 bfe(r)}function $V(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,jV.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),jV.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 YV(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 qV(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 KV(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 WV="Not capturing exception because it's already been captured.",XV="Discarded session because of missing or non-string release",QV=Symbol.for("SentryInternalError"),ZV=Symbol.for("SentryDoNotSendEventError");function b_(t){return{message:t,[QV]:!0}}function Pg(t){return{message:t,[ZV]:!0}}function zV(t){return!!t&&typeof t=="object"&&QV in t}function JV(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=RV(e.dsn):D&&m.warn("No DSN provided, client will not send events."),this._dsn){let n=FV(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(WV),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(WV),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=IV(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(XV);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){D&&m.warn(XV);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=NV(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=$V(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),HV(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&&(JV(s)?m.log(s.message):zV(s)?m.warn(s.message):m.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=eB(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=Dfe(this,s,_,n);return Lfe(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 JV(_)||zV(_)?_:(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.
138
- 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=YV(e,this._options.tunnel&&Kn(this._dsn));this.sendEnvelope(n)}};function Lfe(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 Dfe(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i}=e,a=n;if(Mg(a)&&o)return o(a,r);if(eB(a)){if(i){let c=i(qV(a));if(c?a=bo(n,KV(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 eB(t){return t.type==="transaction"}function tB(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 nB(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=xfe(t);return ln(s,[i])}function xfe(t){return[{type:"check_in"},t]}function Ufe(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function rB(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,[Ufe(t)])}function Gs(t,e){let n=e??wfe(t)??[];if(n.length===0)return;let r=t.getOptions(),o=rB(n,r._metadata,r.tunnel,t.getDsn());oB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function wfe(t){return oB().get(t)}function oB(){return Hr("clientToLogBufferMap",()=>new WeakMap)}function sB(t,e){return t(e.stack||"",1)}function yg(t,e){let n={type:e.name||e.constructor.name,value:e.message},r=sB(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Vfe(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function Bfe(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=Gfe(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Gfe(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Hfe(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=Vfe(n);if(a)return[a,i];let c=Bfe(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 iB(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=Hfe(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 aB(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=sB(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 kfe=5e3,gu=class extends L_{constructor(e){if(hV(),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+=Ffe(o),r._logWeight>=8e5?Gs(r):r._isLogTimerActive||(r._isLogTimerActive=!0,r._logFlushIdleTimeout=setTimeout(()=>{Gs(r)},kfe))}),r.on("flush",()=>{Gs(r)})}}eventFromException(e,n){let r=iB(this,this._options.stackParser,e,n);return r.level="error",Xn(r)}eventFromMessage(e,n="info",r){return Xn(aB(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return cB(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&cB(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]=tB(this,r);p&&(u.contexts={trace:p});let d=nB(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 cB(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 Ffe(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*uB(n[0]):Ki(n)?e+=uB(n):e+=100}),e}function uB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}var vg=Symbol.for("SentryBufferFullError");function lB(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 jfe(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 $fe(t,e){return t[e]||t.all||0}function pB(t,e,n=Date.now()){return $fe(t,e)>n}function dB(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+jfe(i,r):e===429&&(o.all=r+60*1e3);return o}var Yfe=64;function Au(t,e,n=lB(t.bufferSize||Yfe)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(f_(i,(p,d)=>{let _=S_(d);pB(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=dB(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):qfe(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 qfe(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 _B(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=Kfe({url:i,host:r,protocol:s}),c=t.body||void 0,u=t.cookies;return{url:a,method:t.method,query_string:EB(i),headers:_B(e),cookies:u,data:c}}function Kfe({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}function EB(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var Wfe=100;function pn(t,e){let n=G(),r=ce();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=Wfe}=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 fB,Xfe="FunctionToString",SB=new WeakMap,zfe=(()=>({name:Xfe,setupOnce(){fB=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=Zh(this),n=SB.has(G())&&e!==void 0?e:this;return fB.apply(n,t)}}catch{}},setup(t){SB.set(t,!0)}})),x_=zfe;var Jfe=[/^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$/],Qfe="EventFilters",Lg=(t={})=>{let e;return{name:Qfe,setup(n){let r=n.getOptions();e=TB(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=TB(t,s)}return Zfe(n,e)?null:n}}},w_=((t={})=>({...Lg(t),name:"InboundFilters"}));function TB(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Jfe],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Zfe(t,e){if(t.type){if(t.type==="transaction"&&tSe(t,e.ignoreTransactions))return D&&m.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
139
- Event: ${yo(t)}`),!0}else{if(eSe(t,e.ignoreErrors))return D&&m.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
140
- Event: ${yo(t)}`),!0;if(sSe(t))return D&&m.warn(`Event dropped due to not having an error message, error type or stacktrace.
141
- Event: ${yo(t)}`),!0;if(nSe(t,e.denyUrls))return D&&m.warn(`Event dropped due to being matched by \`denyUrls\` option.
142
- Event: ${yo(t)}.
143
- Url: ${U_(t)}`),!0;if(!rSe(t,e.allowUrls))return D&&m.warn(`Event dropped due to not being matched by \`allowUrls\` option.
144
- Event: ${yo(t)}.
145
- Url: ${U_(t)}`),!0}return!1}function eSe(t,e){return e?.length?v_(t).some(n=>Mo(n,e)):!1}function tSe(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Mo(n,e):!1}function nSe(t,e){if(!e?.length)return!1;let n=U_(t);return n?Mo(n,e):!1}function rSe(t,e){if(!e?.length)return!0;let n=U_(t);return n?Mo(n,e):!0}function oSe(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?oSe(n):null}catch{return D&&m.error(`Cannot extract url for event ${yo(t)}`),null}}function sSe(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function gB(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)){mB(i,a);let u=t(e,r[o]),l=c.length;hB(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)){mB(i,a);let p=t(e,u),d=c.length;hB(p,`errors[${l}]`,d,a),c=Dg(t,e,n,u,o,[p,...c],p,d)}}),c}function mB(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 hB(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 iSe="cause",aSe=5,cSe="LinkedErrors",uSe=((t={})=>{let e=t.limit||aSe,n=t.key||iSe;return{name:cSe,preprocessEvent(r,o,s){let i=s.getOptions();gB(yg,i.stackParser,n,e,r,o)}}}),V_=uSe;function AB(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 RB(t){return xg.map(o=>{let s=t[o],i=Array.isArray(s)?s.join(";"):s;return o==="Forwarded"?lSe(i):i?.split(",").map(a=>a.trim())}).reduce((o,s)=>s?o.concat(s):o,[]).find(o=>o!==null&&pSe(o))||null}function lSe(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function pSe(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 dSe={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},_Se="RequestData",ESe=((t={})=>{let e={...dSe,...t.include};return{name:_Se,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&fSe(n,i,{ipAddress:a},c),n}}}),B_=ESe;function fSe(t,e,n,r){if(t.request={...t.request,...SSe(e,r)},r.ip){let o=e.headers&&RB(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function SSe(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?AB(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 OB(t){let e="console";ji(e,t),$i(e,TSe)}function TSe(){"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 NB(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var mSe=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function hSe(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=mSe.exec(e);return n?n.slice(1):[]}function Ug(t){let e=hSe(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var gSe="Console",G_=(t={})=>{let e=new Set(t.levels||ou);return{name:gSe,setup(n){OB(({args:r,level:o})=>{G()!==n||!e.has(o)||ASe(o,r)})}}};function ASe(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:NB(t),message:IB(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${IB(r)}`:"Assertion failed",n.data.arguments=r}else return;pn(n,{input:e,level:t})}function IB(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",CB="ai.response.object",PB="ai.response.text",MB="ai.response.toolCalls",yB="ai.prompt.messages",vB="ai.prompt.tools",gr="ai.model.id",bB="ai.model.provider",LB="ai.response.providerMetadata",DB="ai.telemetry.functionId",xB="ai.usage.completionTokens",UB="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",wB="ai.toolCall.args",VB="ai.toolCall.result";function BB(t,e){t.setAttribute(ue,e)}function RSe(t){let{data:e,description:n}=H(t);if(!n)return;if(e[Bg]&&e[Gg]&&n==="ai.toolCall"){ISe(t,e);return}let r=e[gr],o=e[bB];typeof r!="string"||typeof o!="string"||!r||!o||CSe(t,n,e)}function OSe(t){if(t.type==="transaction"&&t.spans)for(let e of t.spans)NSe(e);return t}function NSe(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){Cn(e,xB,k_),Cn(e,UB,H_),typeof e[k_]=="number"&&typeof e[H_]=="number"&&(e["gen_ai.usage.total_tokens"]=e[k_]+e[H_]),Cn(e,yB,"gen_ai.request.messages"),Cn(e,PB,"gen_ai.response.text"),Cn(e,MB,"gen_ai.response.tool_calls"),Cn(e,CB,"gen_ai.response.object"),Cn(e,vB,"gen_ai.request.available_tools"),Cn(e,wB,"gen_ai.tool.input"),Cn(e,VB,"gen_ai.tool.output"),PSe(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 ISe(t,e){BB(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 CSe(t,e,n){BB(t,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[DB];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",RSe),t.addEventProcessor(Object.assign(OSe,{id:"VercelAiEventProcessor"}))}function PSe(t){let e=t[LB];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 GB="gen_ai.system",j_="gen_ai.request.model",HB="gen_ai.request.temperature",kB="gen_ai.request.frequency_penalty",FB="gen_ai.request.presence_penalty",jB="gen_ai.request.top_p",Hg="gen_ai.response.finish_reasons",$B="gen_ai.response.model",YB="gen_ai.response.id",qB="gen_ai.usage.input_tokens",KB="gen_ai.usage.output_tokens",WB="gen_ai.usage.total_tokens",XB="gen_ai.operation.name",kg="gen_ai.request.messages",Fg="gen_ai.response.text",zB="openai.response.id",JB="openai.response.model",QB="openai.response.timestamp",ZB="openai.usage.completion_tokens",eG="openai.usage.prompt_tokens",jg={CHAT:"chat"};var Vo="OpenAI",tG=["responses.create","chat.completions.create"];function $_(t){return t.includes("chat.completions")?jg.CHAT:t.includes("responses")?jg.CHAT:t.split(".").pop()||"unknown"}function nG(t){return`gen_ai.${$_(t)}`}function rG(t){return tG.includes(t)}function oG(t,e){return t?`${t}.${e}`:e}function sG(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function iG(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function MSe(t,e){let n={[GB]:"openai",[XB]:$_(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[HB]=r.temperature),"top_p"in r&&(n[jB]=r.top_p),"frequency_penalty"in r&&(n[kB]=r.frequency_penalty),"presence_penalty"in r&&(n[FB]=r.presence_penalty)}else n[j_]="unknown";return n}function aG(t,e,n,r){e!==void 0&&t.setAttributes({[eG]:e,[qB]:e}),n!==void 0&&t.setAttributes({[ZB]:n,[KB]:n}),r!==void 0&&t.setAttributes({[WB]:r})}function cG(t,e,n,r){e&&t.setAttributes({[zB]:e,[YB]:e}),n&&t.setAttributes({[JB]:n,[$B]:n}),r&&t.setAttributes({[QB]:new Date(r*1e3).toISOString()})}function ySe(t,e){if(cG(t,e.id,e.model,e.created),e.usage&&aG(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 vSe(t,e){cG(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[Hg]:JSON.stringify([e.status])}),e.usage&&aG(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens)}function bSe(t,e,n){if(!e||typeof e!="object")return;let r=e;if(sG(r)){if(ySe(t,r),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[Fg]:JSON.stringify(o)})}}else iG(r)&&(vSe(t,r),n&&r.output_text&&t.setAttributes({[Fg]:r.output_text}))}function LSe(t,e){"messages"in e&&t.setAttributes({[kg]:JSON.stringify(e.messages)}),"input"in e&&t.setAttributes({[kg]:JSON.stringify(e.input)})}function DSe(){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 xSe(t,e,n,r){return async function(...s){let i=r||DSe(),a=MSe(s,e),c=a[j_]||"unknown",u=$_(e);return Tu({name:`${u} ${c}`,op:nG(e),attributes:a},async l=>{try{i.recordInputs&&s[0]&&typeof s[0]=="object"&&LSe(l,s[0]);let p=await t.apply(n,s);return bSe(l,p,i.recordOutputs),p}catch(p){throw Gt(p),p}})}}function uG(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=oG(e,String(o));return typeof s=="function"&&rG(i)?xSe(s,i,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?uG(s,i,n):s}})}function $g(t,e){return uG(t,"",e)}function Ru(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function pG(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 dG(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:lG(o[3]),colno:lG(o[4]),in_app:pG(l||"",p)}}if(r.match(e))return{filename:r}}}function Yg(t){return[90,dG(t)]}function lG(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=I(te(),1),Ou={};function V(t,e,n){return n?sTe(t,e,n):oTe(t,e)}function oTe(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 sTe(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(!iTe(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 iTe(t){return typeof t._wrap=="function"}var Or=require("node:diagnostics_channel");y();var iW=I(oe(),1),wu=I(te(),1);de();y();y();var Mn=I(oe(),1),Go=I(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 hye(t){return typeof t.kind=="number"}function gye(t){return!!t.status}function UK(t){return!!t.name}function Aye(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 Rye(t){return hye(t)?t.kind:dt.INTERNAL}var iR="sentry-trace",aR="baggage",TR="sentry.dsc",mR="sentry.sampled_not_recording",wK="sentry.url",Oye="sentry.sample_rand",Nye="sentry.sample_rate",VK=Bn("sentry_scopes"),cR=Bn("sentry_fork_isolation_scope"),uR=Bn("sentry_fork_set_scope"),lR=Bn("sentry_fork_set_isolation_scope"),BK="_scopeContext";function Ia(t){return t.getValue(VK)}function GK(t,e){return t.setValue(VK,e)}function Iye(t,e){qe(t,BK,e)}function Du(t){return t[BK]}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 HK(t,e,n){let r=e[ks]||e[Iu];if(r)return Pye({attributes:e,name:t,kind:n},r);let o=e[Wg],s=typeof e[W]=="string"&&e[W].startsWith("cache.");if(o&&!s)return Cye({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 kK(t){let e=SR(t)?t.attributes:{},n=UK(t)?t.name:"<unknown>",r=Rye(t);return HK(n,e,r)}function Cye({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 Pye({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}=yye(n,e);if(!s)return{...Lu(t,n),op:o.join(".")};let l=n[Na],p=`${r} ${s}`,d=l?`${p} (${Mye(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 Mye(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 yye(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 FK(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=H(n).data[Qe],{description:i}=UK(n)?kK(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 jK(){return K.getActiveSpan()}var Rr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function $K({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 YK=new Set;function qK(){return Array.from(YK)}function kE(t){YK.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&&Lye(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=bye(n),c=xt.getBaggage(e)||xt.createBaggage({}),{dynamicSamplingContext:u,traceId:l,spanId:p,sampled:d}=KK(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 XK(WK(e,{sentryTrace:i,baggage:s}))}fields(){return[iR,aR]}},bK="[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(bK,t),r;let o=Mo(t,e);return n?.set(t,o),Rr&&!o&&m.log(bK,t),o}function KK(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 WK(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=Dye({traceId:o,spanId:s,sampled:i,dsc:a});return K.setSpanContext(t,c)}function vye(t,e,n){let r=XK(WK(t,e));return k.with(r,n)}function XK(t){let e=Ia(t),n={scope:e?e.scope:J().clone(),isolationScope:e?e.isolationScope:ce()};return GK(t,n)}function bye(t){try{let e=t[aR];return Array.isArray(e)?e.join(","):e}catch{return}}function Lye(t){let e=H(t).data,n=e[ia]||e[aa];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(wK);if(r)return r}function Dye({spanId:t,traceId:e,sampled:n,dsc:r}){let o=$K({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Tn.SAMPLED:Tn.NONE,traceState:o}}function xye(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 Uye(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 wye(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 zK(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"?Vye(e):e;return{attributes:o?{[W]:o,...n}:n,kind:r,links:s,startTime:i}}function Vye(t){return t<9999999999?t*1e3:t}function AR(t,e){let n=Bye(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=$K({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 Bye(t){if(t){let e=Du(t);if(e)return e}return k.active()}function Gye(t,e){return vye(k.active(),t,e)}function JK(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=>zK(t,e):e=>e()}function Hye(t){let e=(0,Mn.suppressTracing)(k.active());return k.with(e,t)}function QK(t){t.on("preprocessEvent",e=>{let n=jK();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 kye({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}=KK(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:xye,startSpanManual:Uye,startInactiveSpan:wye,getActiveSpan:jK,suppressTracing:Hye,getTraceData:kye,continueTrace:Gye,withActiveSpan:zK})}function eW(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=GK(r,{scope:_,isolationScope:E}).deleteValue(cR).deleteValue(uR).deleteValue(lR);return Iye(_,h),super.with(h,o,s,...i)}}return e}function Fye(t){let e=new Map;for(let n of t)jye(e,n);return Array.from(e,function([n,r]){return r})}function tW(t){return t.attributes[ER]===!0?void 0:fR(t)}function jye(t,e){let n=e.spanContext().spanId,r=tW(e);if(!r){pR(t,{id:n,span:e,children:[]});return}let o=$ye(t,r),s=pR(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function $ye(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 nW={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"},Yye=t=>Object.values(nW).includes(t);function rW(t){let e=SR(t)?t.attributes:{},n=gye(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=LK(e);if(o)return o}return n.message&&Yye(n.message)?{code:2,message:n.message}:{code:2,message:"unknown_error"}}}let r=LK(e);return r||(n?.code===Se.UNSET?{code:1}:{code:2,message:"unknown_error"})}function LK(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:nW[n]||"unknown_error"}}var DK=1e3,xK=300,dR=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||xK,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=tW(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()+xK*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=Fye(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=Kye(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>DK?c.sort((l,p)=>l.start_timestamp-p.start_timestamp).slice(0,DK):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 qye(t){let e=t.attributes,n=e[ue],r=e[W],o=e[Qe];return{origin:n,op:r,source:o}}function Kye(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=oW(t),i=Yn(t),a=t.attributes[$n],c={[Qe]:s,[$n]:a,[W]:e,[ue]:o,...r,...sW(t.attributes)},{links:u}=t,{traceId:l,spanId:p}=t.spanContext(),d=fR(t),_=rW(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"}=oW(r),T={[ue]:S,[W]:d,...sW(c),...E},h=rW(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 oW(t){let{op:e,source:n,origin:r}=qye(t),{op:o,description:s,source:i,data:a}=kK(t),c=e||o,u=n||i,l={...a,...Wye(t)};return{op:c,description:s,source:u,origin:r,data:l}}function sW(t){let e={...t};return delete e[$n],delete e[ER],delete e[Sr],e}function Wye(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=Aye(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 Xye(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 zye(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){Xye(e,n)}onEnd(e){zye(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=Zye(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?Jye(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}=HK(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 Jye(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=Qye(e,n);return o!==void 0&&(s=s.set(Nye,`${o}`)),r!==void 0&&(s=s.set(Oye,`${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 Qye(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(wK,s)),o}function Zye(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",eve=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&&tve(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"&&rve(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&&sve({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,iW.isTracingSuppressed)(k.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=ove(e),o=Ca(e);return n(o,r)}};function tve(t,e){let n=nve(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 nve(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 rve(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:eve;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 ove(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function sve({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 aW="Http",ive=V(`${aW}.sentry`,t=>new Ws(t)),cW=(t={})=>{let e=t.dropSpansForIncomingRequestStatusCodes??[[401,404],[300,399]];return{name:aW,setupOnce(){ive({...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 pW=I(oe(),1),dW=I(te(),1);var Pa=I(require("diagnostics_channel"),1);var Xs=rg(process.versions.node),Vu=Xs.major,uW=Xs.minor;var FE="sentry-trace",NR="baggage",lW=/baggage: (.*)\r\n/,zs=class extends dW.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
146
- `);let p=e.headers.match(lW)?.[1];if(u&&!p)e.headers+=`${NR}: ${u}\r
147
- `;else if(u){let d=Uu(p,u);d&&(e.headers=e.headers.replace(lW,`baggage: ${d}\r
148
- `))}}}_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&&ave(e,n)}_subscribeToChannel(e,n){let r=Vu>18||Vu===18&&uW>=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,pW.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 ave(t,e){let n=cve(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 cve(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 uve="NodeFetch",lve=V(`${uve}.sentry`,zs,t=>t),pve=((t={})=>({name:"NodeFetch",setupOnce(){lve(t)}})),_W=pve;var fW=require("node:child_process"),jE=require("node:fs"),ut=I(require("node:os"),1),SW=require("node:path"),CR=require("node:util");var dve=(0,CR.promisify)(jE.readFile),_ve=(0,CR.promisify)(jE.readdir),Eve="Context",fve=((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=Sve(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 Tve()),n.app&&(s.app=hve()),n.device&&(s.device=gve(n.device)),n.culture){let i=mve();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Cve()),s}return{name:Eve,processEvent(s){return r(s)}}}),TW=fve;function Sve(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 Tve(){let t=ut.platform();switch(t){case"darwin":return Nve();case"linux":return Ive();default:return{name:Ave[t]||t,version:ut.release()}}}function mve(){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 hve(){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 gve(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 Ave={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows"},Rve=[{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"]}],Ove={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 Nve(){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,fW.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 EW(t){return t.split(" ")[0].toLowerCase()}async function Ive(){let t={kernel_version:ut.release(),name:"Linux"};try{let e=await _ve("/etc"),n=Rve.find(a=>e.includes(a.name));if(!n)return t;let r=(0,SW.join)("/etc",n.name),o=(await dve(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(EW(a))>=0)||s[0];let i=EW(t.name);t.version=Ove[i]?.(o)}catch{}return t}function Cve(){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 gW=require("node:fs"),AW=require("node:readline");var PR=new Qt(10),RW=new Qt(20),Pve=7,Mve="ContextLines",yve=1e3,vve=1e4;function bve(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function Lve(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function Dve(t){return t.lineno!==void 0&&t.lineno>vve||t.colno!==void 0&&t.colno>yve}function xve(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 Uve(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=hW(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=hW(i,e)),n++}return s}function wve(t,e,n){return new Promise((r,o)=>{let s=(0,gW.createReadStream)(t),i=(0,AW.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){RW.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 Vve(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"||Lve(c)||Dve(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(RW.get(s))continue;let i=n[s];if(!i)continue;i.sort((u,l)=>u-l);let a=Uve(i,e);if(a.every(u=>xve(s,u)))continue;let c=bve(PR,s,{});o.push(wve(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&&Bve(s.stacktrace.frames,e,PR);return t}function Bve(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;Gve(r.lineno,r,e,o)}}function mW(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Gve(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=OW(t,n);s<t;s++){let i=r[s];if(i===void 0){mW(e),ee&&m.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){mW(e),ee&&m.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=NW(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 OW(t,e){return Math.max(1,t-e)}function NW(t,e){return t+e}function hW(t,e){return[OW(t,e),NW(t,e)]}var Hve=((t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Pve;return{name:Mve,processEvent(n){return Vve(n,e)}}}),IW=Hve;var yW=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 PW(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 CW(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function qE(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||CW(t)&&CW(e)}var kve="LyohIEBzZW50cnkvbm9kZS1jb3JlIDkuNDcuMSAoNDExZTEwMikgfCBodHRwczovL2dpdGh1Yi5jb20vZ2V0c2VudHJ5L3NlbnRyeS1qYXZhc2NyaXB0ICovCmltcG9ydHtTZXNzaW9uIGFzIGV9ZnJvbSJub2RlOmluc3BlY3Rvci9wcm9taXNlcyI7aW1wb3J0e3dvcmtlckRhdGEgYXMgdH1mcm9tIm5vZGU6d29ya2VyX3RocmVhZHMiO2NvbnN0IG49Z2xvYmFsVGhpcyxpPXt9O2NvbnN0IG89Il9fU0VOVFJZX0VSUk9SX0xPQ0FMX1ZBUklBQkxFU19fIjtjb25zdCBhPXQ7ZnVuY3Rpb24gcyguLi5lKXthLmRlYnVnJiZmdW5jdGlvbihlKXtpZighKCJjb25zb2xlImluIG4pKXJldHVybiBlKCk7Y29uc3QgdD1uLmNvbnNvbGUsbz17fSxhPU9iamVjdC5rZXlzKGkpO2EuZm9yRWFjaChlPT57Y29uc3Qgbj1pW2VdO29bZV09dFtlXSx0W2VdPW59KTt0cnl7cmV0dXJuIGUoKX1maW5hbGx5e2EuZm9yRWFjaChlPT57dFtlXT1vW2VdfSl9fSgoKT0+Y29uc29sZS5sb2coIltMb2NhbFZhcmlhYmxlcyBXb3JrZXJdIiwuLi5lKSl9YXN5bmMgZnVuY3Rpb24gYyhlLHQsbixpKXtjb25zdCBvPWF3YWl0IGUucG9zdCgiUnVudGltZS5nZXRQcm9wZXJ0aWVzIix7b2JqZWN0SWQ6dCxvd25Qcm9wZXJ0aWVzOiEwfSk7aVtuXT1vLnJlc3VsdC5maWx0ZXIoZT0+Imxlbmd0aCIhPT1lLm5hbWUmJiFpc05hTihwYXJzZUludChlLm5hbWUsMTApKSkuc29ydCgoZSx0KT0+cGFyc2VJbnQoZS5uYW1lLDEwKS1wYXJzZUludCh0Lm5hbWUsMTApKS5tYXAoZT0+ZS52YWx1ZT8udmFsdWUpfWFzeW5jIGZ1bmN0aW9uIHIoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQubWFwKGU9PltlLm5hbWUsZS52YWx1ZT8udmFsdWVdKS5yZWR1Y2UoKGUsW3Qsbl0pPT4oZVt0XT1uLGUpLHt9KX1mdW5jdGlvbiB1KGUsdCl7ZS52YWx1ZSYmKCJ2YWx1ZSJpbiBlLnZhbHVlP3ZvaWQgMD09PWUudmFsdWUudmFsdWV8fG51bGw9PT1lLnZhbHVlLnZhbHVlP3RbZS5uYW1lXT1gPCR7ZS52YWx1ZS52YWx1ZX0+YDp0W2UubmFtZV09ZS52YWx1ZS52YWx1ZToiZGVzY3JpcHRpb24iaW4gZS52YWx1ZSYmImZ1bmN0aW9uIiE9PWUudmFsdWUudHlwZT90W2UubmFtZV09YDwke2UudmFsdWUuZGVzY3JpcHRpb259PmA6InVuZGVmaW5lZCI9PT1lLnZhbHVlLnR5cGUmJih0W2UubmFtZV09Ijx1bmRlZmluZWQ+IikpfWFzeW5jIGZ1bmN0aW9uIGwoZSx0KXtjb25zdCBuPWF3YWl0IGUucG9zdCgiUnVudGltZS5nZXRQcm9wZXJ0aWVzIix7b2JqZWN0SWQ6dCxvd25Qcm9wZXJ0aWVzOiEwfSksaT17fTtmb3IoY29uc3QgdCBvZiBuLnJlc3VsdClpZih0LnZhbHVlPy5vYmplY3RJZCYmIkFycmF5Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgYyhlLG4sdC5uYW1lLGkpfWVsc2UgaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJPYmplY3QiPT09dC52YWx1ZS5jbGFzc05hbWUpe2NvbnN0IG49dC52YWx1ZS5vYmplY3RJZDthd2FpdCByKGUsbix0Lm5hbWUsaSl9ZWxzZSB0LnZhbHVlJiZ1KHQsaSk7cmV0dXJuIGl9bGV0IGY7KGFzeW5jIGZ1bmN0aW9uKCl7Y29uc3QgdD1uZXcgZTt0LmNvbm5lY3RUb01haW5UaHJlYWQoKSxzKCJDb25uZWN0ZWQgdG8gbWFpbiB0aHJlYWQiKTtsZXQgbj0hMTt0Lm9uKCJEZWJ1Z2dlci5yZXN1bWVkIiwoKT0+e249ITF9KSx0Lm9uKCJEZWJ1Z2dlci5wYXVzZWQiLGU9PntuPSEwLGFzeW5jIGZ1bmN0aW9uKGUse3JlYXNvbjp0LGRhdGE6e29iamVjdElkOm59LGNhbGxGcmFtZXM6aX0pe2lmKCJleGNlcHRpb24iIT09dCYmInByb21pc2VSZWplY3Rpb24iIT09dClyZXR1cm47aWYoZj8uKCksbnVsbD09bilyZXR1cm47Y29uc3QgYT1bXTtmb3IobGV0IHQ9MDt0PGkubGVuZ3RoO3QrKyl7Y29uc3R7c2NvcGVDaGFpbjpuLGZ1bmN0aW9uTmFtZTpvLHRoaXM6c309aVt0XSxjPW4uZmluZChlPT4ibG9jYWwiPT09ZS50eXBlKSxyPSJnbG9iYWwiIT09cy5jbGFzc05hbWUmJnMuY2xhc3NOYW1lP2Ake3MuY2xhc3NOYW1lfS4ke299YDpvO2lmKHZvaWQgMD09PWM/Lm9iamVjdC5vYmplY3RJZClhW3RdPXtmdW5jdGlvbjpyfTtlbHNle2NvbnN0IG49YXdhaXQgbChlLGMub2JqZWN0Lm9iamVjdElkKTthW3RdPXtmdW5jdGlvbjpyLHZhcnM6bn19fWF3YWl0IGUucG9zdCgiUnVudGltZS5jYWxsRnVuY3Rpb25PbiIse2Z1bmN0aW9uRGVjbGFyYXRpb246YGZ1bmN0aW9uKCkgeyB0aGlzLiR7b30gPSB0aGlzLiR7b30gfHwgJHtKU09OLnN0cmluZ2lmeShhKX07IH1gLHNpbGVudDohMCxvYmplY3RJZDpufSksYXdhaXQgZS5wb3N0KCJSdW50aW1lLnJlbGVhc2VPYmplY3QiLHtvYmplY3RJZDpufSl9KHQsZS5wYXJhbXMpLnRoZW4oYXN5bmMoKT0+e24mJmF3YWl0IHQucG9zdCgiRGVidWdnZXIucmVzdW1lIil9LGFzeW5jIGU9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSl9KSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLmVuYWJsZSIpO2NvbnN0IGk9ITEhPT1hLmNhcHR1cmVBbGxFeGNlcHRpb25zO2lmKGF3YWl0IHQucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZTppPyJhbGwiOiJ1bmNhdWdodCJ9KSxpKXtjb25zdCBlPWEubWF4RXhjZXB0aW9uc1BlclNlY29uZHx8NTA7Zj1mdW5jdGlvbihlLHQsbil7bGV0IGk9MCxvPTUsYT0wO3JldHVybiBzZXRJbnRlcnZhbCgoKT0+ezA9PT1hP2k+ZSYmKG8qPTIsbihvKSxvPjg2NDAwJiYobz04NjQwMCksYT1vKTooYS09MSwwPT09YSYmdCgpKSxpPTB9LDFlMykudW5yZWYoKSwoKT0+e2krPTF9fShlLGFzeW5jKCk9PntzKCJSYXRlLWxpbWl0IGxpZnRlZC4iKSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6ImFsbCJ9KX0sYXN5bmMgZT0+e3MoYFJhdGUtbGltaXQgZXhjZWVkZWQuIERpc2FibGluZyBjYXB0dXJpbmcgb2YgY2F1Z2h0IGV4Y2VwdGlvbnMgZm9yICR7ZX0gc2Vjb25kcy5gKSxhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6InVuY2F1Z2h0In0pfSl9fSkoKS5jYXRjaChlPT57cygiRmFpbGVkIHRvIHN0YXJ0IGRlYnVnZ2VyIixlKX0pLHNldEludGVydmFsKCgpPT57fSwxZTQpOw==";function MW(...t){m.log("[LocalVariables]",...t)}var vW=((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 yW.Worker(new URL(`data:application/javascript;base64,${kve}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{MW("Worker error",a)}),i.once("exit",a=>{MW("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 bW(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function Fve(t,e){if(e!==void 0)return bW(t(e,1))}function LW(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}=LW(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)}},jve="LocalVariables",$ve=((t={},e)=>{let n=new Qt(20),r,o=!1;function s(a){let c=bW(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:jve,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=Fve(_,S.description);if(R==null){h();return}let{add:O,next:N}=LW(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=PW(_,()=>{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]}}}),DW=$ve;var xW=(t={})=>Xs.major<19?DW(t):vW(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,Yve="Modules",qve=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,Kve=(()=>({name:Yve,processEvent(t){return t.modules={...t.modules,...UW()},t},getModules:UW})),wW=Kve;function Wve(){try{return require.cache?Object.keys(require.cache):[]}catch{return[]}}function Xve(){return{...qve,...Qve(),...Ma()?zve():{}}}function zve(){let t=require.main?.paths||[],e=Wve(),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 UW(){return yR||(yR=Xve()),yR}function Jve(){try{let t=(0,Hu.join)(process.cwd(),"package.json");return JSON.parse((0,Gu.readFileSync)(t,"utf8"))}catch{return{}}}function Qve(){let t=Jve();return{...t.dependencies,...t.devDependencies}}var Zve=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:Zve;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 ebe="OnUncaughtException",VW=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:ebe,setup(n){global.process.on("uncaughtException",tbe(n,e))}}};function tbe(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 nbe="OnUnhandledRejection",rbe=((t={})=>{let e={mode:"warn",...t};return{name:nbe,setup(n){global.process.on("unhandledRejection",obe(n,e))}}}),BW=rbe;function obe(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"}})}),sbe(r,e.mode)}}function sbe(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 GW=I(require("node:http"),1);var vR="Spotlight",ibe=((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{}abe(n,e)}}}),HW=ibe;function abe(t,e){let n=cbe(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=GW.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 cbe(t){try{return new URL(`${t}`)}catch{m.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}var kW=I(require("node:util"),1);var ube="NodeSystemError";function lbe(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:kW.getSystemErrorMap().has(t.errno)}var FW=(t={})=>({name:ube,processEvent:(e,n,r)=>{if(!lbe(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=I(require("node:diagnostics_channel"),1);var pbe="ChildProcess",jW=(t={})=>({name:pbe,setup(){bR.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&dbe(e.process,t)}),bR.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&_be(e.worker,t)})}});function dbe(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 _be(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 KW=I(qW(),1);var wR=eW(KW.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 Nbe="ProcessSession",WW=()=>({name:Nbe,setupOnce(){y_(),process.on("beforeExit",()=>{ce().getSession()?.status!=="ok"&&hu()})}});var Cbe=I(require("node:http"),1),Pbe=I(require("node:https"),1),JW=require("node:stream"),QW=require("node:zlib");var zr=I(require("node:net"),1),GR=I(require("node:tls"),1);var BR=I(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(`
149
- `).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof BR.Agent)return s.addRequest(e,o);this[Ir].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[Ir].currentSocket;if(this[Ir].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Ir].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[Ir]&&(this[Ir].defaultPort=e)}get protocol(){return this[Ir].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[Ir]&&(this[Ir].protocol=e)}};function JE(...t){m.log("[https-proxy-agent:parse-proxy-response]",...t)}function XW(t){return new Promise((e,n)=>{let r=0,o=[];function s(){let l=t.read();l?u(l):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),JE("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function c(l){i(),JE("onerror %o",l),n(l)}function u(l){o.push(l),r+=l.length;let p=Buffer.concat(o,r),d=p.indexOf(`\r
150
- \r
151
- `);if(d===-1){JE("have not received end of HTTP headers yet..."),s();return}let _=p.subarray(0,d).toString("ascii").split(`\r
152
- `),E=_.shift();if(!E)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let S=E.split(" "),T=+(S[1]||0),h=S.slice(2).join(" "),R={};for(let O of _){if(!O)continue;let N=O.indexOf(":");if(N===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${O}"`));let A=O.slice(0,N).toLowerCase(),M=O.slice(N+1).trimStart(),v=R[A];typeof v=="string"?R[A]=[v,M]:Array.isArray(v)?v.push(M):R[A]=M}JE("got proxy server response: %o %o",E,R),i(),e({connect:{statusCode:T,statusText:h,headers:R},buffered:p})}t.on("error",c),t.on("end",a),s()})}function Fu(...t){m.log("[https-proxy-agent]",...t)}var ju=class extends zE{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Fu("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?zW(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Fu("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;o=GR.connect({...this.connectOpts,servername:d&&zr.isIP(d)?void 0:d})}else Fu("Creating `net.Socket`: %o",this.connectOpts),o=zr.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=zr.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
153
- `;if(r.username||r.password){let d=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(s))a+=`${d}: ${s[d]}\r
154
- `;let c=XW(o);o.write(`${a}\r
155
- `);let{connect:u,buffered:l}=await c;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200){if(e.once("socket",Ibe),n.secureEndpoint){Fu("Upgrading socket connection to TLS");let d=n.servername||n.host;return GR.connect({...zW(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 Ibe(t){t.resume()}function zW(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Mbe=1024*32;function ybe(t){return new JW.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=vbe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Pbe:Cbe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new ju(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=bbe(t,t.httpModule??o,i);return Au(t,a)}function vbe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function bbe(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=ybe(u.body),_={...t.headers};u.body.length>Mbe&&(_["content-encoding"]="gzip",d=d.pipe((0,QW.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 Lbe=new Set(["false","f","n","no","off","0"]),Dbe=new Set(["true","t","y","yes","on","1"]);function QE(t,e){let n=String(t).toLowerCase();return Lbe.has(n)?!1:Dbe.has(n)?!0:e?.strict?null:!!t}var ZE=require("node:path");function e2(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function t2(t=process.argv[1]?Ug(process.argv[1]):process.cwd(),e=ZE.sep==="\\"){let n=e?e2(t):t;return r=>{if(!r)return;let o=e?e2(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 n2(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 r2=e_(Yg(t2()));var o2=I(require("node:os"),1);y();var s2=I(te(),1);var tf=require("worker_threads");var xbe=6e4,ef=class extends gu{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||o2.hostname(),r={...e,platform:"node",runtime:{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,s2.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??xbe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_getTraceInfoFromScope(e){return e?JK(this,e):[void 0,void 0]}};var i2=I($d(),1),a2=I(require("module"),1),Ube={};function c2(){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,i2.createAddHookMessageChannel)();a2.default.register("import-in-the-middle/hook.mjs",Ube.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_(),FW(),G_(),cW(),_W(),VW(),BW(),IW(),xW(),TW(),jW(),WW(),wW()]}function HR(t={}){return wbe(t,nf)}function wbe(t={},e){let n=Vbe(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&&c2(),ZK(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===vR)&&n.integrations.push(HW({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(),Hbe(),FK(o),QK(o),o}function kR(){if(!ee)return;let t=qK(),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 Vbe(t,e){let n=Bbe(t.release),r=t.spotlight??QE(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,o=Gbe(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||r2),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 Bbe(t){if(t!==void 0)return t;let e=n2();if(e!==void 0)return e}function Gbe(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 Hbe(){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",u2="@opentelemetry_sentry-patched/instrumentation-http",kbe=V(`${FR}.sentry`,t=>new Ws(t)),Fbe=V(FR,t=>{let e=new l2.HttpInstrumentation(t);try{e._diag=an.createComponentLogger({namespace:u2}),e.instrumentationName=u2}catch{}return e});function jbe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!ct(e)&&Xs.major>=22)}var p2=(t={})=>{let e=t.dropSpansForIncomingRequestStatusCodes??[[401,404],[300,399]];return{name:FR,setupOnce(){let n=jbe(t,G()?.getOptions());if(kbe({...t,extractIncomingTraceFromHeader:!n,propagateTraceInOutgoingRequests:!n}),n){let r=qbe(t);Fbe(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 $be(t){return"outputData"in t&&"outputSize"in t&&!("client"in t)&&!("statusCode"in t)}function Ybe(t){return t.headers["next-router-prefetch"]==="1"}function qbe(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"),!$be(r)&&Ybe(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 g2=I(h2(),1);var A2="NodeFetch",Xbe=V(A2,g2.UndiciInstrumentation,t=>eLe(t)),zbe=V(`${A2}.sentry`,zs,t=>t),Jbe=((t={})=>({name:"NodeFetch",setupOnce(){Zbe(t,G()?.getOptions())&&Xbe(t),zbe(t)}})),R2=Jbe;function Qbe(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 Zbe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&ct(e)}function eLe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=Qbe(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:()=>({[ue]:"auto.http.otel.node_fetch"})}}var G2=I(D2(),1);var Pr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;y();var _f=I(oe(),1),Mr=I(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 U2=(t,e)=>{Array.isArray(t[Fo])===!1&&Object.defineProperty(t,Fo,{enumerable:!1,value:[]}),e!==void 0&&t[Fo].push(e)},w2=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?w2(t,n):t},V2=(t,e,n)=>{if(e.name==="router"){let r=w2("",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}`}},dLe=(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")},B2=(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(dLe(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=>x2(n)||"").join(","):x2(e)},x2=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};var _Le="0.1.0",ELe="@sentry/instrumentation-express-v5",df=class extends Mr.InstrumentationBase{constructor(e={}){super(ELe,_Le,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){U2(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=V2(c,e,n),d=p.attributes[yn.EXPRESS_TYPE],_=(0,_f.getRPCMetadata)(k.active());if(_?.type===_f.RPCType.HTTP&&(_.route=u),B2(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 H2="Express",fLe="Express-V5";function k2(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 F2(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 j2=V(H2,()=>new G2.ExpressInstrumentation({requestHook:t=>k2(t),spanNameHook:(t,e)=>F2(t,e)})),$2=V(fLe,()=>new df({requestHook:t=>k2(t),spanNameHook:(t,e)=>F2(t,e)})),SLe=(()=>({name:H2,setupOnce(){j2(),$2()}})),JR=SLe;var sO=I(require("node:diagnostics_channel"),1);var rO=I(require("node:diagnostics_channel"),1);y();var Tf=I(oe(),1),A4=I(te(),1);de();var d4=I(r4(),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 NLe={"[: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,"\\$&"),ILe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),o4=t=>t.join(""),s4=(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(NLe))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[ILe(S),!1,l-n,!1]}let d="["+(u?"^":"")+o4(r)+"]",_="["+(u?"":"^")+o4(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,CLe=new Set(["!","?","+","*","@"]),eO=t=>CLe.has(t),i4=t=>eO(t.type),PLe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),MLe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),yLe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),a4=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),vLe="(?!(?:^|/)\\.\\.?(?:$|/))",Ef="(?!\\.)",bLe=new Set(["[","."]),LLe=new Set(["..","."]),DLe=new Set("().*{}+?[]^$\\!"),xLe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tO="[^/]",c4=tO+"*?",u4=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,MLe)}#E(e,n=PLe){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=yLe){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!!a4.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=a4.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(i4(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()),!i4(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&&LLe.has(this.#e[0]))){let E=bLe,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?vLe: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:"")+u4;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?Ef:"")+c4+")":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+=(DLe.has(u)?"\\":"")+u,a=!1;continue}if(u==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(u==="["){let[l,p,d,_]=s4(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)?u4:c4,n=!0;continue}else a=!1;if(u==="?"){s+=tO,n=!0;continue}s+=xLe(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)),ULe=/^\*+([^+@!?\*\[\(]*)$/,wLe=t=>e=>!e.startsWith(".")&&e.endsWith(t),VLe=t=>e=>e.endsWith(t),BLe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),GLe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),HLe=/^\*+\.\*+$/,kLe=t=>!t.startsWith(".")&&t.includes("."),FLe=t=>t!=="."&&t!==".."&&t.includes("."),jLe=/^\.\*+$/,$Le=t=>t!=="."&&t!==".."&&t.startsWith("."),YLe=/^\*+$/,qLe=t=>t.length!==0&&!t.startsWith("."),KLe=t=>t.length!==0&&t!=="."&&t!=="..",WLe=/^\?+([^+@!?\*\[\(]*)?$/,XLe=([t,e=""])=>{let n=_4([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},zLe=([t,e=""])=>{let n=E4([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},JLe=([t,e=""])=>{let n=E4([t]);return e?r=>n(r)&&r.endsWith(e):n},QLe=([t,e=""])=>{let n=_4([t]);return e?r=>n(r)&&r.endsWith(e):n},_4=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},E4=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},f4=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",l4={win32:{sep:"\\"},posix:{sep:"/"}},ZLe=f4==="win32"?l4.win32.sep:l4.posix.sep;Et.sep=ZLe;var yt=Symbol("globstar **");Et.GLOBSTAR=yt;var eDe="[^/]",tDe=eDe+"*?",nDe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",rDe="(?:(?!(?:\\/|^)\\.).)*?",oDe=(t,e={})=>n=>Et(n,t,e);Et.filter=oDe;var vn=(t,e={})=>Object.assign({},t,e),sDe=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=sDe;var S4=(t,e={})=>(zu(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,d4.default)(t));Et.braceExpand=S4;var iDe=(t,e={})=>new Ua(t,e).makeRe();Et.makeRe=iDe;var aDe=(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=aDe;var p4=/[?*]|[+@!]\(.*?\)|\[|\]/,cDe=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||f4,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]==="?"||!p4.test(s[2]))&&!p4.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 S4(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(YLe))?o=n.dot?KLe:qLe:(r=e.match(ULe))?o=(n.nocase?n.dot?GLe:BLe:n.dot?VLe:wLe)(r[1]):(r=e.match(WLe))?o=(n.nocase?n.dot?zLe:XLe:n.dot?JLe:QLe)(r):(r=e.match(HLe))?o=n.dot?FLe:kLe:(r=e.match(jLe))&&(o=$Le);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?tDe:n.dot?nDe:rDe,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"?cDe(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 T4="@fastify/otel",lDe="0.8.0",pDe=">=4.0.0 <6",m4=["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"),h4=Symbol("fastify otel addhook original"),g4=Symbol("fastify otel setnotfound original"),ff=Symbol("fastify otel ignore path"),Sf=class extends A4.InstrumentationBase{constructor(e){if(super(T4,lDe,e),this.servername=e?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[ff]=null,this._logger=an.createComponentLogger({namespace:T4}),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:pDe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(Ht,e),r.decorate(h4,r.addHook),r.decorate(g4,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 m4)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[h4];return m4.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[g4];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=I(oe(),1),Zs=I(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 O4(t,e,n){let r,o;try{o=t(),R4(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!R4(o)&&(e(r,o),r))throw r;return o}}function R4(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var dDe="0.1.0",_De="@sentry/instrumentation-fastify-v3",N4="anonymous",EDe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),hf=class extends Zs.InstrumentationBase{constructor(e={}){super(_De,dDe,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||N4,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),()=>O4(()=>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(!EDe.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()),fDe(),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||N4}`,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);I4(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 fDe(){let t=G();t&&t.on("spanStart",e=>{I4(e)})}function I4(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 P4="Fastify",SDe="Fastify-V5",TDe="Fastify-V3",M4=V(TDe,()=>new hf);function mDe(){let t=G();if(t)return t.getIntegrationByName(P4)}function C4(t,e,n,r){let o=mDe()?.getShouldHandleError()||b4;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 y4=V(SDe,()=>{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):(gDe(),r&&ADe(r))})}),sO.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;C4.call(C4,r,o,s,"diagnostics-channel")}),t}),hDe=(({shouldHandleError:t})=>{let e;return{name:P4,setupOnce(){e=t||b4,M4(),y4()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}}),v4=(t={})=>hDe(t);function b4(t,e,n){let r=n.statusCode;return r>=500||r<=299}function L4(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 gDe(){let t=G();t&&t.on("spanStart",e=>{L4(e)})}function ADe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&L4(s)}let r=e.routeOptions?.url,o=e.method||"GET";ce().setTransactionName(`${o} ${r}`)})}y();var e5=I(Z4(),1);var t5="Graphql",n5=V(t5,e5.GraphQLInstrumentation,t=>{let e=o5(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"]} (${HDe(l)})`)}}}}),GDe=((t={})=>({name:t5,setupOnce(){n5(o5(t))}})),r5=GDe;function o5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function HDe(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 E5=I(_5(),1);var f5="Kafka",S5=V(f5,()=>new E5.KafkaJsInstrumentation({consumerHook(t){me(t,"auto.kafkajs.otel.consumer")},producerHook(t){me(t,"auto.kafkajs.otel.producer")}})),FDe=(()=>({name:f5,setupOnce(){S5()}})),T5=FDe;var N5=I(O5(),1);var I5="LruMemoizer",C5=V(I5,()=>new N5.LruMemoizerInstrumentation),YDe=(()=>({name:I5,setupOnce(){C5()}})),P5=YDe;var w5=I(U5(),1);var V5="Mongo",B5=V(V5,()=>new w5.MongoDBInstrumentation({dbStatementSerializer:XDe,responseHook(t){me(t,"auto.db.otel.mongo")}}));function XDe(t){let e=EO(t);return JSON.stringify(e)}function EO(t){if(Array.isArray(t))return t.map(e=>EO(e));if(zDe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,EO(r)]).reduce((n,r)=>(QDe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function zDe(t){return typeof t=="object"&&t!==null&&!JDe(t)}function JDe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function QDe(t){return Array.isArray(t)}var ZDe=(()=>({name:V5,setupOnce(){B5()}})),G5=ZDe;var Z5=I(Q5(),1);var eX="Mongoose",tX=V(eX,()=>new Z5.MongooseInstrumentation({responseHook(t){me(t,"auto.db.otel.mongoose")}})),uxe=(()=>({name:eX,setupOnce(){tX()}})),nX=uxe;var _X=I(dX(),1);var EX="Mysql",fX=V(EX,()=>new _X.MySQLInstrumentation({})),hxe=(()=>({name:EX,setupOnce(){fX()}})),SX=hxe;var MX=I(PX(),1);var yX="Mysql2",vX=V(yX,()=>new MX.MySQL2Instrumentation({responseHook(t){me(t,"auto.db.otel.mysql2")}})),bxe=(()=>({name:yX,setupOnce(){vX()}})),bX=bxe;var r3=I(kX(),1),o3=I(QX(),1);var jxe=["get","set","setex"],CO=["get","mget"],$xe=["set","setex"];function dl(t,e){return t.includes(e.toLowerCase())}function PO(t){return dl(CO,t)?"cache.get":dl($xe,t)?"cache.put":void 0}function Yxe(t,e){return e.some(n=>t.startsWith(n))}function e3(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(jxe,t)&&r!=null?n(r):ZX(e.map(o=>n(o)))}catch{return}}function t3(t,e,n){if(!PO(t))return!1;for(let r of e)if(Yxe(r,n))return!0;return!1}function n3(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 s3="Redis",MO={},i3=(t,e,n,r)=>{t.setAttribute(ue,"auto.db.otel.redis");let o=e3(e,n),s=PO(e);if(!o||!s||!MO.cachePrefixes||!t3(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=n3(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))},qxe=V("IORedis",()=>new r3.IORedisInstrumentation({responseHook:i3})),Kxe=V("Redis-4",()=>new o3.RedisInstrumentation({responseHook:i3})),a3=Object.assign(()=>{qxe(),Kxe()},{id:s3}),Wxe=((t={})=>({name:s3,setupOnce(){MO=t,a3()}})),c3=Wxe;var P3=I(C3(),1);var M3="Postgres",y3=V(M3,()=>new P3.PgInstrumentation({requireParentSpan:!0,requestHook(t){me(t,"auto.db.otel.postgres")}})),uUe=(()=>({name:M3,setupOnce(){y3()}})),v3=uUe;y();var io=I(te(),1);de();var wO="PostgresJs",b3=[">=3.0.0 <4"],L3=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",b3);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`,b3,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"}},lUe=(()=>({name:wO,setupOnce(){L3()}})),D3=lUe;y();var Wf=I(te(),1);y();var pUe=process.env.PRISMA_SHOW_ALL_TRACES==="true",dUe="00-10-10-00";function _Ue(t){return t==="client"?dt.CLIENT:dt.INTERNAL}var EUe=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}`:dUe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)w3(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return k.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!pUe||t.middleware&&!this.traceMiddleware)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(V3(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return x3(s,e(s,r))}return n.startActiveSpan(o,t,s=>x3(s,e(s,r)))}};function w3(t,e,n,r,o){if(V3(e.name,o))return;let s={attributes:e.attributes,kind:_Ue(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)w3(t,c,n,r,o);i.end(e.endTime)})}function x3(t,e){return fUe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function fUe(t){return t!=null&&typeof t.then=="function"}function V3(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var B3={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=B3.version,SUe=BO.split(".")[0],U3="PRISMA_INSTRUMENTATION",VO=`V${SUe}_PRISMA_INSTRUMENTATION`,TUe=B3.name,mUe="@prisma/client",G3=class extends Wf.InstrumentationBase{tracerProvider;constructor(t={}){super(TUe,BO,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new Wf.InstrumentationNodeModuleDefinition(mUe,[BO])]}enable(){let t=this._config,e={helper:new EUe({traceMiddleware:t.middleware??!1,tracerProvider:this.tracerProvider??K.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]})};global[U3]=e,global[VO]=e}disable(){delete global[U3],delete global[VO]}isEnabled(){return!!global[VO]}};var H3="Prisma";function hUe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function k3(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var GO=class extends G3{constructor(){super()}enable(){super.enable();let e=k3(),n=!1;hUe(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/"))})})}},gUe=V(H3,t=>t?.prismaInstrumentation?t.prismaInstrumentation:new GO),F3=({prismaInstrumentation:t}={})=>({name:H3,setupOnce(){gUe({prismaInstrumentation:t})},setup(e){k3()&&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 z3=I(X3(),1);var J3="Hapi",Q3=V(J3,()=>new z3.HapiInstrumentation),bUe=(()=>({name:J3,setupOnce(){Q3()}})),Z3=bUe;var pz=I(lz(),1);de();var dz="Koa",_z=V(dz,pz.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}`)}})),BUe=((t={})=>({name:dz,setupOnce(){_z(t)}})),Ez=BUe;var Oz=I(Rz(),1);var Nz="Connect",Iz=V(Nz,()=>new Oz.ConnectInstrumentation),XUe=(()=>({name:Nz,setupOnce(){Iz()}})),Cz=XUe;var Bz=I(Vz(),1);var e0e=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),Gz="Tedious",Hz=V(Gz,()=>new Bz.TediousInstrumentation({})),t0e=(()=>{let t;return{name:Gz,setupOnce(){let e=Hz();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]||"";e0e.has(s)&&n.setAttribute(ue,"auto.db.otel.tedious")}))}}}),kz=t0e;var qz=I(Yz(),1);var Kz="GenericPool",Wz=V(Kz,()=>new qz.GenericPoolInstrumentation({})),o0e=(()=>{let t;return{name:Kz,setupOnce(){let e=Wz();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")}))}}}),Xz=o0e;var s8=I(o8(),1);var i8="Amqplib",E0e={consumeEndHook:t=>{me(t,"auto.amqplib.otel.consumer")},publishHook:t=>{me(t,"auto.amqplib.otel.publisher")}},a8=V(i8,()=>new s8.AmqplibInstrumentation(E0e)),f0e=(()=>({name:i8,setupOnce(){a8()}})),c8=f0e;var Rl="VercelAI";var _S=I(te(),1);var u8=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function S0e(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}=S0e(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 u8)e[r]=n(e[r]);return e}else{let r=u8.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}};var l8=V(Rl,()=>new dS({}));function T0e(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var m0e=((t={})=>{let e;return{name:Rl,options:t,setupOnce(){e=l8()},afterAllSetup(n){t.force??T0e(n)?F_(n):e?.callWhenPatched(()=>F_(n))}}}),p8=m0e;var fS=I(te(),1);var h0e=[">=4.0.0 <6"];function g0e(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",h0e,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}=g0e(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 d8=V(Vo,()=>new ES({})),A0e=((t={})=>({name:Vo,options:t,setupOnce(){d8()}})),_8=A0e;function E8(){return[JR(),v4(),r5(),G5(),nX(),SX(),bX(),c3(),v3(),F3(),Z3(),Ez(),Cz(),kz(),Xz(),T5(),c8(),P5(),p8(),_8(),D3()]}y();var f8=I(JA(),1),S8=I(sR(),1);de();var R0e=I($d(),1);var tN=1e6;function T8(t,e={}){t.getOptions().debug&&VR();let n=O0e(t,e);t.traceProvider=n}function O0e(t,e={}){let n=new S8.BasicTracerProvider({sampler:new HE(t),resource:new f8.Resource({[dn]:"node",[tA]:"sentry",[lA]:Ee}),forceFlushTimeoutMillis:500,spanProcessors:[new GE({timeout:N0e(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});return K.setGlobalTracerProvider(n),xt.setGlobalPropagator(new BE),k.setGlobalContextManager(new wR),n}function N0e(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 m8(){return nf().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(p2(),R2())}function h8(t){return[...m8(),...ct(t)?E8():[]]}function nN(t={}){return I0e(t,h8)}function I0e(t={},e){Hs(t,"node");let n=HR({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(T8(n,{spanProcessors:t.openTelemetrySpanProcessors}),kR()),n}function P0e(){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 A8(){let t=process.env.SENTRY_ENVIRONMENT?.trim();return t||(process.env.NODE_ENV==="production"?"production":"development")}function M0e(){let t=process.env.SENTRY_TRACES_SAMPLE_RATE?.trim();if(t===""||t===void 0)return A8()==="production"?.15:1;let e=Number(t);return!Number.isFinite(e)||e<0?0:Math.min(e,1)}var y0e=new Set(["authorization","cookie","x-admin-key","x-api-key","x-platform-web-secret","proxy-authorization"]);function v0e(t){if(!t||typeof t!="object")return t;let e={};for(let[n,r]of Object.entries(t)){let o=n.toLowerCase();e[n]=y0e.has(o)?"[Filtered]":r}return e}function b0e(t){let e=t.request;if(!e)return;e.headers&&typeof e.headers=="object"&&(e.headers=v0e(e.headers));let n=e.url;typeof n=="string"&&n.includes("token=")&&(e.url=n.replace(/([?&]token=)[^&]+/gi,"$1[Filtered]"))}function L0e(t){try{b0e(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 D0e(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 g8=!1;function x0e(t){let e=P0e();return{environment:A8(),...e?{release:e}:{},tracesSampleRate:M0e(),beforeSend(n){if(n.type==="transaction")return n;let r=L0e(n);return r===null?null:r},beforeSendTransaction(n){try{for(let r of n.spans??[])r.description&&(r.description=D0e(r.description))}catch{}return n},initialScope:n=>(n.setTag("service",t),n)}}function R8(t){if(g8)return;let e=process.env.SENTRY_DSN?.trim();if(!e){t.dsnProvided=!1;return}t.dsnProvided=!0;try{nN({dsn:e,...x0e(t.serviceName)}),g8=!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;R8({serviceName:"visa-cli"});var O8=(0,M8.promisify)(P8.execFile);function U0e(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)})
156
- ${r}: ${n(t.currentPath)}`}function y8(t,e){if(t.length===0){console.log(`${e} \u2713 All MCP client configs are up to date.`);return}console.log(`${e} Found ${t.length} stale MCP config ${t.length===1?"entry":"entries"}:`);for(let n of t)console.log(U0e(n))}function N8(t){console.log(` ! ${t.client.displayName} skipped: ${t.message}`)}var tt=new I8.Command,SS=null,Ol=!1;function on(){return SS=new Vr(()=>Oe.getSessionToken()),SS}function v8(t){return`$${(t/100).toFixed(2)}`}function w0e(t){let e=`visa-cli-${Lt.hostname()||"local"}`,n=(t?.trim()||e).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 V0e(t){if(!t)return;let e=t.split(",").map(o=>o.trim()).filter(Boolean),n=Array.from(new Set(e)),r=n.find(o=>o.length>64);if(r)throw new Error(`Tool id is too long: ${r}`);return n}function B0e(t){if(!t)return;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("--daily-cap must be a positive USD amount.");let n=Math.round(e*100);if(n<100||n>1e4)throw new Error("--daily-cap must be between 1 and 100 USD.");return n}function b8(t){return t&&t.length>0?t.join(", "):"all tools"}tt.name("visa-cli").description("Visa CLI - AI payment orchestration").version(IS().version);tt.hook("preAction",async()=>{await _N()});tt.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 Claude Code HUD during setup").option("--no-hud","Do not install the HUD during setup (default)").action(async t=>{try{if(t.check){let E=Rc();y8(E,"MCP config check:"),E.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 e=Rc(),n=new Map(e.map(E=>[E.client.id,E])),r=new Set,o=new Set,s=new Set;for(let E of Vn)if(gc(E)){let S;try{S=Ac(E)}catch(R){if(R instanceof Ti){N8(R),o.add(E.displayName),s.add(E.id);continue}throw R}let T=n.get(E.id),h=T?` \u2014 repaired stale ${T.staleReason} entry`:"";console.log(` \u2713 ${E.displayName} (${S.configPath.replace(Lt.homedir(),"~")})${h}`),T&&r.add(E.id)}let i=e.filter(E=>!r.has(E.client.id)&&!s.has(E.client.id)),a=0;for(let E of i){try{oT(E)}catch(S){if(S instanceof Ti){N8(S),o.add(E.client.displayName),s.add(E.client.id);continue}throw S}console.log(` \u2713 ${E.client.displayName} (${E.configPath.replace(Lt.homedir(),"~")}) \u2014 repaired stale ${E.staleReason} entry`),a++}let c=r.size+a;c===0&&o.size===0?console.log(" \u2713 MCP config verified \u2014 nothing to repair."):c>0&&console.log(` \u2713 Repaired ${c} stale MCP config ${c===1?"entry":"entries"}.`),o.size>0&&console.log(` ! Skipped MCP registration for: ${Array.from(o).join(", ")}. Rerun with access to those config files to complete registration.`),console.log(`
157
- 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 O8("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(`
158
- Step 3: Setting up authentication...`),!mt())console.log(" Not macOS \u2014 skipping biometric setup.");else{try{await O8("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=C8.existsSync(ai.join(Lt.homedir(),".claude.json"));if(t.hud===!0)if(!p)console.log(`
159
- Step 4: HUD requested, but Claude Code config was not detected.`),console.log(" Skipped. Enable later with: visa-cli hud enable");else{console.log(`
160
- 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(`
161
- `)[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(`
162
178
  \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557
163
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
164
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
@@ -166,40 +182,78 @@ Step 4: Enabling the Visa spend HUD...`);let E=Vl(l),S=E.installed==="new"||E.in
166
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
167
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
168
184
 
169
- ${d}Setup complete.${_} Restart Claude Code or run /mcp to connect.
185
+ ${g}Setup complete.${x} Restart Claude Code or run /mcp to connect.
170
186
 
171
- ${d}Try it out:${_}
187
+ ${g}Try it out:${x}
172
188
  \u2022 Ask Claude: "Generate an image of a neon cityscape"
173
189
  \u2022 Ask Claude: "What's the price of ETH on Base?"
174
- \u2022 Or run: visa-cli pay <merchant-url>
190
+ \u2022 Check balance: visa-cli balance show
175
191
 
176
- ${d}Verify:${_} visa-cli status
177
- ${d}HUD:${_} visa-cli hud enable
178
- ${d}Docs:${_} https://visacli.sh
179
- `)}catch(e){console.error("Error:",e.message),process.exit(1)}});tt.command("install [client]").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(t,e)=>{try{if(e.check){let s=Rc();y8(s,"MCP config check:"),s.length>0&&process.exit(1);return}if(e.repair){let s=Rc();if(s.length===0){console.log("\u2713 MCP config verified \u2014 nothing to repair.");return}for(let i of s)oT(i),console.log(` \u2713 ${i.client.displayName} (${i.configPath.replace(Lt.homedir(),"~")}) \u2014 repaired stale ${i.staleReason} entry`);console.log(`
180
- Repaired ${s.length} stale MCP config ${s.length===1?"entry":"entries"}.`);return}if(e.list){console.log(`
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(`
181
207
  \x1B[1mSupported MCP Clients\x1B[0m
182
- `),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 Vn){let c=gc(a),u=wI(a),l=c?"Yes":"No",p=u?"Yes":"No",d=a.globalConfigPath.replace(Lt.homedir(),"~");console.log(` ${a.displayName.padEnd(18)} ${l.padEnd(10)} ${p.padEnd(11)} ${d}`)}console.log("");return}let n=e.scope==="project"?"project":"global";if(e.all){let s=[],i=[];for(let a of Vn){if(!gc(a)){i.push(a.displayName);continue}Ac(a,n),s.push(a.displayName)}s.length>0&&console.log(`Installed for: ${s.join(", ")}.`),i.length>0&&console.log(`Skipped: ${i.map(a=>`${a} (not detected)`).join(", ")}.`),s.length===0&&i.length===0&&console.log("No supported clients found.");return}t||(console.error("Usage: visa-cli install <client>"),console.error(" visa-cli install --all"),console.error(" visa-cli install --list"),console.error(`
183
- Supported clients: ${Vn.map(s=>s.id).join(", ")}`),process.exit(1));let r=ZS(t);r||(console.error(`Unknown client: ${t}`),console.error(`Supported clients: ${Vn.map(s=>s.id).join(", ")}`),process.exit(1)),n==="global"&&!gc(r)&&(console.error(`${r.displayName} not detected on this machine.`),console.error(`Expected: ${r.detectPaths.join(", ")}`),process.exit(1));let o=Ac(r,n);console.log(`Registered visa-cli MCP server in ${o.configPath}`),console.log(o.message)}catch(n){console.error("Error:",n.message),process.exit(1)}});tt.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(t,e)=>{try{let n=e.scope==="project"?"project":"global";if(e.all){let s=[];for(let i of Vn)rT(i,n).removed&&s.push(i.displayName);s.length>0?console.log(`Removed visa-cli from: ${s.join(", ")}.`):console.log("visa-cli was not installed in any client.");return}t||(console.error("Usage: visa-cli uninstall <client>"),console.error(" visa-cli uninstall --all"),console.error(`
184
- Supported clients: ${Vn.map(s=>s.id).join(", ")}`),process.exit(1));let r=ZS(t);r||(console.error(`Unknown client: ${t}`),console.error(`Supported clients: ${Vn.map(s=>s.id).join(", ")}`),process.exit(1));let o=rT(r,n);o.removed?console.log(`Removed visa-cli from ${o.configPath}`):console.log(`visa-cli was not installed for ${r.displayName}.`)}catch(n){console.error("Error:",n.message),process.exit(1)}});tt.command("pay <url>").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(t,e)=>{try{CI(t);let n=PI(e.method),r=MI(e.body),o=new Vr(()=>Oe.getSessionToken());console.log(`Checking payment for ${t}...`);let s=yI(await o.paymentPreview({url:t}));console.log(` Merchant: ${s.merchantName}`),console.log(` Amount: $${s.amount.toFixed(2)} ${s.currency}`),console.log(` Rail: auto-detected
185
- `);let a=(await o.getStatus()).attestationRequired!==!1;a&&!mt()&&console.warn("Warning: Touch ID unavailable on this system \u2014 payment will proceed without biometric attestation.");let c=Nl.randomUUID(),u=await rp(o,async()=>{let l;if(a&&mt())try{let{nonce:p}=await o.getAttestationChallenge(),d=Buffer.from(JSON.stringify({nonce:p,amount:s.amount,merchant:s.merchantName,context:t})).toString("base64");l={signature:await Xl(d,`pay $${s.amount.toFixed(2)} to ${s.merchantName}`),nonce:p,amount:s.amount,merchant:s.merchantName}}catch(p){throw new Error(`Touch ID confirmation failed: ${p?.message||"user cancelled or biometric error"}`)}return o.pay({url:t,method:n,body:r,attestation:l,idempotencyKey:c})});if(u.success){if(console.log(`Payment complete: $${(u.amount??s.amount).toFixed(2)} \u2192 ${u.merchantName??s.merchantName}`),u.receipt?.urls?.length){console.log(`
186
- Result URLs:`);for(let l of u.receipt.urls)console.log(` ${l}`)}}else console.error(`Payment failed: ${u.message||"Unknown error"}`),process.exit(1)}catch(n){n instanceof Wt?console.error(`Error: ${n.message}`):console.error("Error:",n.message),process.exit(1)}});tt.command("status").description("Check enrollment, cards, wallet, and spending controls").action(async()=>{Ol=!1;try{let t=on(),e=await t.getStatus(),n={currentVersion:t.getClientVersion(),latestVersion:t.lastSignals.updateAvailable?.latestVersion,updateCheckDisabled:rr()},r=await t.getTransactions().catch(o=>{if(process.env.VISA_CLI_DEBUG){let s=o instanceof Error?o.message:String(o);process.stderr.write(`[visa-cli] getTransactions failed (HUD will omit): ${s}
187
- `)}return{transactions:[]}});process.stdout.write(uI(e,Array.isArray(r?.transactions)?r.transactions:[],mt(),n)),Ol=!0}catch(t){Ol=!1,console.error("Error:",t.message),process.exit(1)}});var rN=tt.command("api-key").alias("api-keys").description("Create and manage API keys for apps and agents");function oN(t){let e=t instanceof Error?t.message:String(t);console.error("Error:",e),e.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 api-key command with keychain access or run it from a normal terminal.")),process.exit(1)}rN.command("create [label]").description("Create an API key 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(t,e)=>{try{let r=await on().createAppApiKey({label:w0e(t),allowed_tools:V0e(e.tools),daily_cap_cents:B0e(e.dailyCap)});if(e.json){console.log(JSON.stringify(r,null,2));return}console.log("API key created."),console.log(""),console.log(`Key: ${r.key}`),console.log(`Label: ${r.label}`),console.log(`Owner: ${r.owner}`),console.log(`Allowed tools: ${b8(r.allowed_tools)}`),console.log(`Daily cap: ${v8(r.daily_cap_cents)}/day`),console.log(""),console.log("Store this key now. It will not be shown again."),console.log(""),console.log("Example:"),console.log(" curl -X POST https://auth.visacli.sh/v1/api/shortcuts/generate_image_card \\"),console.log(` -H "X-Api-Key: ${r.key}" \\`),console.log(' -H "Content-Type: application/json" \\'),console.log(` -d '{"prompt":"a neon cityscape at dusk"}'`)}catch(n){oN(n)}});rN.command("list").description("List API keys for the authenticated user").option("--json","Output raw JSON").action(async t=>{try{let n=await on().listAppApiKeys();if(t.json){console.log(JSON.stringify(n,null,2));return}let r=n.keys||[];if(r.length===0){console.log("No API keys found. Create one with: visa-cli api-key create");return}console.log("API keys"),console.log("");for(let o of r)console.log(`${o.id}. ${o.label} (${o.key_prefix})`),console.log(` Status: ${o.status}`),console.log(` Owner: ${o.owner}`),console.log(` Allowed tools: ${b8(o.allowed_tools)}`),console.log(` Daily cap: ${v8(o.daily_cap_cents)}/day`),console.log(` Last used: ${o.last_used_at||"never"}`)}catch(e){oN(e)}});rN.command("revoke <id>").alias("delete").description("Revoke (or delete) an API key by id").action(async t=>{try{let e=Number(t);if(!Number.isInteger(e)||e<=0)throw new Error("API key id must be a positive integer. Run `visa-cli api-key list` first.");let r=await on().revokeAppApiKey(e);console.log(`Revoked API key ${r.revoked}.`)}catch(e){oN(e)}});tt.command("reset").description("Log out and clear all credentials").action(async()=>{try{console.log(`Resetting Visa CLI...
188
- `);try{await on().logout(),console.log(" Server session invalidated.")}catch{console.log(" Server logout skipped (no active session).")}if(await Oe.clearAll(),console.log(" Keychain credentials cleared."),mt())try{await iI(),console.log(" Secure Enclave key deleted.")}catch{console.log(" No Secure Enclave key to delete.")}console.log(`
189
- Reset complete.`)}catch(t){console.error("Error:",t.message),process.exit(1)}});var G0e=100,L8=tt.command("balance").description("Manage prepaid balance");L8.command("show").description("Show prepaid balance + recent ledger entries").action(async()=>{try{let e=await new Vr(()=>Oe.getSessionToken()).getBalance(),n=e.balanceCents/100;if(console.log(`
190
- Balance: $${n.toFixed(2)}
191
- `),e.ledger.length===0){console.log(` (no ledger entries \u2014 top up to begin: visa-cli balance topup --amount 5)
192
- `);return}let r=e.ledger.slice(0,20),o=[],s=e.balanceCents;for(let l of r)o.push(s),s-=l.deltaCents;let i=19,a=9,c=11,u=18;console.log(` ${"TIMESTAMP".padEnd(i)} ${"DELTA".padStart(a)} ${"BALANCE".padStart(c)} ${"REASON".padEnd(u)} TOOL`),console.log(` ${"\u2500".repeat(i)} ${"\u2500".repeat(a)} ${"\u2500".repeat(c)} ${"\u2500".repeat(u)} ${"\u2500".repeat(20)}`),r.forEach((l,p)=>{let d=(l.createdAt||"").slice(0,19),E=`${l.deltaCents>=0?"+":""}$${(l.deltaCents/100).toFixed(2)}`,S=`$${(o[p]/100).toFixed(2)}`,T=(l.reason??"").slice(0,u),h=l.toolName??"";console.log(` ${d.padEnd(i)} ${E.padStart(a)} ${S.padStart(c)} ${T.padEnd(u)} ${h}`)}),console.log()}catch(t){console.error("Error:",t.message),process.exit(1)}});L8.command("topup").description("Top up prepaid balance from your default card (Touch ID required)").requiredOption("-a, --amount <usd>","Amount in USD (e.g. 5 or 1.50)").action(async t=>{try{let e=parseFloat(t.amount);if(!Number.isFinite(e)||e<=0)throw new Error("amount must be a positive number");let n=Math.round(e*100);if(n<G0e)throw new Error("minimum top-up is $1.00");let r=new Vr(()=>Oe.getSessionToken()),s=(await r.getStatus()).attestationRequired!==!1;s&&!mt()&&console.warn("Warning: Touch ID unavailable on this system \u2014 top-up will proceed without biometric attestation.");let i=Nl.randomUUID(),a=await rp(r,async()=>{let c;if(s&&mt()){let{nonce:u}=await r.getAttestationChallenge(),l=Buffer.from(JSON.stringify({nonce:u,amount:e,merchant:"Visa CLI Balance",context:"balance-topup"})).toString("base64");c={signature:await Xl(l,`top up balance with $${e.toFixed(2)}`),nonce:u,amount:e,merchant:"Visa CLI Balance"}}return r.topupBalance({amount_cents:n,idempotency_key:i,attestation:c})});if(a.success)console.log(`Top-up complete: +$${(n/100).toFixed(2)} \u2192 balance now $${((a.balanceCents??0)/100).toFixed(2)}`),a.transactionId&&console.log(`Transaction: ${a.transactionId}`);else{let c=a.error_code?` [${a.error_code}]`:"";console.error(`Top-up failed${c}: ${a.error||"Unknown error"}`),process.exit(1)}}catch(e){console.error("Error:",e.message),process.exit(1)}});var H0e=tt.command("session").description("Inspect session budgets");H0e.command("inspect <id>").description("Show a session-budget by id (e.g. sb_abc123)").action(async t=>{try{if(!t||t.length===0)throw new Error("session id required");let e=new Vr(()=>Oe.getSessionToken()),[n,r]=await Promise.allSettled([e.getSessionBudget(t),e.getSessionLedger(t)]),o=n.status==="fulfilled"?n.value.budget:void 0,s=r.status==="fulfilled"?r.value:void 0;if(!o&&!s?.ledger?.length&&(console.error(`Session not found: ${t}`),process.exit(1)),console.log(`
193
- Session: ${t}`),o){let i=(o.totalCents/100).toFixed(2),a=(o.cumulativeCents/100).toFixed(2),c=(o.remainingCents/100).toFixed(2);console.log(` Status: ${o.status}${o.expired?" (expired)":""}`),console.log(` Budget: $${i} \xB7 spent $${a} \xB7 remaining $${c}`),console.log(` Created: ${o.createdAt}`),console.log(` Expires: ${o.expiresAt}`)}if(s?.ledger?.length){console.log(`
194
- PSP References (CyberSource activity):`);let i=8,a=9,c=36;console.log(` ${"TYPE".padEnd(i)} ${"AMOUNT".padStart(a)} ${"CYBERSOURCE TX ID".padEnd(c)} CREATED`),console.log(` ${"\u2500".repeat(i)} ${"\u2500".repeat(a)} ${"\u2500".repeat(c)} ${"\u2500".repeat(19)}`);for(let u of s.ledger){let l=`$${(u.amountCents/100).toFixed(2)}`;console.log(` ${u.type.padEnd(i)} ${l.padStart(a)} ${(u.transactionId||"").padEnd(c)} ${(u.createdAt||"").slice(0,19)}`)}}else o&&console.log(`
195
- (no PSP references yet \u2014 no holds placed)`);console.log()}catch(e){console.error("Error:",e.message),process.exit(1)}});tt.command("feedback").description("Submit feedback about Visa CLI").argument("[message]","Your feedback message").action(async t=>{(!t||t.trim().length===0)&&(console.log('Usage: visa-cli feedback "your message"'),process.exit(1));try{await Oe.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1)),await on().feedback(t.trim()),console.log("Feedback submitted. Thanks!")}catch(e){console.error("Error:",e.message),process.exit(1)}});var sN=tt.command("config").description("Inspect the CLI configuration");sN.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 t=>{try{let e=on(),n=await RI({api:e,includeDev:!!t.dev});if(t.json){console.log(NI(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(OI(n.entries,{verbose:!!t.verbose}))}catch(e){console.error("Error:",e.message),process.exit(1)}});function k0e(){return Object.entries(dc).map(([t,e])=>` ${t.padEnd(22)} (${e.type}) ${e.description}`).join(`
196
- `)}sN.command("set <key> <value>").description("Persist a CLI setting to ~/.visa-mcp/settings.json").addHelpText("after",`
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",`
197
228
  Settable keys:
198
- ${k0e()}`).action((t,e)=>{try{let n=$N(t,e);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 li||n instanceof pi?console.error(`Error: ${n.message}`):console.error(`Error: ${n.message}`),process.exit(1)}});sN.command("unset <key>").description("Remove a CLI setting from ~/.visa-mcp/settings.json (falls back to env var or default)").action(t=>{try{let e=YN(t);e.removed?(console.log(`Removed ${e.key} from ${e.path}`),e.requiresRestart&&console.log("Restart Claude Code (or your MCP-enabled client) for the change to take effect.")):console.log(`No-op: ${e.key} was not set in ${e.path}.`)}catch(e){console.error(`Error: ${e.message}`),process.exit(1)}});var iN=tt.command("biometric").description("Manage Touch ID / biometric attestation enforcement");iN.command("status").description("Show current biometric enforcement state").action(async()=>{try{await Oe.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let n=await on().getStatus(),r=n.attestationRequired!==!1,o=!!n.hasAttestationKey,s=mt();console.log(`Server policy: Touch ID ${r?"REQUIRED":"NOT required"}`),console.log(`Attestation key registered: ${o?"yes":"no"}`),console.log(`Touch ID available on this device: ${s?"yes":"no"}`)}catch(t){console.error("Error:",t.message),process.exit(1)}});iN.command("on").description("Require Touch ID for payments (security upgrade \u2014 no Touch ID needed)").action(async()=>{try{await Oe.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let e=on(),n=await e.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 e.getStatus()).hasAttestationKey||console.warn("Note: no attestation key is registered yet. Run `visa-cli setup` to enroll Touch ID.")}catch(t){console.error("Error:",t.message),process.exit(1)}});iN.command("off").description("Disable Touch ID requirement (security downgrade \u2014 one Touch ID confirmation required)").action(async()=>{try{await Oe.getSessionToken()||(console.error("Not logged in. Run visa-cli setup first."),process.exit(1));let e=on(),n=await e.getStatus();if(n.attestationRequired===!1){console.log("Touch ID is already disabled.");return}n.hasAttestationKey&&!mt()&&(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 rp(e,async()=>{let o;if(n.hasAttestationKey&&mt())try{let{nonce:s}=await e.getAttestationChallenge(),i=0,a="",c=Buffer.from(JSON.stringify({nonce:s,amount:i,merchant:a,context:"biometric-preference"})).toString("base64");o={signature:await Xl(c,"disable Touch ID requirement"),nonce:s,amount:i,merchant:a}}catch(s){throw new Error(`Touch ID confirmation failed: ${s?.message||"cancelled"}`)}return e.setBiometricPreference({required:!1,attestation:o})});r.success||(console.error(`Failed: ${r.error||"unknown error"}`),process.exit(1)),console.log("Touch ID is no longer required for payments.")}catch(t){console.error("Error:",t.message),process.exit(1)}});var ci=tt.command("shell-hud").description("Manage the persistent Visa HUD shown in your shell prompt");function D8(){let t=qS();t.installed||(console.error(t.message),process.exit(1)),console.log(t.message)}function x8(){let t=KS();t.removed||(console.error(t.message),process.exit(1)),console.log(t.message)}ci.command("install").description("Install the persistent shell HUD into your zsh or bash rc file").action(D8);ci.command("enable").description("Enable the persistent shell HUD").action(D8);ci.command("uninstall").description("Remove the persistent shell HUD from your shell rc file").action(x8);ci.command("disable").description("Disable the persistent shell HUD").action(x8);ci.command("segment").description("Print the cached shell HUD segment").action(()=>{process.stdout.write(`${XS()}
199
- `)});ci.command("doctor").description("Diagnose shell HUD installation and connectivity").action(async()=>{let{existsSync:t,readFileSync:e}=await import("fs"),n=!0,r=(p,d,_)=>{console.log(` ${d?"\u2713":"\u2717"} ${p}: ${_}`),d||(n=!1)};console.log(`Shell HUD Doctor
200
- `);let o=tp();if(r("Shell detected",!!o,o??"none (zsh, bash, or PowerShell required)"),o){let p=np(o),d=t(p);if(r("RC file exists",d,p.replace(Lt.homedir(),"~")),d){let E=e(p,"utf-8").includes("visa-cli shell hud v2");r("HUD block installed",E,E?"found in rc file":"missing \u2014 run: visa-cli shell-hud install")}}let s=Tc(),i=t(s);if(r("Cache file",i,i?s.replace(Lt.homedir(),"~"):"missing \u2014 HUD has not refreshed yet"),i)try{let p=JSON.parse(e(s,"utf-8")),d=Date.now()-(p.renderedAt??0),_=Math.round(d/1e3),E=_<=30;console.log(` ${E?"\u2713":"\u26A0"} Cache freshness: ${_}s old${E?"":" (stale \u2014 will refresh on next prompt)"}`)}catch{r("Cache readable",!1,"corrupt JSON")}let a=ep(),c=t(a),u="missing";if(c)try{u=e(a,"utf-8").trim().slice(0,80)}catch{u="unreadable"}r("Line file",c,u);let l=!1;try{l=!!await Oe.getSessionToken()}catch{}if(r("Auth token",l,l?"found in keychain":"missing \u2014 run: visa-cli setup"),l)try{await on().getStatus(),r("API connectivity",!0,"GET /v1/status OK")}catch(p){let d=p instanceof Error?p.message:"unknown error";r("API connectivity",!1,d)}console.log(n?`
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?`
201
243
  All checks passed.`:`
202
- Some checks failed \u2014 see above.`),n||process.exit(1)});ci.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(async t=>{if(!(!t.force&&SI()))try{let e=on(),n=await e.getStatus(),r={currentVersion:e.getClientVersion(),latestVersion:e.lastSignals.updateAvailable?.latestVersion,updateCheckDisabled:rr()},o=WS(n,r);zS(o)}catch{}finally{Sc()}});tt.command("statusline").description("Output the Visa HUD for agent statusline integrations").option("--json","Output structured JSON for clients that render their own HUD").action(async t=>{try{let e=await CN(),r=XS().split(`
203
- `)[0];if(t.json){let s=await yN(r,e);process.stdout.write(`${JSON.stringify(s,null,2)}
204
- `);return}let o=await PN(r,e);process.stdout.write(`${o}
205
- `)}catch(e){let n=e instanceof Error?e.message:"unknown error";console.error(`Failed to render Visa HUD: ${n}`),process.exit(1)}});var TS=tt.command("hud").description("Manage the Visa HUD for supported agent terminals");TS.command("enable").description("Register Visa HUD for Claude Code or Codex").argument("[client]","Agent client to enable: claude, codex, or all","claude").action(t=>{let e=LS(t);if(e||(console.error(`Unknown HUD client: ${t}`),console.error("Supported clients: claude, codex, all"),process.exit(1)),e==="claude"||e==="claude-code"||e==="all"){let n=ai.join(Lt.homedir(),".claude","settings.json"),r=Vl(n);console.log(r.message),(r.installed==="error"||r.installed==="malformed-json")&&process.exit(1)}if(e==="codex"||e==="all"){let n=qS();console.log(n.message),console.log("Codex structured HUD payload is available with: visa-cli statusline --json"),console.log("Codex does not currently expose a Claude-style command statusLine install path, so this enables the terminal HUD fallback."),n.installed||process.exit(1)}});TS.command("disable").description("Remove Visa HUD from Claude Code or Codex terminal surfaces").argument("[client]","Agent client to disable: claude, codex, or all","claude").action(t=>{let e=LS(t);e||(console.error(`Unknown HUD client: ${t}`),console.error("Supported clients: claude, codex, all"),process.exit(1));let n=!1,r=!1;if(e==="claude"||e==="claude-code"||e==="all"){let o=ai.join(Lt.homedir(),".claude","settings.json"),s=PS(o);console.log(s.message),s.removed&&(r=!0),!s.removed&&e!=="all"&&(n=!0)}if(e==="codex"||e==="all"){let o=KS();console.log(o.message),o.removed&&(r=!0),!o.removed&&e!=="all"&&(n=!0)}e==="all"&&!r&&(n=!0),n&&process.exit(1)});TS.command("enable-claude").description("Register Visa HUD as the Claude Code statusLine").action(()=>{let t=ai.join(Lt.homedir(),".claude","settings.json"),e=Vl(t);console.log(e.message),(e.installed==="error"||e.installed==="malformed-json")&&process.exit(1)});TS.command("disable-claude").description("Remove Visa HUD from Claude Code statusLine (leaves other tools untouched)").action(()=>{let t=ai.join(Lt.homedir(),".claude","settings.json"),e=PS(t);console.log(e.message),e.removed||process.exit(1)});tt.hook("postAction",()=>{if(Ol){Ol=!1;return}SS&&aI(SS.lastSignals)});tt.parse();
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)});